summaryrefslogtreecommitdiff
path: root/test/testutils.h
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-06-13 05:00:11 +0530
committerRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-09 10:04:20 +0530
commit02f5504de388eb69ded0bc9e05361d8db82c2137 (patch)
tree702495f5dce9b1c41b2191de259d3db58a430a29 /test/testutils.h
parenta501b83d9be45e80b59fc8eca8e1816f467b4662 (diff)
downloadlibhubbub-02f5504de388eb69ded0bc9e05361d8db82c2137.tar.gz
libhubbub-02f5504de388eb69ded0bc9e05361d8db82c2137.tar.bz2
[Fix] tokeniser wrongly emitted a replacement character instead of utf8 NULL. Also, the tester used strlen to calculate string lengths--this seg faults if a null is passed-- this is also fixed.
Diffstat (limited to 'test/testutils.h')
-rw-r--r--test/testutils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/testutils.h b/test/testutils.h
index 45870f9..7a8eda5 100644
--- a/test/testutils.h
+++ b/test/testutils.h
@@ -10,6 +10,18 @@
#define UNUSED(x) ((x) = (x))
#endif
+#ifndef LEN
+uint32_t string_length(const char *str);
+uint32_t string_length(const char *str)
+{
+ if(str == NULL)
+ return 0;
+ return strlen(str);
+}
+#define LEN(x) string_length(x)
+#endif
+
+
/* Redefine assert, so we can simply use the standard assert mechanism
* within testcases and exit with the right output for the testrunner
* to do the right thing. */