Fix Tree String tests
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2019-09-22 17:41:18 +02:00
parent 30d82085cc
commit 326a3c097a
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 13 additions and 13 deletions

View File

@ -46,7 +46,7 @@ TEST_CASE( "Assignment Statement To String", "[BoundTreeString]" ) {
const BoundVariableKey *keyObj = new BoundVariableKey(HashedString(key), 0, true, ScriptType::NilType); const BoundVariableKey *keyObj = new BoundVariableKey(HashedString(key), 0, true, ScriptType::NilType);
auto s = new BoundAssignmentStatement(keyObj, new BoundLiteralIntegerExpression(5, 0,0)); auto s = new BoundAssignmentStatement(keyObj, new BoundLiteralIntegerExpression(5, 0,0));
s->GetTreeString(stream, 1); s->GetTreeString(stream, 1);
REQUIRE(stream.str() == "\tAssignment -> global key\n\t\tLiteralInteger: 5 (number)"); REQUIRE(stream.str() == "\tAssignment -> global key\n\t\tLiteralInteger: 5 (numeric (Known integer))");
delete s; delete s;
} }
@ -102,11 +102,11 @@ TEST_CASE( "Numerical For to String", "[BoundTreeString]" ) {
REQUIRE(stream.str() == REQUIRE(stream.str() ==
R"( NumericForLoopStatement R"( NumericForLoopStatement
Start: Start:
LiteralInteger: 0 (number) LiteralInteger: 0 (numeric (Known integer))
End: End:
LiteralInteger: 5 (number) LiteralInteger: 5 (numeric (Known integer))
Step: Step:
LiteralInteger: 1 (number) LiteralInteger: 1 (numeric (Known integer))
Do: Do:
BadStatement)"); BadStatement)");
delete s; delete s;
@ -122,8 +122,8 @@ TEST_CASE( "Generic For to String", "[BoundTreeString]" ) {
s->GetTreeString(stream, 1); s->GetTreeString(stream, 1);
REQUIRE(stream.str() == REQUIRE(stream.str() ==
R"( GenericForLoopStatement R"( GenericForLoopStatement
Key: k (number) Key: k (numeric (Known integer))
Value: v (number) Value: v (numeric (Known integer))
Iterator: Iterator:
NilExpression (nil) NilExpression (nil)
Do: Do:
@ -173,7 +173,7 @@ TEST_CASE( "Literal Integer Expression To String", "[BoundTreeString]" ) {
std::stringstream stream; std::stringstream stream;
auto s = new BoundLiteralIntegerExpression(684,0,0); auto s = new BoundLiteralIntegerExpression(684,0,0);
s->GetTreeString(stream, 1); s->GetTreeString(stream, 1);
REQUIRE(stream.str() == "\tLiteralInteger: 684 (number)"); REQUIRE(stream.str() == "\tLiteralInteger: 684 (numeric (Known integer))");
delete s; delete s;
} }
@ -181,7 +181,7 @@ TEST_CASE( "Literal Float Expression To String", "[BoundTreeString]" ) {
std::stringstream stream; std::stringstream stream;
auto s = new BoundLiteralFloatExpression(5.5,0,0); auto s = new BoundLiteralFloatExpression(5.5,0,0);
s->GetTreeString(stream, 1); s->GetTreeString(stream, 1);
REQUIRE(stream.str() == "\tLiteralFloat: 5.5 (number)"); REQUIRE(stream.str() == "\tLiteralFloat: 5.5 (numeric (Known float))");
delete s; delete s;
} }
@ -228,7 +228,7 @@ TEST_CASE( "Binary Expression To String", "[BoundTreeString]" ) {
NumericScriptType::AwareInt, 0,0 NumericScriptType::AwareInt, 0,0
); );
s->GetTreeString(stream, 1); s->GetTreeString(stream, 1);
REQUIRE(stream.str() == "\tBinaryExpression: addition (number)\n\t\tLiteralInteger: 5 (number)\n\t\tLiteralInteger: 200 (number)"); REQUIRE(stream.str() == "\tBinaryExpression: addition (numeric (Known integer))\n\t\tLiteralInteger: 5 (numeric (Known integer))\n\t\tLiteralInteger: 200 (numeric (Known integer))");
delete s; delete s;
} }
@ -240,7 +240,7 @@ TEST_CASE( "Unary Expression To String", "[BoundTreeString]" ) {
NumericScriptType::AwareInt, 0,0 NumericScriptType::AwareInt, 0,0
); );
s->GetTreeString(stream, 1); s->GetTreeString(stream, 1);
REQUIRE(stream.str() == "\tUnaryExpression: negation (number)\n\t\tLiteralInteger: 5 (number)"); REQUIRE(stream.str() == "\tUnaryExpression: negation (numeric (Known integer))\n\t\tLiteralInteger: 5 (numeric (Known integer))");
delete s; delete s;
} }

View File

@ -10,9 +10,9 @@ TEST_CASE( "Basic script to bound tree string", "[integration]" ) {
auto boundTreeString = script->GetTreeString(); auto boundTreeString = script->GetTreeString();
REQUIRE(boundTreeString == "BlockStatement\n" REQUIRE(boundTreeString == "BlockStatement\n"
"\tReturnStatement\n" "\tReturnStatement\n"
"\t\tBinaryExpression: addition (number)\n" "\t\tBinaryExpression: addition (numeric (Known integer))\n"
"\t\t\tLiteralInteger: 10 (number)\n" "\t\t\tLiteralInteger: 10 (numeric (Known integer))\n"
"\t\t\tLiteralInteger: 500 (number)"); "\t\t\tLiteralInteger: 500 (numeric (Known integer))");
delete script; delete script;
} }