summaryrefslogtreecommitdiff
path: root/tests/main.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-28 20:11:06 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-28 20:11:06 -0700
commita49f932b6110bc46e02f80ba4a4264991202cbee (patch)
tree267edd41549aab49169ec460ccb868436fff15a8 /tests/main.cpp
parent21695288ecb32358034de0eaf56408cc9b994f86 (diff)
parent6229138d80380d582f16931d36b279807dcb82dd (diff)
Merge branch 'master' into compact
Diffstat (limited to 'tests/main.cpp')
-rw-r--r--tests/main.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 75b0108..c4c9341 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -20,6 +20,7 @@
test_runner* test_runner::_tests = 0;
size_t test_runner::_memory_fail_threshold = 0;
+bool test_runner::_memory_fail_triggered = false;
jmp_buf test_runner::_failure_buffer;
const char* test_runner::_failure_message;
const char* test_runner::_temp_path;
@@ -30,7 +31,11 @@ static size_t g_memory_total_count = 0;
static void* custom_allocate(size_t size)
{
if (test_runner::_memory_fail_threshold > 0 && test_runner::_memory_fail_threshold < g_memory_total_size + size)
+ {
+ test_runner::_memory_fail_triggered = true;
+
return 0;
+ }
else
{
void* ptr = memory_allocate(size);
@@ -84,6 +89,7 @@ static bool run_test(test_runner* test)
g_memory_total_size = 0;
g_memory_total_count = 0;
test_runner::_memory_fail_threshold = 0;
+ test_runner::_memory_fail_triggered = false;
pugi::set_memory_management_functions(custom_allocate, custom_deallocate);