Skip to content

Commit

Permalink
test NTTable column order
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Dec 23, 2024
1 parent 0a2313d commit 87abad5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/testnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,27 @@ void testNTTable()

auto top = nt::NTTable{}
.add_column(TypeCode::Int32, "A", "Col A")
.add_column(TypeCode::String, "C", "Col C")
.add_column(TypeCode::String, "B", "Col B")
.create();

shared_array<const std::string> labels({"Col A", "Col B"});
shared_array<const std::string> labels({"Col A", "Col C", "Col B"});
testArrEq(top["labels"].as<shared_array<const std::string>>(), labels);
testTrue(top["value.A"].type()==TypeCode::Int32A);
testTrue(top["value.B"].type()==TypeCode::StringA);

std::vector<std::string> names;
for(auto fld : top["value"].ichildren()) {
names.push_back(top.nameOf(fld));
}
shared_array<const std::string> expect({"value.A", "value.C", "value.B"});
testArrEq(shared_array<const std::string>(names.begin(), names.end()), expect);
}

} // namespace

MAIN(testnt) {
testPlan(21);
testPlan(22);
testNTScalar();
testNTNDArray();
testNTURI();
Expand Down

0 comments on commit 87abad5

Please sign in to comment.