#ifdef TESTS_BUILD
#include <catch.hpp>
#include "../src/Script.hpp"

using namespace Porygon;
TEST_CASE( "True Equals True", "[integration]" ) {
    auto script = Script::Create("true == true");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}
TEST_CASE( "True Not Equals True", "[integration]" ) {
    auto script = Script::Create("true == false");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(!result->EvaluateBool());
    delete script;
}
TEST_CASE( "True Nequals False", "[integration]" ) {
    auto script = Script::Create("true ~= false");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}
TEST_CASE( "True Not Nequals True", "[integration]" ) {
    auto script = Script::Create("true ~= true");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(!result->EvaluateBool());
    delete script;
}


TEST_CASE( "False Equals False", "[integration]" ) {
    auto script = Script::Create("false == false");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "10 Equals 10", "[integration]" ) {
    auto script = Script::Create("10 == 10");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}
TEST_CASE( "10 Not Equals 5", "[integration]" ) {
    auto script = Script::Create("10 == 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(!result->EvaluateBool());
    delete script;
}

TEST_CASE( "10 < 5 == false", "[integration]" ) {
    auto script = Script::Create("10 < 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE_FALSE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "2 < 60 == true", "[integration]" ) {
    auto script = Script::Create("2 < 60");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "5 < 5 == false", "[integration]" ) {
    auto script = Script::Create("5 < 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE_FALSE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "10 <= 5 == false", "[integration]" ) {
    auto script = Script::Create("10 <= 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE_FALSE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "2 <= 60 == true", "[integration]" ) {
    auto script = Script::Create("2 <= 60");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "5 <= 5 == true", "[integration]" ) {
    auto script = Script::Create("5 <= 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "10 > 5 == true", "[integration]" ) {
    auto script = Script::Create("10 > 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "2 > 60 == false", "[integration]" ) {
    auto script = Script::Create("2 > 60");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE_FALSE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "5 > 5 == false", "[integration]" ) {
    auto script = Script::Create("5 > 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE_FALSE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "10 >= 5 == true", "[integration]" ) {
    auto script = Script::Create("10 >= 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "2 >= 60 == false", "[integration]" ) {
    auto script = Script::Create("2 >= 60");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE_FALSE(result->EvaluateBool());
    delete script;
}

TEST_CASE( "5 >= 5 == true", "[integration]" ) {
    auto script = Script::Create("5 >= 5");
    REQUIRE(!script->Diagnostics -> HasErrors());
    auto result = script->Evaluate();
    REQUIRE(result->EvaluateBool());
    delete script;
}


#endif