This source file includes following definitions.
- check
- main
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21 #if GNULIB_TEST_UNINORM_U32_NORMALIZE
22
23 #include "uninorm.h"
24
25 #include <stdlib.h>
26
27 #include "unistr.h"
28 #include "test-u32-normalize-big.h"
29
30 static int
31 check (const uint32_t *c1, size_t c1_length,
32 const uint32_t *c2, size_t c2_length,
33 const uint32_t *c3, size_t c3_length,
34 const uint32_t *c4, size_t c4_length,
35 const uint32_t *c5, size_t c5_length)
36 {
37
38 {
39 size_t length;
40 uint32_t *result;
41
42 result = u32_normalize (UNINORM_NFKD, c1, c1_length, NULL, &length);
43 if (!(result != NULL
44 && length == c5_length
45 && u32_cmp (result, c5, c5_length) == 0))
46 return 1;
47 free (result);
48 }
49 {
50 size_t length;
51 uint32_t *result;
52
53 result = u32_normalize (UNINORM_NFKD, c2, c2_length, NULL, &length);
54 if (!(result != NULL
55 && length == c5_length
56 && u32_cmp (result, c5, c5_length) == 0))
57 return 2;
58 free (result);
59 }
60 {
61 size_t length;
62 uint32_t *result;
63
64 result = u32_normalize (UNINORM_NFKD, c3, c3_length, NULL, &length);
65 if (!(result != NULL
66 && length == c5_length
67 && u32_cmp (result, c5, c5_length) == 0))
68 return 3;
69 free (result);
70 }
71 {
72 size_t length;
73 uint32_t *result;
74
75 result = u32_normalize (UNINORM_NFKD, c4, c4_length, NULL, &length);
76 if (!(result != NULL
77 && length == c5_length
78 && u32_cmp (result, c5, c5_length) == 0))
79 return 4;
80 free (result);
81 }
82 {
83 size_t length;
84 uint32_t *result;
85
86 result = u32_normalize (UNINORM_NFKD, c5, c5_length, NULL, &length);
87 if (!(result != NULL
88 && length == c5_length
89 && u32_cmp (result, c5, c5_length) == 0))
90 return 5;
91 free (result);
92 }
93 return 0;
94 }
95
96 int
97 main (int argc, char *argv[])
98 {
99 struct normalization_test_file file;
100
101 read_normalization_test_file (argv[1], &file);
102
103 test_specific (&file, check);
104 test_other (&file, UNINORM_NFKD);
105
106 free_normalization_test_file (&file);
107
108 return 0;
109 }
110
111 #else
112
113 #include <stdio.h>
114
115 int
116 main ()
117 {
118 fprintf (stderr, "Skipping test: uninorm/u32-normalize module not included.\n");
119 return 77;
120 }
121
122 #endif