PorygonLang/tests/standardLibraries/MatLibrary.cpp

27 lines
729 B
C++

#ifdef TESTS_BUILD
#include <catch.hpp>
#include "../src/Script.hpp"
#include "../../src/ScriptOptions.hpp"
#include <cstring>
using namespace Porygon;
TEST_CASE( "Abs positive returns positive", "[integration]" ) {
Script* script = Script::Create(u"return math.abs(684)");
REQUIRE(!script->Diagnostics -> HasErrors());
auto result = script -> Evaluate();
CHECK(result->EvaluateInteger() == 684);
delete script;
}
TEST_CASE( "Abs negative returns positive", "[integration]" ) {
Script* script = Script::Create(u"return math.abs(-684)");
REQUIRE(!script->Diagnostics -> HasErrors());
auto result = script -> Evaluate();
CHECK(result->EvaluateInteger() == 684);
delete script;
}
#endif