From 5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Wed, 21 Jan 2026 22:40:55 +0100 Subject: Add Redis source code for testing --- .../test/integration/cpp/infallible_new_false.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp (limited to 'examples/redis-unstable/deps/jemalloc/test/integration/cpp/infallible_new_false.cpp') 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 @@ +#include + +#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); +} + -- cgit v1.2.3