summaryrefslogtreecommitdiff
path: root/test
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
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')
-rw-r--r--test/INDEX3
-rw-r--r--test/Makefile2
-rw-r--r--test/dict.c54
-rw-r--r--test/hash.c56
-rw-r--r--test/rbtree.c88
5 files changed, 1 insertions, 202 deletions
diff --git a/test/INDEX b/test/INDEX
index f055717..d89e3fa 100644
--- a/test/INDEX
+++ b/test/INDEX
@@ -9,9 +9,6 @@ cscodec-utf8 UTF-8 charset codec implementation cscodec-utf8
cscodec-utf16 UTF-16 charset codec implementation cscodec-utf16
cscodec-ext8 Extended 8bit charset codec cscodec-ext8
cscodec-8859 ISO-8859-n codec cscodec-8859
-dict Dictionary handling
-hash Hashtable implementation
-rbtree Red-black tree implementation
filter Input stream filtering
inputstream Inputstream handling input
diff --git a/test/Makefile b/test/Makefile
index aeffc1e..e864cb3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -36,7 +36,7 @@ CFLAGS := $(CFLAGS) -I$(TOP)/src/ -I$(d)
# Tests
TESTS_$(d) := aliases cscodec-8859 cscodec-ext8 cscodec-utf8 cscodec-utf16 \
- charset dict filter hash inputstream parserutils rbtree
+ charset filter inputstream parserutils
TESTS_$(d) := $(TESTS_$(d)) regression/cscodec-segv regression/filter-segv \
regression/stream-nomem regression/filter-badenc-segv
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;
-}
-
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;
-}
-
diff --git a/test/rbtree.c b/test/rbtree.c
deleted file mode 100644
index ac27964..0000000
--- a/test/rbtree.c
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "utils/rbtree.h"
-
-#include "testutils.h"
-
-static void *myrealloc(void *ptr, size_t len, void *pw)
-{
- UNUSED(pw);
-
- return realloc(ptr, len);
-}
-
-static int mycmp(const void *a, const void *b)
-{
- return ((intptr_t) a) - ((intptr_t) b);
-}
-
-int main(int argc, char **argv)
-{
- parserutils_rbtree *tree;
-
- UNUSED(argc);
- UNUSED(argv);
-
- assert(parserutils_rbtree_create(mycmp, myrealloc, NULL, &tree) ==
- PARSERUTILS_OK);
-
-#define N 40000
-#define G 307
-//#define N 400
-//#define G 7
-
- printf("Inserting %d items\n", N);
-
- for (int i = G, count = 1; i != 0; i = (i + G) % N, count++) {
- void *old;
- assert(parserutils_rbtree_insert(tree,
- (char *) NULL + i, (char *) NULL + i,
- &old) == PARSERUTILS_OK);
-
- if ((count % 10000) == 0)
- printf("%d\n", count);
- }
-
- printf("Removing %d items\n", N/2);
-
- for (int i = 1, count = 1; i < N; i += 2, count++) {
- void *key, *value;
- assert(parserutils_rbtree_delete(tree, (char *) NULL + i,
- &key, &value) == PARSERUTILS_OK);
- if ((count % 10000) == 0)
- printf("%d\n", count);
- }
-
- printf("Finding %d items\n", N/2);
-
- for (int i = 2, count = 1; i < N; i += 2, count++) {
- void *value = NULL;
- assert(parserutils_rbtree_find(tree, (char *) NULL + i,
- &value) == PARSERUTILS_OK);
- assert(value != NULL && value == (char *) NULL + i);
- if ((count % 10000) == 0)
- printf("%d\n", count);
- }
-
- printf("Verifying & removing %d items\n", N/2);
-
- for (int i = 1, count = 1; i < N; i += 2, count++) {
- void *key, *value = NULL;
- assert(parserutils_rbtree_find(tree, (char *) NULL + i,
- &value) == PARSERUTILS_OK);
- assert(value == NULL);
- assert(parserutils_rbtree_delete(tree, (char *) NULL + i,
- &key, &value) == PARSERUTILS_OK);
- if ((count % 10000) == 0)
- printf("%d\n", count);
- }
-
- parserutils_rbtree_destroy(tree, NULL, NULL);
-
- printf("PASS\n");
-
- return 0;
-}
-