97 lines
3.1 KiB
C++
97 lines
3.1 KiB
C++
#ifdef TESTS_BUILD
|
|
#include <catch.hpp>
|
|
#include "../src/Script.hpp"
|
|
|
|
TEST_CASE( "Basic True", "[integration]" ) {
|
|
Script script = Script::Create("true");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
}
|
|
|
|
TEST_CASE( "Basic False", "[integration]" ) {
|
|
Script script = Script::Create("false");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
}
|
|
|
|
TEST_CASE( "True and True", "[integration]" ) {
|
|
Script script = Script::Create("true and true");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
}
|
|
TEST_CASE( "True and False", "[integration]" ) {
|
|
Script script = Script::Create("true and false");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
}
|
|
TEST_CASE( "False and True", "[integration]" ) {
|
|
Script script = Script::Create("false and true");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
}
|
|
TEST_CASE( "False and False", "[integration]" ) {
|
|
Script script = Script::Create("false and false");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
}
|
|
|
|
TEST_CASE( "True or True", "[integration]" ) {
|
|
Script script = Script::Create("true or true");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
}
|
|
TEST_CASE( "True or False", "[integration]" ) {
|
|
Script script = Script::Create("true or false");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
}
|
|
TEST_CASE( "False or True", "[integration]" ) {
|
|
Script script = Script::Create("false or true");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
}
|
|
TEST_CASE( "False or False", "[integration]" ) {
|
|
Script script = Script::Create("false or false");
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
script.Evaluate();
|
|
auto lastValue = script.GetLastValue();
|
|
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
|
|
|