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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#include <inttypes.h>
#include <stdbool.h>
static bool zaptest_test_win1252dec(void) {
zap_chr8 const win1252[] = {
0x26u,
0xF0u,
0x80u,
0x82u,
0x83u,
0x84u,
0x85u,
0x86u,
0x87u,
0x88u,
0x89u,
0x8Au,
0x8Bu,
0x8Cu,
0x8Eu,
0x91u,
0x92u,
0x93u,
0x94u,
0x95u,
0x96u,
0x97u,
0x98u,
0x99u,
0x9Au,
0x9Bu,
0x9Cu,
0x9Eu,
0x9Fu,
0x0u,
};
zap_sz const enclen = sizeof (win1252) - 0x1u;
zaptest_chk(enclen,0x1Du,zap_sz,"%zX")
zap_chr20 * const utf20 = malloc(sizeof (zap_chr20) * (enclen + 0x1u));
if (utf20 == NULL) {
fputs("test.win1252dec: Memory allocation failed!\n\n",stderr);
return true;
}
zap_win1252dec(win1252,utf20);
zaptest_chk(utf20[0x0u], 0x26u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x1u], 0xF0u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x2u], 0x20ACu,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x3u], 0x201Au,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x4u], 0x192u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x5u], 0x201Eu,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x6u], 0x2026u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x7u], 0x2020u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x8u], 0x2021u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x9u], 0x2C6u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0xAu], 0x2030u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0xBu], 0x160u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0xCu], 0x2039u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0xDu], 0x152u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0xEu], 0x17Du, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0xFu], 0x2018u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x10u],0x2019u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x11u],0x201Cu,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x12u],0x201Du,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x13u],0x2022u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x14u],0x2013u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x15u],0x2014u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x16u],0x2DCu, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x17u],0x2122u,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x18u],0x161u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x19u],0x203Au,zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x1Au],0x153u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x1Bu],0x17Eu, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x1Cu],0x178u, zap_chr20,"%" PRIXLEAST32);
zaptest_chk(utf20[0x1Du],0x0u, zap_chr20,"%" PRIXLEAST32);
free(utf20);
return false;
}
|