Test for debug_check_emtpy.
This commit is contained in:
41
src/test/func/statistics/stats.cc
Normal file
41
src/test/func/statistics/stats.cc
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user