38 aStringToPopulate +=
" {";
40 if( aNode->isOverbar() )
41 aStringToPopulate +=
"OVER";
42 if( aNode->isSubscript() )
43 aStringToPopulate +=
"SUB";
44 if( aNode->isSuperscript() )
45 aStringToPopulate +=
"SUP";
47 if( aNode->has_content() )
48 aStringToPopulate +=
"'" + aNode->string() +
"'";
50 for(
auto& c : aNode->children )
53 aStringToPopulate +=
"} ";
68 std::vector<PARSE_CASE> cases =
72 " { {'A normal string'} } "
75 "_{A subscript String}",
76 " { {SUB {'A subscript String'} } } "
79 "^{A superscript String}",
80 " { {SUP {'A superscript String'} } } "
83 "~{An overbar String}",
84 " { {OVER {'An overbar String'} } } "
87 "~{An incomplete markup",
88 " { {'~{An incomplete markup'} } "
91 "A string ~{overbar}",
92 " { {'A string '} {OVER {'overbar'} } } "
95 "A string ~{incomplete markup",
96 " { {'A string ~{incomplete markup'} } "
99 "A string ~{overbar} ~{incomplete markup",
100 " { {'A string '} {OVER {'overbar'} } {' ~{incomplete markup'} } "
102 {
"A string ~{incomplete markup ~{overbar}",
103 " { {'A string ~{incomplete markup '} {OVER {'overbar'} } } "
107 for(
auto& c : cases )
109 BOOST_TEST_INFO_SCOPE( c.Input );
112 std::unique_ptr<MARKUP::NODE> rootNode = parser.
Parse();
113 BOOST_REQUIRE( rootNode );
118 BOOST_CHECK_EQUAL( result, c.ExpectedResult );
std::unique_ptr< NODE > Parse()
std::string ExpectedResult
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
void nodeToString(std::unique_ptr< MARKUP::NODE > &aNode, std::string &aStringToPopulate)
Declare the test suite.
BOOST_AUTO_TEST_CASE(Parse)
Test the #Parse method.