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