File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ To begin with we will see an example of parsing a hello-world program and see wh
2727
2828int main ()
2929{
30- std::cout << "Hello World!\n";
30+ std::cout << "Hello, World!\n";
3131
3232 return 0;
3333}
@@ -74,6 +74,14 @@ TEST_CASE("Parsing hello world program")
7474 cppast::CppConstBinomialExprEPtr coutHelloWorld = mainBodyMembers[ 0] ;
7575 REQUIRE(coutHelloWorld);
7676 CHECK(coutHelloWorld->oper() == cppast::CppBinaryOperator::INSERTION);
77+
78+ cppast::CppConstNameExprEPtr coutOperand1 = &(coutHelloWorld->term1());
79+ REQUIRE(coutOperand1);
80+ CHECK(coutOperand1->value() == "std::cout");
81+
82+ cppast::CppConstStringLiteralExprEPtr coutOperand2 = &(coutHelloWorld->term2());
83+ REQUIRE(coutOperand2);
84+ CHECK(coutOperand2->value() == "\" Hello, World!\\ n\" ");
7785}
7886
7987```
Original file line number Diff line number Diff line change 22
33int main ()
44{
5- std::cout << " Hello World!\n " ;
5+ std::cout << " Hello, World!\n " ;
66
77 return 0 ;
88}
Original file line number Diff line number Diff line change @@ -31,4 +31,12 @@ TEST_CASE("Parsing hello world program")
3131 cppast::CppConstBinomialExprEPtr coutHelloWorld = mainBodyMembers[0 ];
3232 REQUIRE (coutHelloWorld);
3333 CHECK (coutHelloWorld->oper () == cppast::CppBinaryOperator::INSERTION);
34+
35+ cppast::CppConstNameExprEPtr coutOperand1 = &(coutHelloWorld->term1 ());
36+ REQUIRE (coutOperand1);
37+ CHECK (coutOperand1->value () == " std::cout" );
38+
39+ cppast::CppConstStringLiteralExprEPtr coutOperand2 = &(coutHelloWorld->term2 ());
40+ REQUIRE (coutOperand2);
41+ CHECK (coutOperand2->value () == " \" Hello, World!\\ n\" " );
3442}
You can’t perform that action at this time.
0 commit comments