/* -*- mode: C; c-basic-offset: 4 -*- */ #ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." #include #include #include #include "memory.h" #include "mempool.h" void test_mempool_limits(int size) { void *base = malloc(size); struct mempool mempool; mempool_init(&mempool, base, size); int i; for (i=0;; i++) { void *vp = mempool_malloc(&mempool, 1, 1); if (vp == 0) break; } assert(i == size); mempool_fini(&mempool); free(base); } void test_mempool_malloc_mfree(int size) { void *base = malloc(size); struct mempool mempool; mempool_init(&mempool, base, size); void *vp[size]; int i; for (i=0;; i++) { vp[i] = mempool_malloc(&mempool, 1, 1); if (vp[i] == 0) break; } assert(i == size); for (i=0; i