48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
|
|
||
|
#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());
|
||
|
}
|
||
|
|
||
|
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
|
||
|
|