summaryrefslogtreecommitdiff
path: root/test/dict.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dict.c')
-rw-r--r--test/dict.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/test/dict.c b/test/dict.c
deleted file mode 100644
index cb25a8e..0000000
--- a/test/dict.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <parserutils/utils/dict.h>
-
-#include "testutils.h"
-
-extern void parserutils_dict_dump(parserutils_dict *dict);
-
-static void *myrealloc(void *ptr, size_t len, void *pw)
-{
- UNUSED(pw);
-
- return realloc(ptr, len);
-}
-
-int main(int argc, char **argv)
-{
- parserutils_dict *dict;
- 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_dict_create(myrealloc, NULL, &dict) ==
- PARSERUTILS_OK);
-
- for (int i = 0; i < (int) sizeof(buf); i++) {
- uint8_t *s = buf;
-
- while (s - buf <= i) {
- const parserutils_dict_entry *e;
-
- parserutils_dict_insert(dict,
- s, (size_t) (sizeof(buf) - i), &e);
-
- s++;
- }
- }
-
- parserutils_dict_destroy(dict);
-
- printf("PASS\n");
-
- return 0;
-}
-