Home | History | Annotate | Line # | Download | only in cpp
      1 #include <memory>
      2 
      3 #include "test/jemalloc_test.h"
      4 
      5 TEST_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 }
     16 TEST_END
     17 
     18 int
     19 main(void) {
     20 	return test(
     21 	    test_failing_alloc);
     22 }
     23 
     24