tmp
This commit is contained in:
parent
da74d27135
commit
5d94ddd774
8 changed files with 52 additions and 32 deletions
6
Objects/tests/ObjectTests.hpp
Normal file
6
Objects/tests/ObjectTests.hpp
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
#include "Testing.hpp"
|
||||||
|
|
||||||
|
#include "primitives/primitives.h"
|
||||||
|
|
||||||
|
extern tp::ModuleManifest objTestModule;
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "ObjectTests.hpp"
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
@ -49,6 +49,9 @@ TEST_DEF_STATIC(ErrorHandling) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(Compiler) {
|
TEST_DEF(Compiler) {
|
||||||
|
if (objTestModule.initialize()) {
|
||||||
testBasic();
|
testBasic();
|
||||||
testErrorHandling();
|
testErrorHandling();
|
||||||
|
objTestModule.deinitialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "ObjectTests.hpp"
|
||||||
|
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
||||||
|
|
@ -28,4 +28,9 @@ TEST_DEF_STATIC(BasicAPI) {
|
||||||
NDO->destroy(savedInt);
|
NDO->destroy(savedInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(Core) { testBasicAPI(); }
|
TEST_DEF(Core) {
|
||||||
|
if (objTestModule.initialize()) {
|
||||||
|
testBasicAPI();
|
||||||
|
objTestModule.deinitialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "ObjectTests.hpp"
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
@ -135,8 +135,13 @@ TEST_DEF_STATIC(Complex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(Interpreter) {
|
TEST_DEF(Interpreter) {
|
||||||
|
if (objTestModule.initialize()) {
|
||||||
|
|
||||||
testEntry();
|
testEntry();
|
||||||
testSimple();
|
testSimple();
|
||||||
testSimpleSave();
|
testSimpleSave();
|
||||||
// testComplex();
|
// testComplex();
|
||||||
|
|
||||||
|
objTestModule.deinitialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "ObjectTests.hpp"
|
||||||
|
|
||||||
#include "parser/parser.h"
|
#include "parser/parser.h"
|
||||||
|
|
||||||
|
|
@ -53,6 +53,11 @@ TEST_DEF_STATIC(ErrorHandling) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(Parser) {
|
TEST_DEF(Parser) {
|
||||||
|
if (objTestModule.initialize()) {
|
||||||
|
|
||||||
testBasic();
|
testBasic();
|
||||||
testErrorHandling();
|
testErrorHandling();
|
||||||
|
|
||||||
|
objTestModule.deinitialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "ObjectTests.hpp"
|
||||||
|
|
||||||
#include "compiler/function.h"
|
#include "compiler/function.h"
|
||||||
#include "core/object.h"
|
#include "core/object.h"
|
||||||
|
|
@ -30,4 +30,9 @@ TEST_DEF_STATIC(Dict) {
|
||||||
NDO->destroy(dictLoaded);
|
NDO->destroy(dictLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF(Primitives) { testDict(); }
|
TEST_DEF(Primitives) {
|
||||||
|
if (objTestModule.initialize()) {
|
||||||
|
testDict();
|
||||||
|
objTestModule.deinitialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
#include "Testing.hpp"
|
#include "ObjectTests.hpp"
|
||||||
|
|
||||||
#include "primitives/primitives.h"
|
|
||||||
|
|
||||||
using namespace tp;
|
using namespace tp;
|
||||||
using namespace obj;
|
using namespace obj;
|
||||||
|
|
@ -11,20 +9,15 @@ void testCore();
|
||||||
void testPrimitives();
|
void testPrimitives();
|
||||||
void testInterpreter();
|
void testInterpreter();
|
||||||
|
|
||||||
|
tp::ModuleManifest* objDeps[] = { &gModuleObjects, nullptr };
|
||||||
|
tp::ModuleManifest objTestModule("ObjectsTests", nullptr, nullptr, objDeps);
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
tp::ModuleManifest* deps[] = { &gModuleObjects, nullptr };
|
|
||||||
tp::ModuleManifest module("ObjectsTests", nullptr, nullptr, deps);
|
|
||||||
|
|
||||||
if (module.initialize()) {
|
|
||||||
|
|
||||||
testParser();
|
testParser();
|
||||||
testCore();
|
testCore();
|
||||||
testPrimitives();
|
testPrimitives();
|
||||||
testInterpreter();
|
testInterpreter();
|
||||||
|
|
||||||
module.deinitialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ using namespace tp;
|
||||||
Testing tp::gTesting;
|
Testing tp::gTesting;
|
||||||
|
|
||||||
void Testing::startTest(const char* name) {
|
void Testing::startTest(const char* name) {
|
||||||
MODULE_SANITY_CHECK(gModuleUtils)
|
|
||||||
auto newNode = new (malloc(sizeof(TestingNode))) TestingNode{ {}, {}, name, mCurrent };
|
auto newNode = new (malloc(sizeof(TestingNode))) TestingNode{ {}, {}, name, mCurrent };
|
||||||
mCurrent->mSubTests.pushBack(newNode);
|
mCurrent->mSubTests.pushBack(newNode);
|
||||||
mCurrent = mCurrent->mSubTests.last()->data;
|
mCurrent = mCurrent->mSubTests.last()->data;
|
||||||
|
|
@ -23,7 +22,6 @@ void Testing::endTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Testing::addFailedCheck(const FailedCheck& info) {
|
void Testing::addFailedCheck(const FailedCheck& info) {
|
||||||
DEBUG_BREAK(0 && info.expression);
|
|
||||||
auto lastRecord = &mCurrent->mFailedChecks.last()->data;
|
auto lastRecord = &mCurrent->mFailedChecks.last()->data;
|
||||||
if (lastRecord && lastRecord->failedCheck.file == info.file && lastRecord->failedCheck.line == info.line) {
|
if (lastRecord && lastRecord->failedCheck.file == info.file && lastRecord->failedCheck.line == info.line) {
|
||||||
lastRecord->times++;
|
lastRecord->times++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue