NewTests.cpp 501 B

123456789101112131415161718192021222324252627
  1. #include "../Tests.hpp"
  2. #include "core/utils/New.hpp"
  3. struct NewTestClass {
  4. int i;
  5. };
  6. static void testNewArray() {
  7. NewTestClass* n = new(noThrow) NewTestClass[5];
  8. delete[] n;
  9. }
  10. static void testNewFlat() {
  11. NewTestClass* n = new(noThrow) NewTestClass();
  12. delete n;
  13. }
  14. static void testNewArrayWithSize() {
  15. NewTestClass* n = new(noThrow) NewTestClass[5];
  16. operator delete[](n, 5);
  17. }
  18. void Core::testNew() {
  19. testNewArray();
  20. testNewFlat();
  21. testNewArrayWithSize();
  22. }