Main.c 1.5 KB

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