summaryrefslogtreecommitdiff
path: root/test/entities.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-06-23 22:40:25 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-06-23 22:40:25 +0000
commit7b30a5520cfb56e651f0eb4da85a3e07747da7dc (patch)
tree5d6281c071c089e1e7a8ae6f8044cecaf6a7db16 /test/entities.c
downloadlibhubbub-7b30a5520cfb56e651f0eb4da85a3e07747da7dc.tar.gz
libhubbub-7b30a5520cfb56e651f0eb4da85a3e07747da7dc.tar.bz2
Import hubbub -- an HTML parsing library.
Plenty of work still to do (like tree generation ;) svn path=/trunk/hubbub/; revision=3359
Diffstat (limited to 'test/entities.c')
-rw-r--r--test/entities.c42
1 files changed, 42 insertions, 0 deletions
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;
+}