summaryrefslogtreecommitdiff
path: root/test/hash.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2009-02-14 19:18:33 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2009-02-14 19:18:33 +0000
commitbf44aeaf5cd7f03d3bd842c8046b7346c5035f06 (patch)
tree896fcb86e24952dfea9fa1414fdd3c59e509fa9b /test/hash.c
parent0323c5c6f9f6d27b7aab2ac5da0b98e6468a4d72 (diff)
downloadlibparserutils-bf44aeaf5cd7f03d3bd842c8046b7346c5035f06.tar.gz
libparserutils-bf44aeaf5cd7f03d3bd842c8046b7346c5035f06.tar.bz2
Remove dict, hash and rbtree from libparserutils
svn path=/trunk/libparserutils/; revision=6512
Diffstat (limited to 'test/hash.c')
-rw-r--r--test/hash.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/test/hash.c b/test/hash.c
deleted file mode 100644
index 8504cbd..0000000
--- a/test/hash.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <parserutils/utils/hash.h>
-
-#include "testutils.h"
-
-extern void parserutils_hash_dump(parserutils_hash *hash);
-
-static void *myrealloc(void *ptr, size_t len, void *pw)
-{
- UNUSED(pw);
-
- return realloc(ptr, len);
-}
-
-int main(int argc, char **argv)
-{
- parserutils_hash *hash;
- uint8_t buf[256];
-
- UNUSED(argc);
- UNUSED(argv);
-
- /* Seed buffer with printable ascii */
- for (int i = 0; i < (int) sizeof(buf); i++) {
- buf[i] = 97 + (int) (26.0 * (rand() / (RAND_MAX + 1.0)));
- }
- buf[sizeof(buf) - 1] = '\0';
-
- assert(parserutils_hash_create(myrealloc, NULL, &hash) ==
- PARSERUTILS_OK);
-
- for (int i = 0; i < (int) sizeof(buf); i++) {
- uint8_t *s = buf;
-
- while (s - buf <= i) {
- const parserutils_hash_entry *e;
-
- parserutils_hash_insert(hash,
- s, (size_t) (sizeof(buf) - i), &e);
-
- s++;
- }
- }
-
- parserutils_hash_dump(hash);
-
- parserutils_hash_destroy(hash);
-
- printf("PASS\n");
-
- return 0;
-}
-