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]" ) {
|
|
auto script = Script::Create("true");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
}
|
|
|
|
TEST_CASE( "Basic False", "[integration]" ) {
|
|
auto script = Script::Create("false");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
}
|
|
|
|
TEST_CASE( "True and True", "[integration]" ) {
|
|
auto 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]" ) {
|
|
auto 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]" ) {
|
|
auto 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]" ) {
|
|
auto 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]" ) {
|
|
auto 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]" ) {
|
|
auto 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]" ) {
|
|
auto 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]" ) {
|
|
auto script = Script::Create("false or false");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
}
|
|
|
|
TEST_CASE( "Not True", "[integration]" ) {
|
|
auto script = Script::Create("not true");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
}
|
|
|
|
TEST_CASE( "Not False", "[integration]" ) {
|
|
auto script = Script::Create("not false");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
}
|
|
|
|
#endif
|
|
|