Skip to content

Commit

Permalink
unit test remote name conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
stuqdog committed Nov 20, 2024
1 parent 995649d commit 2120f7b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/viam/sdk/tests/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,23 @@ BOOST_AUTO_TEST_CASE(test_version_metadata) {
BOOST_CHECK_EQUAL(version_constructed, version);
}

BOOST_AUTO_TEST_CASE(test_name_conversion) {
std::string long_name1 = "foo:bar";
auto res1 = long_name_to_remote_and_short(long_name1);
BOOST_CHECK_EQUAL(res1.first, "foo");
BOOST_CHECK_EQUAL(res1.second, "bar");

std::string long_name2 = "foo:bar:baz";
auto res2 = long_name_to_remote_and_short(long_name2);
BOOST_CHECK_EQUAL(res2.first, "foo:bar");
BOOST_CHECK_EQUAL(res2.second, "baz");

std::string long_name3 = "foo";
auto res3 = long_name_to_remote_and_short(long_name3);
BOOST_CHECK_EQUAL(res3.first, "");
BOOST_CHECK_EQUAL(res3.second, "foo");
}

BOOST_AUTO_TEST_SUITE_END()

} // namespace sdktests
Expand Down

0 comments on commit 2120f7b

Please sign in to comment.