Commit | Line | Data |
---|---|---|
b0322a85 CE |
1 | #include "unicode_config.h" |
2 | #include "unicode.h" | |
3 | ||
4 | #include <string.h> | |
5 | #include <stdio.h> | |
6 | #include <stdlib.h> | |
7 | ||
8 | struct i { | |
9 | size_t n_start; | |
10 | size_t n_size; | |
11 | unicode_char v; | |
12 | }; | |
13 | ||
14 | #include "unicode_htmlent.h" | |
15 | ||
16 | static void testsuite() | |
17 | { | |
18 | size_t j; | |
19 | ||
20 | for (j=0; j<sizeof(ii)/sizeof(ii[0]); ++j) | |
21 | { | |
22 | char buf[60]; | |
23 | ||
24 | memcpy(buf, n + ii[j].n_start, ii[j].n_size); | |
25 | buf[ii[j].n_size]=0; | |
26 | ||
27 | if (unicode_html40ent_lookup(buf) != ii[j].v) | |
28 | { | |
29 | fprintf(stderr, "Did not find %s\n", buf); | |
30 | exit(1); | |
31 | } | |
32 | ||
33 | strcat(buf, "X"); | |
34 | ||
35 | if (unicode_html40ent_lookup(buf) == ii[j].v) | |
36 | { | |
37 | fprintf(stderr, "Found %s?\n", buf); | |
38 | exit(1); | |
39 | } | |
40 | ||
41 | buf[strlen(buf)-2]=0; | |
42 | ||
43 | if (unicode_html40ent_lookup(buf) == ii[j].v) | |
44 | { | |
45 | fprintf(stderr, "Found %s?\n", buf); | |
46 | exit(1); | |
47 | } | |
48 | } | |
49 | } | |
50 | ||
51 | int main(int argc, char **argv) | |
52 | { | |
53 | testsuite(); | |
54 | return 0; | |
55 | } |