1 1.1 christos #include <memory> 2 1.1 christos 3 1.1 christos #include "test/jemalloc_test.h" 4 1.1 christos 5 1.1 christos TEST_BEGIN(test_failing_alloc) { 6 1.1 christos bool saw_exception = false; 7 1.1 christos try { 8 1.1 christos /* Too big of an allocation to succeed. */ 9 1.1 christos void *volatile ptr = ::operator new((size_t)-1); 10 1.1 christos (void)ptr; 11 1.1 christos } catch (...) { 12 1.1 christos saw_exception = true; 13 1.1 christos } 14 1.1 christos expect_true(saw_exception, "Didn't get a failure"); 15 1.1 christos } 16 1.1 christos TEST_END 17 1.1 christos 18 1.1 christos int 19 1.1 christos main(void) { 20 1.1 christos return test( 21 1.1 christos test_failing_alloc); 22 1.1 christos } 23 1.1 christos 24