X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fhash-test.c;h=ae1e6f8649c8f9c9b9211474e35f9b60e4f57bfd;hb=c70b0bd774606177c893f6869ece09d0fd1d9034;hp=c03d9fa40736c5dd4eb78c96ed1987232b6feed6;hpb=b23db618057b5aa8905c41df963d6fa865d82c8c;p=libucw.git diff --git a/lib/hash-test.c b/lib/hash-test.c index c03d9fa4..ae1e6f86 100644 --- a/lib/hash-test.c +++ b/lib/hash-test.c @@ -5,7 +5,7 @@ #include #include -#if 1 +#if 0 /* TEST 1: integers */ @@ -69,7 +69,7 @@ static void test(void) log(L_INFO, "OK"); } -#elif 0 +#elif 1 /* TEST 2: external strings */ @@ -82,6 +82,7 @@ struct node { #define HASH_PREFIX(x) test_##x #define HASH_KEY_STRING key #define HASH_NOCASE +#define HASH_AUTO_POOL 4096 #define HASH_WANT_FIND #define HASH_WANT_NEW @@ -97,7 +98,7 @@ static void test(void) { char x[32]; sprintf(x, "abc%d", i); - test_new(stralloc(x)); + test_new(xstrdup(x)); } for (i=0; i<1024; i++) { @@ -111,11 +112,11 @@ static void test(void) log(L_INFO, "OK"); } -#elif 0 +#elif 1 /* TEST 3: internal strings + pools */ -#include "lib/pools.h" +#include "lib/mempool.h" static struct mempool *pool; @@ -141,13 +142,13 @@ static void test(void) pool = mp_new(16384); test_init(); - for (i=0; i<1024; i+=2) + for (i=0; i<1048576; i+=2) { char x[32]; sprintf(x, "abc%d", i); test_new(x); } - for (i=0; i<1024; i++) + for (i=0; i<1048576; i++) { char x[32]; struct node *n;