Main.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #include "test/Test.h"
  2. #include "tests/ArrayListTests.h"
  3. #include "tests/ArrayStringTests.h"
  4. #include "tests/ArrayTests.h"
  5. #include "tests/BitArrayTests.h"
  6. #include "tests/BoxTests.h"
  7. #include "tests/BufferTests.h"
  8. #include "tests/BufferedValueTests.h"
  9. #include "tests/ClockTests.h"
  10. #include "tests/ColorTests.h"
  11. #include "tests/ComponentsTests.h"
  12. #include "tests/FrustumTests.h"
  13. #include "tests/HashMapTests.h"
  14. #include "tests/LinkedListTests.h"
  15. #include "tests/ListTests.h"
  16. #include "tests/MathTests.h"
  17. #include "tests/MatrixStackTests.h"
  18. #include "tests/MatrixTests.h"
  19. #include "tests/PlaneTests.h"
  20. #include "tests/QuaternionTests.h"
  21. #include "tests/RandomTests.h"
  22. #include "tests/RingBufferTests.h"
  23. #include "tests/StackTests.h"
  24. #include "tests/UniquePointerTests.h"
  25. #include "tests/UtilityTests.h"
  26. #include "tests/VectorTests.h"
  27. #include "tests/ViewTests.h"
  28. #include "utils/ArrayString.h"
  29. #include "utils/Utility.h"
  30. static void onExit(int code, void* data) {
  31. unsigned int i = *static_cast<unsigned int*>(data);
  32. Core::ArrayString<1024> s;
  33. CORE_TEST_FALSE(s.append("Hello from exit #: #"));
  34. CORE_TEST_FALSE(s.format(code, i));
  35. CORE_TEST_FALSE(s.printLine());
  36. Core::Test::finalize();
  37. }
  38. static void onError(const char* file, int line, Core::Error e, void*) {
  39. if(e == Core::Error::CAPACITY_REACHED ||
  40. e == Core::Error::INVALID_REMOVE_INDEX) {
  41. return;
  42. }
  43. CORE_LOG_ERROR("Error in #:# - #", file, line, static_cast<int>(e));
  44. }
  45. int main() {
  46. Core::setErrorHandler(onError, nullptr);
  47. Core::ArrayListTests::test();
  48. Core::ArrayStringTests::test();
  49. Core::ArrayTests::test();
  50. Core::BitArrayTests::test();
  51. Core::BoxTests::test();
  52. Core::BufferTests::test();
  53. Core::BufferedValueTests::test();
  54. Core::ClockTests::test();
  55. Core::ColorTests::test();
  56. Core::ComponentsTests::test();
  57. Core::FrustumTests::test();
  58. Core::HashMapTests::test();
  59. Core::LinkedListTests::test();
  60. Core::ListTests::test();
  61. Core::MathTests::test();
  62. Core::MatrixStackTests::test();
  63. Core::MatrixTests::test();
  64. Core::PlaneTests::test();
  65. Core::QuaternionTests::test();
  66. Core::RandomTests::test();
  67. Core::RingBufferTests::test();
  68. Core::StackTests::test();
  69. Core::UniquePointerTests::test();
  70. Core::UtilityTests::test();
  71. Core::VectorTests::test();
  72. Core::ViewTests::test();
  73. unsigned int data = 123456789;
  74. Core::setExitHandler(onExit, &data);
  75. CORE_EXIT(1);
  76. return 0;
  77. }