summaryrefslogtreecommitdiffstats
path: root/unicode/enttest.c
diff options
context:
space:
mode:
authorSam Varshavchik2013-08-19 16:39:41 -0400
committerSam Varshavchik2013-08-25 14:43:51 -0400
commit9c45d9ad13fdf439d44d7443ae75da15ea0223ed (patch)
tree7a81a04cb51efb078ee350859a64be2ebc6b8813 /unicode/enttest.c
parenta9520698b770168d1f33d6301463bb70a19655ec (diff)
downloadcourier-libs-9c45d9ad13fdf439d44d7443ae75da15ea0223ed.tar.bz2
Initial checkin
Imported from subversion report, converted to git. Updated all paths in scripts and makefiles, reflecting the new directory hierarchy.
Diffstat (limited to 'unicode/enttest.c')
-rw-r--r--unicode/enttest.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/unicode/enttest.c b/unicode/enttest.c
new file mode 100644
index 0000000..cf64390
--- /dev/null
+++ b/unicode/enttest.c
@@ -0,0 +1,55 @@
+#include "unicode_config.h"
+#include "unicode.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+struct i {
+ size_t n_start;
+ size_t n_size;
+ unicode_char v;
+};
+
+#include "unicode_htmlent.h"
+
+static void testsuite()
+{
+ size_t j;
+
+ for (j=0; j<sizeof(ii)/sizeof(ii[0]); ++j)
+ {
+ char buf[60];
+
+ memcpy(buf, n + ii[j].n_start, ii[j].n_size);
+ buf[ii[j].n_size]=0;
+
+ if (unicode_html40ent_lookup(buf) != ii[j].v)
+ {
+ fprintf(stderr, "Did not find %s\n", buf);
+ exit(1);
+ }
+
+ strcat(buf, "X");
+
+ if (unicode_html40ent_lookup(buf) == ii[j].v)
+ {
+ fprintf(stderr, "Found %s?\n", buf);
+ exit(1);
+ }
+
+ buf[strlen(buf)-2]=0;
+
+ if (unicode_html40ent_lookup(buf) == ii[j].v)
+ {
+ fprintf(stderr, "Found %s?\n", buf);
+ exit(1);
+ }
+ }
+}
+
+int main(int argc, char **argv)
+{
+ testsuite();
+ return 0;
+}