Skip to content

Commit

Permalink
extend test
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Nov 28, 2023
1 parent 1671c9c commit cd37194
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions data_tamer/tests/parser_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,21 @@ TEST(DataTamerParser, VectorParsing)
auto dummy_sink = std::make_shared<DataTamer::DummySink>();
channel->addDataSink(dummy_sink);

std::vector<double> vals = {10, 11, 12};
std::array<Point3D, 2> points;
std::vector<double> valsA = {10, 11, 12};
std::array<int, 2> valsB = {13, 14};

std::array<Point3D, 3> points;
points[0] = {1, 2, 3};
points[1] = {4, 5, 6};
points[2] = {7, 8, 9};
std::vector<Quaternion> quats(2);
quats[0] = {20, 21, 22, 23};
quats[1] = {30, 31, 32, 33};

channel->registerValue("vals", &vals);
channel->registerValue("valsA", &valsA);
channel->registerValue("valsB", &valsB);
channel->registerValue("points", &points);
channel->registerValue("quats", &quats);

channel->takeSnapshot();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
Expand All @@ -258,9 +266,12 @@ TEST(DataTamerParser, VectorParsing)
std::cout << name << ": " << value << std::endl;
}

ASSERT_EQ(parsed_values.at("vals[0]"), 10);
ASSERT_EQ(parsed_values.at("vals[1]"), 11);
ASSERT_EQ(parsed_values.at("vals[2]"), 12);
ASSERT_EQ(parsed_values.at("valsA[0]"), 10);
ASSERT_EQ(parsed_values.at("valsA[1]"), 11);
ASSERT_EQ(parsed_values.at("valsA[2]"), 12);

ASSERT_EQ(parsed_values.at("valsB[0]"), 13);
ASSERT_EQ(parsed_values.at("valsB[1]"), 14);

ASSERT_EQ(parsed_values.at("points[0]/x"), 1);
ASSERT_EQ(parsed_values.at("points[0]/y"), 2);
Expand All @@ -269,4 +280,18 @@ TEST(DataTamerParser, VectorParsing)
ASSERT_EQ(parsed_values.at("points[1]/x"), 4);
ASSERT_EQ(parsed_values.at("points[1]/y"), 5);
ASSERT_EQ(parsed_values.at("points[1]/z"), 6);

ASSERT_EQ(parsed_values.at("points[2]/x"), 7);
ASSERT_EQ(parsed_values.at("points[2]/y"), 8);
ASSERT_EQ(parsed_values.at("points[2]/z"), 9);

ASSERT_EQ(parsed_values.at("quats[0]/w"), 20);
ASSERT_EQ(parsed_values.at("quats[0]/x"), 21);
ASSERT_EQ(parsed_values.at("quats[0]/y"), 22);
ASSERT_EQ(parsed_values.at("quats[0]/z"), 23);

ASSERT_EQ(parsed_values.at("quats[1]/w"), 30);
ASSERT_EQ(parsed_values.at("quats[1]/x"), 31);
ASSERT_EQ(parsed_values.at("quats[1]/y"), 32);
ASSERT_EQ(parsed_values.at("quats[1]/z"), 33);
}

0 comments on commit cd37194

Please sign in to comment.