NewTests.cpp 443 B

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