PorygonLang/tests/integration/EqualityOperationsTests.cpp

70 lines
2.0 KiB
C++
Raw Normal View History

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