blob: cf64390f63e7199268901df6404b1a8f2755686a (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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;
}
 |