Main.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #define IMPORT_CORE
  2. #include <locale.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include "Tests.h"
  6. #include "core/Logger.h"
  7. #include "core/Test.h"
  8. #include "core/Utility.h"
  9. static void onExit(int code, void* data) {
  10. unsigned int i = *(unsigned int*)(data);
  11. LOG_WARNING("Hello from exit %d: %u", code, i);
  12. finalizeTests();
  13. printMemoryReport();
  14. }
  15. int main(int argAmount, const char** args) {
  16. setlocale(LC_ALL, "en_US.utf8");
  17. bool light = false;
  18. for(int i = 0; i < argAmount; i++) {
  19. if(strcmp(args[i], "light") == 0) {
  20. light = true;
  21. } else if(strcmp(args[i], "alloc") == 0) {
  22. testInvalidAllocate();
  23. } else if(strcmp(args[i], "realloc") == 0) {
  24. testInvalidReallocate();
  25. } else if(strcmp(args[i], "pre_canary") == 0) {
  26. testPreCanary();
  27. } else if(strcmp(args[i], "post_canary") == 0) {
  28. testPostCanary();
  29. } else if(strcmp(args[i], "test") == 0) {
  30. testTest();
  31. return 0;
  32. }
  33. }
  34. testBitArray();
  35. testBox();
  36. testBuffer(light);
  37. testComponents();
  38. testFrustum();
  39. testHashMap(light);
  40. testList(light);
  41. testMatrix();
  42. testPlane();
  43. testQuaternion();
  44. testQueue();
  45. testRandom(light);
  46. logLevel = LOG_NONE;
  47. testReadLine();
  48. logLevel = LOG_DEBUG;
  49. testSpinLock();
  50. testUtility(light);
  51. testVector();
  52. testView();
  53. logLevel = LOG_WARNING;
  54. LOG_DEBUG("You won't see this!");
  55. logLevel = LOG_DEBUG;
  56. unsigned int data = 123456789;
  57. setExitHandler(onExit, &data);
  58. EXIT(1);
  59. }