From f545c1c79091aac2fda38df3bb4ebc1aec08ce4a Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Tue, 13 Aug 2019 10:08:11 +0100 Subject: [PATCH] Test for debug_check_emtpy. --- src/test/func/statistics/stats.cc | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/test/func/statistics/stats.cc diff --git a/src/test/func/statistics/stats.cc b/src/test/func/statistics/stats.cc new file mode 100644 index 0000000..76ac2f1 --- /dev/null +++ b/src/test/func/statistics/stats.cc @@ -0,0 +1,41 @@ +#include + + + +int main() +{ + snmalloc::Alloc* a = snmalloc::ThreadAlloc::get(); + bool result; + + auto r = a->alloc(16); + + snmalloc::current_alloc_pool()->debug_check_empty(&result); + if (result != false) + { + abort(); + } + + a->dealloc(r); + + snmalloc::current_alloc_pool()->debug_check_empty(&result); + if (result != true) + { + abort(); + } + + r = a->alloc(16); + + snmalloc::current_alloc_pool()->debug_check_empty(&result); + if (result != false) + { + abort(); + } + + a->dealloc(r); + + snmalloc::current_alloc_pool()->debug_check_empty(&result); + if (result != true) + { + abort(); + } +} \ No newline at end of file