diff options
author | Qi Wang <interwq@gwu.edu> | 2022-05-06 11:28:25 -0700 |
---|---|---|
committer | Qi Wang <interwq@gwu.edu> | 2022-05-06 11:28:25 -0700 |
commit | 54eaed1d8b56b1aa528be3bdd1877e59c56fa90c (patch) | |
tree | e79620e0c00b1f8b6b698fbe74df6bae7d812ae2 /test/integration/cpp/infallible_new_false.cpp | |
parent | ea6b3e973b477b8061e0076bb257dbd7f3faa756 (diff) | |
parent | 304c919829f9f340669b61fa64867cfe5dba8021 (diff) | |
download | jemalloc-master.tar.gz |
Diffstat (limited to 'test/integration/cpp/infallible_new_false.cpp')
-rw-r--r-- | test/integration/cpp/infallible_new_false.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/integration/cpp/infallible_new_false.cpp b/test/integration/cpp/infallible_new_false.cpp new file mode 100644 index 00000000..42196d6a --- /dev/null +++ b/test/integration/cpp/infallible_new_false.cpp @@ -0,0 +1,23 @@ +#include <memory> + +#include "test/jemalloc_test.h" + +TEST_BEGIN(test_failing_alloc) { + bool saw_exception = false; + try { + /* Too big of an allocation to succeed. */ + void *volatile ptr = ::operator new((size_t)-1); + (void)ptr; + } catch (...) { + saw_exception = true; + } + expect_true(saw_exception, "Didn't get a failure"); +} +TEST_END + +int +main(void) { + return test( + test_failing_alloc); +} + |