basic.cpp 411 B

12345678910111213141516171819202122232425
  1. #include "test/jemalloc_test.h"
  2. TEST_BEGIN(test_basic) {
  3. auto foo = new long(4);
  4. expect_ptr_not_null(foo, "Unexpected new[] failure");
  5. delete foo;
  6. // Test nullptr handling.
  7. foo = nullptr;
  8. delete foo;
  9. auto bar = new long;
  10. expect_ptr_not_null(bar, "Unexpected new failure");
  11. delete bar;
  12. // Test nullptr handling.
  13. bar = nullptr;
  14. delete bar;
  15. }
  16. TEST_END
  17. int
  18. main() {
  19. return test(
  20. test_basic);
  21. }