Main.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #include <locale.h>
  2. #include <string.h>
  3. #include "../src/ErrorSimulator.hpp"
  4. #include "Test.hpp"
  5. #include "Tests.hpp"
  6. #include "core/utils/ArrayString.hpp"
  7. #include "core/utils/Utility.hpp"
  8. static void onExit(int code, void* data) {
  9. unsigned int i = *static_cast<unsigned int*>(data);
  10. Core::String32<1024> s;
  11. CORE_TEST_ERROR(s.append("Hello from exit #: #"));
  12. CORE_TEST_ERROR(s.format(code, i));
  13. CORE_TEST_ERROR(s.printLine());
  14. Core::String8<64> s8;
  15. CORE_TEST_ERROR(s8.append("Hello from exit"));
  16. CORE_TEST_ERROR(s8.printLine());
  17. Core::Test::finalize();
  18. }
  19. int main(int argAmount, const char** args) {
  20. setlocale(LC_ALL, "en_US.utf8");
  21. bool light = false;
  22. bool outOfMemoryTest = true;
  23. for(int i = 0; i < argAmount; i++) {
  24. if(strcmp(args[i], "light") == 0) {
  25. light = true;
  26. } else if(strcmp(args[i], "valgrind") == 0) {
  27. outOfMemoryTest = false;
  28. }
  29. }
  30. Core::testArrayList(light);
  31. Core::testArrayString();
  32. Core::testArray();
  33. Core::testBitArray(outOfMemoryTest);
  34. Core::testBox();
  35. Core::testBuffer(light);
  36. Core::testBufferedValue();
  37. Core::testClock(light);
  38. Core::testColor();
  39. Core::testComponents(outOfMemoryTest);
  40. Core::testError();
  41. Core::testFileReader();
  42. Core::testFrustum();
  43. Core::testHashedString();
  44. Core::testHashMap(light, outOfMemoryTest);
  45. Core::testLinkedList(light, outOfMemoryTest);
  46. Core::testList(light);
  47. Core::testMath();
  48. Core::testMatrixStack(light);
  49. Core::testMatrix();
  50. Core::testNew();
  51. Core::testPlane();
  52. Core::testProbingHashMap(light, outOfMemoryTest);
  53. Core::testQuaternion();
  54. Core::testRandom(light);
  55. Core::testRingBuffer();
  56. Core::testStack(light);
  57. Core::testThread();
  58. Core::testUniquePointer();
  59. Core::testUtility();
  60. Core::testVector();
  61. Core::testView();
  62. Core::Logger::level = Core::Logger::Level::WARNING;
  63. CORE_LOG_DEBUG("You won't see this!");
  64. Core::Logger::level = Core::Logger::Level::DEBUG;
  65. unsigned int data = 123456789;
  66. Core::setExitHandler(onExit, &data);
  67. char buffer[] = {-100, 0};
  68. CORE_LOG_ERROR(buffer);
  69. return 0;
  70. }