82 lines
2.6 KiB
C++
82 lines
2.6 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());
|
||
|
}
|
||
|
|
||
|
|
||
|
#endif
|
||
|
|