Implements unary operation evaluation
This commit is contained in:
@@ -76,6 +76,21 @@ TEST_CASE( "False or False", "[integration]" ) {
|
||||
REQUIRE(!lastValue->EvaluateBool());
|
||||
}
|
||||
|
||||
TEST_CASE( "Not True", "[integration]" ) {
|
||||
Script script = Script::Create("not true");
|
||||
REQUIRE(!script.Diagnostics -> HasErrors());
|
||||
script.Evaluate();
|
||||
auto lastValue = script.GetLastValue();
|
||||
REQUIRE(!lastValue->EvaluateBool());
|
||||
}
|
||||
|
||||
TEST_CASE( "Not False", "[integration]" ) {
|
||||
Script script = Script::Create("not false");
|
||||
REQUIRE(!script.Diagnostics -> HasErrors());
|
||||
script.Evaluate();
|
||||
auto lastValue = script.GetLastValue();
|
||||
REQUIRE(lastValue->EvaluateBool());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,6 +2,21 @@
|
||||
#include <catch.hpp>
|
||||
#include "../src/Script.hpp"
|
||||
|
||||
TEST_CASE( "Integer Negation", "[integration]" ) {
|
||||
Script script = Script::Create("-60");
|
||||
REQUIRE(!script.Diagnostics -> HasErrors());
|
||||
script.Evaluate();
|
||||
auto lastValue = script.GetLastValue();
|
||||
REQUIRE(lastValue->EvaluateInteger() == -60);
|
||||
}
|
||||
TEST_CASE( "Float Negation", "[integration]" ) {
|
||||
Script script = Script::Create("-5.65");
|
||||
REQUIRE(!script.Diagnostics -> HasErrors());
|
||||
script.Evaluate();
|
||||
auto lastValue = script.GetLastValue();
|
||||
REQUIRE(lastValue->EvaluateFloat() == Approx(-5.65));
|
||||
}
|
||||
|
||||
TEST_CASE( "Integer Addition", "[integration]" ) {
|
||||
Script script = Script::Create("1 + 5");
|
||||
REQUIRE(!script.Diagnostics -> HasErrors());
|
||||
|
||||
Reference in New Issue
Block a user