From 7b30a5520cfb56e651f0eb4da85a3e07747da7dc Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 23 Jun 2007 22:40:25 +0000 Subject: Import hubbub -- an HTML parsing library. Plenty of work still to do (like tree generation ;) svn path=/trunk/hubbub/; revision=3359 --- test/entities.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/entities.c (limited to 'test/entities.c') diff --git a/test/entities.c b/test/entities.c new file mode 100644 index 0000000..e99e6b0 --- /dev/null +++ b/test/entities.c @@ -0,0 +1,42 @@ +#include "tokeniser/entities.h" + +#include "testutils.h" + +static void *myrealloc(void *ptr, size_t len, void *pw) +{ + UNUSED(pw); + + return realloc(ptr, len); +} + +int main(int argc, char **argv) +{ + uint32_t result; + void *context = NULL; + + UNUSED(argc); + UNUSED(argv); + + assert(hubbub_entities_create(myrealloc, NULL) == HUBBUB_OK); + + assert(hubbub_entities_search_step('o', &result, &context) == + HUBBUB_NEEDDATA); + + assert(hubbub_entities_search_step('r', &result, &context) == + HUBBUB_OK); + + assert(hubbub_entities_search_step('d', &result, &context) == + HUBBUB_NEEDDATA); + + assert(hubbub_entities_search_step('f', &result, &context) == + HUBBUB_OK); + + assert(hubbub_entities_search_step('z', &result, &context) == + HUBBUB_INVALID); + + hubbub_entities_destroy(myrealloc, NULL); + + printf("PASS\n"); + + return 0; +} -- cgit v1.2.3