Main.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. coreTestInvalidAllocate();
  22. } else if(strcmp(args[i], "realloc") == 0) {
  23. coreTestInvalidReallocate();
  24. } else if(strcmp(args[i], "pre_canary") == 0) {
  25. coreTestPreCanary();
  26. } else if(strcmp(args[i], "post_canary") == 0) {
  27. coreTestPostCanary();
  28. } else if(strcmp(args[i], "test") == 0) {
  29. coreTestTest();
  30. return 0;
  31. }
  32. }
  33. coreTestBitArray();
  34. coreTestBox();
  35. coreTestBuffer(light);
  36. coreTestComponents();
  37. coreTestFrustum();
  38. coreTestHashMap(light);
  39. coreTestLinkedList(light);
  40. coreTestList(light);
  41. coreTestMatrix();
  42. coreTestPlane();
  43. coreTestQuaternion();
  44. coreTestRandom(light);
  45. coreTestReadLine();
  46. coreTestRingBuffer();
  47. coreTestSpinLock();
  48. coreTestUtility(light);
  49. coreTestVector();
  50. coreTestView();
  51. coreLogLevel = CORE_LOG_WARNING;
  52. CORE_LOG_DEBUG("You won't see this!");
  53. coreLogLevel = CORE_LOG_DEBUG;
  54. unsigned int data = 123456789;
  55. coreSetExitHandler(onExit, &data);
  56. CORE_EXIT(1);
  57. }