13using namespace boost::unit_test_framework;
36 framework::master_test_suite().p_name.value =
"LogicalNameMap class test suite";
47 BOOST_CHECK(path1 ==
"/");
48 BOOST_CHECK(path1.
length() == 1);
49 BOOST_CHECK(path2 ==
"/module1");
50 BOOST_CHECK(path2.
length() == 8);
51 BOOST_CHECK(path3 ==
"/module/blah");
52 BOOST_CHECK(path3.
length() == 12);
56 BOOST_CHECK(path3 ==
"/module/blah");
60 BOOST_CHECK(path4 ==
"/moduleX..Yblah./sub");
62 BOOST_CHECK(path4 ==
"/moduleX/Yblah/sub");
64 BOOST_CHECK((path4 /
"next.register").getWithAltSeparator() ==
"moduleX.Yblah.sub.next.register");
66 BOOST_CHECK(path4 ==
"/moduleX..Yblah./sub");
68 BOOST_CHECK(path4 ==
"/moduleX..Yblah./sub");
70 BOOST_CHECK(path3 /
"register" ==
"/module/blah/register");
71 BOOST_CHECK(
"root" / path3 /
"register" ==
"/root/module/blah/register");
72 BOOST_CHECK(
"root/" + path3 +
"register" ==
"root//module/blahregister");
73 BOOST_CHECK(
"root" / path3 +
"register" ==
"/root/module/blahregister");
74 BOOST_CHECK(
"root" + path3 /
"register" ==
"root/module/blah/register");
75 BOOST_CHECK(path2 / path3 ==
"/module1/module/blah");
78 BOOST_CHECK(path3 ==
"/module/blah/test");
80 BOOST_CHECK(path3 ==
"/module/blah");
82 BOOST_CHECK(path3 ==
"/blah");
84 BOOST_CHECK(path3 ==
"/");
86 BOOST_CHECK(path2 ==
"/");
91 BOOST_CHECK(path1 ==
"/SomeModule/withSomeRegister");
96 BOOST_CHECK(path2 ==
"/SomeModule/withSomeRegister*3");
99 BOOST_CHECK(path2 ==
"/SomeModule/withSomeRegister/3");
101 BOOST_CHECK(BAR() ==
"/#");
102 BOOST_CHECK(BAR() / 0 / 32 * 8 ==
"/#/0/32*8");
106 RegisterPath path1(
"/SomeModule/withSubModules/and/withSomeRegister/");
108 BOOST_CHECK(comps1.size() == 4);
109 BOOST_CHECK(comps1[0] ==
"SomeModule");
110 BOOST_CHECK(comps1[1] ==
"withSubModules");
111 BOOST_CHECK(comps1[2] ==
"and");
112 BOOST_CHECK(comps1[3] ==
"withSomeRegister");
116 BOOST_CHECK(comps2.size() == 0);
120 BOOST_CHECK(comps3.size() == 1);
121 BOOST_CHECK(comps3[0] ==
"singleComponent");
Class to store a register path name.
std::vector< std::string > getComponents() const
split path into components
std::string getWithAltSeparator() const
obtain path with alternative separator character instead of "/".
void setAltSeparator(const std::string &altSeparator)
set alternative separator.
size_t length() const
return the length of the path (including leading slash)
void testNumericAddresses()
RegisterPath BAR()
The numeric_address::BAR() function can be used to directly access registers by numeric addresses,...