2
0

basic.cpp 429 B

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