PorygonLang/tests/integration/LogicalOperationsTests.cpp

109 lines
3.3 KiB
C++
Raw Normal View History

#ifdef TESTS_BUILD
#include <catch.hpp>
#include "../src/Script.hpp"
using namespace Porygon;
TEST_CASE( "Basic True", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("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( "Basic False", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("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( "True and True", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("true and 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 and False", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("true and 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( "False and True", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("false and 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( "False and False", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("false and 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( "True or True", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("true or 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 or False", "[integration]" ) {
2019-05-28 15:49:03 +00:00
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]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("false or 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( "False or False", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("false or 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:59:12 +00:00
TEST_CASE( "Not True", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("not true");
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto lastValue = script->GetLastValue();
2019-05-25 12:59:12 +00:00
REQUIRE(!lastValue->EvaluateBool());
2019-05-29 12:58:00 +00:00
delete script;
2019-05-25 12:59:12 +00:00
}
TEST_CASE( "Not False", "[integration]" ) {
2019-05-28 15:49:03 +00:00
auto script = Script::Create("not false");
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto lastValue = script->GetLastValue();
2019-05-25 12:59:12 +00:00
REQUIRE(lastValue->EvaluateBool());
2019-05-29 12:58:00 +00:00
delete script;
2019-05-25 12:59:12 +00:00
}
#endif