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
40
41 {
42 size_t length;
43 uint32_t *result;
44
45 result = u32_normalize (UNINORM_NFD, c1, c1_length, NULL, &length);
46 if (!(result != NULL
47 && length == c3_length
48 && u32_cmp (result, c3, c3_length) == 0))
49 return 1;
50 free (result);
51 }
52 {
53 size_t length;
54 uint32_t *result;
55
56 result = u32_normalize (UNINORM_NFD, c2, c2_length, NULL, &length);
57 if (!(result != NULL
58 && length == c3_length
59 && u32_cmp (result, c3, c3_length) == 0))
60 return 2;
61 free (result);
62 }
63 {
64 size_t length;
65 uint32_t *result;
66
67 result = u32_normalize (UNINORM_NFD, c3, c3_length, NULL, &length);
68 if (!(result != NULL
69 && length == c3_length
70 && u32_cmp (result, c3, c3_length) == 0))
71 return 3;
72 free (result);
73 }
74 {
75 size_t length;
76 uint32_t *result;
77
78 result = u32_normalize (UNINORM_NFD, c4, c4_length, NULL, &length);
79 if (!(result != NULL
80 && length == c5_length
81 && u32_cmp (result, c5, c5_length) == 0))
82 return 4;
83 free (result);
84 }
85 {
86 size_t length;
87 uint32_t *result;
88
89 result = u32_normalize (UNINORM_NFD, c5, c5_length, NULL, &length);
90 if (!(result != NULL
91 && length == c5_length
92 && u32_cmp (result, c5, c5_length) == 0))
93 return 5;
94 free (result);
95 }
96 return 0;
97 }
98
99 int
100 main (int argc, char *argv[])
101 {
102 struct normalization_test_file file;
103
104 read_normalization_test_file (argv[1], &file);
105
106 test_specific (&file, check);
107 test_other (&file, UNINORM_NFD);
108
109 free_normalization_test_file (&file);
110
111 return 0;
112 }
113
114 #else
115
116 #include <stdio.h>
117
118 int
119 main ()
120 {
121 fprintf (stderr, "Skipping test: uninorm/u32-normalize module not included.\n");
122 return 77;
123 }
124
125 #endif