From 2120f7b3ea9dde5158f894a97bdbc274863bb109 Mon Sep 17 00:00:00 2001 From: Ethan Rodkin Date: Wed, 20 Nov 2024 13:43:55 -0500 Subject: [PATCH] unit test remote name conversion --- src/viam/sdk/tests/test_common.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/viam/sdk/tests/test_common.cpp b/src/viam/sdk/tests/test_common.cpp index 0d27d468c..6e4454b03 100644 --- a/src/viam/sdk/tests/test_common.cpp +++ b/src/viam/sdk/tests/test_common.cpp @@ -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