12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #include <locale.h>
- #include <stdio.h>
- #include <string.h>
- #include <threads.h>
- #include "Tests.h"
- #include "core/Logger.h"
- #include "core/Test.h"
- #include "core/Utility.h"
- static void finalize() {
- finalizeTests();
- printMemoryReport();
- }
- static void onExit(int code, void* data) {
- unsigned int i = *(unsigned int*)(data);
- LOG_WARNING("Hello from exit %d: %u", code, i);
- finalize();
- }
- int main(int argAmount, const char** args) {
- if(argAmount >= 2 && strcmp(args[1], "help") == 0) {
- puts("alloc");
- puts("realloc");
- puts("pre_canary");
- puts("post_canary");
- puts("test;ignore");
- puts("terminal");
- puts("light;readLineTest");
- return 0;
- }
- setlocale(LC_ALL, "en_US.utf8");
- bool light = false;
- for(int i = 0; i < argAmount; i++) {
- if(strcmp(args[i], "light") == 0) {
- light = true;
- } else if(strcmp(args[i], "alloc") == 0) {
- testInvalidAllocate();
- } else if(strcmp(args[i], "realloc") == 0) {
- testInvalidReallocate();
- } else if(strcmp(args[i], "pre_canary") == 0) {
- testPreCanary();
- } else if(strcmp(args[i], "post_canary") == 0) {
- testPostCanary();
- } else if(strcmp(args[i], "test") == 0) {
- testTest();
- return 0;
- } else if(strcmp(args[i], "terminal") == 0) {
- testTerminal(true);
- finalize();
- return 0;
- } else if(strcmp(args[i], "iterminal") == 0) {
- testInteractiveTerminal();
- return 0;
- }
- }
- testBitArray();
- testBox();
- testBuffer(light);
- testComponents();
- testFrustum();
- testHashMap(light);
- testList(light);
- testMatrix();
- testPlane();
- testQuaternion();
- testQueue();
- testRandom(light);
- logLevel = LOG_NONE;
- if(light) {
- testReadLine();
- }
- logLevel = LOG_DEBUG;
- testSpinLock();
- testTerminal(!light);
- testUnicode();
- testUtility(light);
- testVector();
- testView();
- logLevel = LOG_WARNING;
- LOG_DEBUG("You won't see this!");
- logLevel = LOG_DEBUG;
- unsigned int data = 123'456'789;
- setExitHandler(onExit, &data);
- EXIT(1);
- }
|