summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-08-23 09:31:21 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-08-23 09:31:21 +0000
commita2b03cc942618f3da05423bc4e5c1a1623489653 (patch)
treee64bf94941403d4d96c7c393115101da61e3153f /test
parenteedefef10ef19172a26e813372af174007d6c995 (diff)
downloadlibhubbub-a2b03cc942618f3da05423bc4e5c1a1623489653.tar.gz
libhubbub-a2b03cc942618f3da05423bc4e5c1a1623489653.tar.bz2
Fix test driver
svn path=/trunk/hubbub/; revision=5182
Diffstat (limited to 'test')
-rw-r--r--test/tree.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/tree.c b/test/tree.c
index 026c447..96762c9 100644
--- a/test/tree.c
+++ b/test/tree.c
@@ -95,9 +95,6 @@ static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE)
}
node_ref_alloc = NODE_REF_CHUNK;
- /* Initialise library */
- assert(hubbub_initialise(argv[1], myrealloc, NULL) == HUBBUB_OK);
-
parser = hubbub_parser_create("UTF-8", myrealloc, NULL);
assert(parser != NULL);
@@ -148,8 +145,6 @@ static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE)
hubbub_parser_destroy(parser);
- assert(hubbub_finalise(myrealloc, NULL) == HUBBUB_OK);
-
/* Ensure that all nodes have been released by the treebuilder */
for (uintptr_t n = 1; n <= node_counter; n++) {
if (node_ref[n] != 0) {
@@ -159,6 +154,7 @@ static int run_test(int argc, char **argv, unsigned int CHUNK_SIZE)
}
free(node_ref);
+ node_counter = 0;
printf("%s\n", passed ? "PASS" : "FAIL");
@@ -174,10 +170,17 @@ int main(int argc, char **argv)
printf("Usage: %s <aliases_file> <filename>\n", argv[0]);
return 1;
}
+
+ /* Initialise library */
+ assert(hubbub_initialise(argv[1], myrealloc, NULL) == HUBBUB_OK);
+
#define DO_TEST(n) if ((ret = run_test(argc, argv, (n))) != 0) return ret
for (shift = 0; (1 << shift) != 16384; shift++)
for (offset = 0; offset < 10; offset += 3)
DO_TEST((1 << shift) + offset);
+
+ assert(hubbub_finalise(myrealloc, NULL) == HUBBUB_OK);
+
return 0;
#undef DO_TEST
}