2019-05-25 11:57:43 +00:00
|
|
|
|
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
#include <catch.hpp>
|
|
|
|
#include "../src/Script.hpp"
|
|
|
|
|
|
|
|
TEST_CASE( "True Equals True", "[integration]" ) {
|
|
|
|
Script script = Script::Create("true == true");
|
|
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
|
|
script.Evaluate();
|
|
|
|
auto lastValue = script.GetLastValue();
|
|
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
|
|
}
|
|
|
|
TEST_CASE( "True Not Equals True", "[integration]" ) {
|
|
|
|
Script script = Script::Create("true == false");
|
|
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
|
|
script.Evaluate();
|
|
|
|
auto lastValue = script.GetLastValue();
|
|
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
|
|
}
|
2019-05-25 12:17:52 +00:00
|
|
|
TEST_CASE( "True Nequals False", "[integration]" ) {
|
|
|
|
Script script = Script::Create("true ~= false");
|
|
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
|
|
script.Evaluate();
|
|
|
|
auto lastValue = script.GetLastValue();
|
|
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
|
|
}
|
|
|
|
TEST_CASE( "True Not Nequals True", "[integration]" ) {
|
|
|
|
Script script = Script::Create("true ~= true");
|
|
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
|
|
script.Evaluate();
|
|
|
|
auto lastValue = script.GetLastValue();
|
|
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
|
|
}
|
|
|
|
|
2019-05-25 11:57:43 +00:00
|
|
|
|
|
|
|
TEST_CASE( "False Equals False", "[integration]" ) {
|
|
|
|
Script script = Script::Create("false == false");
|
|
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
|
|
script.Evaluate();
|
|
|
|
auto lastValue = script.GetLastValue();
|
|
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE( "10 Equals 10", "[integration]" ) {
|
|
|
|
Script script = Script::Create("10 == 10");
|
|
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
|
|
script.Evaluate();
|
|
|
|
auto lastValue = script.GetLastValue();
|
|
|
|
REQUIRE(lastValue->EvaluateBool());
|
|
|
|
}
|
|
|
|
TEST_CASE( "10 Not Equals 5", "[integration]" ) {
|
|
|
|
Script script = Script::Create("10 == 5");
|
|
|
|
REQUIRE(!script.Diagnostics -> HasErrors());
|
|
|
|
script.Evaluate();
|
|
|
|
auto lastValue = script.GetLastValue();
|
|
|
|
REQUIRE(!lastValue->EvaluateBool());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|