aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp')
-rw-r--r--examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp b/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
new file mode 100644
index 0000000..42196d6
--- /dev/null
+++ b/examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp
@@ -0,0 +1,23 @@
1#include <memory>
2
3#include "test/jemalloc_test.h"
4
5TEST_BEGIN(test_failing_alloc) {
6 bool saw_exception = false;
7 try {
8 /* Too big of an allocation to succeed. */
9 void *volatile ptr = ::operator new((size_t)-1);
10 (void)ptr;
11 } catch (...) {
12 saw_exception = true;
13 }
14 expect_true(saw_exception, "Didn't get a failure");
15}
16TEST_END
17
18int
19main(void) {
20 return test(
21 test_failing_alloc);
22}
23