123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #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;testData/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();
- testFile();
- testFrustum();
- testHashMap(light);
- testList(light);
- testMatrix();
- testPlane();
- testQuaternion();
- testQueue();
- testRandom(light);
- if(light) {
- testReadLine();
- }
- 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);
- }
|