diff --git a/unittests.cpp b/unittests.cpp new file mode 100644 index 0000000..e50a278 --- /dev/null +++ b/unittests.cpp @@ -0,0 +1,64 @@ +/* unittests.cpp +Catch various bugs reported over the years +(C) 2012 Niall Douglas +*/ + +#define NEDMALLOCDEPRECATED +#define NEDMALLOC_DEBUG 1 +#define FULLSANITYCHECKS + +#include "nedmalloc.h" +#include +#include + +#if !defined(USE_NEDMALLOC_DLL) +#include "nedmalloc.c" +#endif + +int main(void) +{ + using namespace std; + using namespace nedalloc; + // Crash when nedcreatepool is called in the fifth time + // https://github.com/ned14/nedmalloc/issues/7 + printf("Testing: Crash when nedcreatepool is called in the fifth time ...\n"); + { + vector pools; + size_t count=0; + for(size_t n=1; n<256; n<<=1) + { + size_t oldsize=pools.size(); + pools.resize(n); + for(size_t m=0; m + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +