Main.c 1.6 KB

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