Test for debug_check_emtpy.

This commit is contained in:
Matthew Parkinson
2019-08-13 10:08:11 +01:00
parent e6b4efd980
commit f545c1c790

View File

@@ -0,0 +1,41 @@
#include <snmalloc.h>
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();
}
}