Implements initial math library, several reworks for Userdata memory management
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
26
tests/standardLibraries/MatLibrary.cpp
Normal file
26
tests/standardLibraries/MatLibrary.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user