annotate tests/uninorm/test-u32-normalize-big.c @ 11193:531b88e0986f

Tests for module 'uninorm/nfd'.
author Bruno Haible <bruno@clisp.org>
date Sat, 21 Feb 2009 12:46:44 +0100
parents
children 679ae1d73e0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11193
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of Unicode compliance of normalization of UTF-32 strings.
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 Copyright (C) 2009 Free Software Foundation, Inc.
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2009. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 /* Specification. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include "test-u32-normalize-big.h"
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #if GNULIB_UNINORM_U32_NORMALIZE
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include <stdio.h>
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #include <stdlib.h>
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 #include "xalloc.h"
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 #include "unistr.h"
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 #define ASSERT(expr) \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 do \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 { \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 if (!(expr)) \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 { \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 fflush (stderr); \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 abort (); \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 } \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 } \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 while (0)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 #define ASSERT_WITH_LINE(expr, file, line) \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 do \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 { \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 if (!(expr)) \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 { \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 fprintf (stderr, "%s:%d: assertion failed for %s:%u\n", \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 __FILE__, __LINE__, file, line); \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 fflush (stderr); \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 abort (); \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 } \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 } \
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 while (0)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 static int
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 cmp_ucs4_t (const void *a, const void *b)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 ucs4_t a_value = *(const ucs4_t *)a;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 ucs4_t b_value = *(const ucs4_t *)b;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 return (a_value < b_value ? -1 : a_value > b_value ? 1 : 0);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 void
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 read_normalization_test_file (const char *filename,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 struct normalization_test_file *file)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 FILE *stream;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 unsigned int lineno;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 int part_index;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 struct normalization_test_line *lines;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 size_t lines_length;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 size_t lines_allocated;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 stream = fopen (filename, "r");
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 if (stream == NULL)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 fprintf (stderr, "error during fopen of '%s'\n", filename);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 exit (1);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 for (part_index = 0; part_index < 4; part_index++)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 file->parts[part_index].lines = NULL;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 file->parts[part_index].lines_length = 0;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 lineno = 0;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 part_index = -1;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 lines = NULL;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 lines_length = 0;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 lines_allocated = 0;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 for (;;)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 char buf[1000+1];
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 char *ptr;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 int c;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 struct normalization_test_line line;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 size_t sequence_index;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 lineno++;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 /* Read a line. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 ptr = buf;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 do
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 c = getc (stream);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 if (c == EOF || c == '\n')
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 break;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 *ptr++ = c;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 while (ptr < buf + 1000);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 *ptr = '\0';
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 if (c == EOF)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 break;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 /* Ignore empty lines and comment lines. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 if (buf[0] == '\0' || buf[0] == '#')
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 continue;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 /* Handle lines that introduce a new part. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 if (buf[0] == '@')
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 /* Switch to the next part. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 if (part_index >= 0)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 lines =
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 (struct normalization_test_line *)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 xnrealloc (lines, lines_length, sizeof (struct normalization_test_line));
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 file->parts[part_index].lines = lines;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 file->parts[part_index].lines_length = lines_length;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 part_index++;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 lines = NULL;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 lines_length = 0;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 lines_allocated = 0;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 continue;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143 /* It's a line containing 5 sequences of Unicode characters.
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 Parse it and append it to the current part. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 if (!(part_index >= 0 && part_index < 4))
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 fprintf (stderr, "unexpected structure of '%s'\n", filename);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 exit (1);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 ptr = buf;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 line.lineno = lineno;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152 for (sequence_index = 0; sequence_index < 5; sequence_index++)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 line.sequences[sequence_index] = NULL;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 for (sequence_index = 0; sequence_index < 5; sequence_index++)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 uint32_t *sequence = XNMALLOC (1, uint32_t);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 size_t sequence_length = 0;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 for (;;)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 char *endptr;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 unsigned int uc;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 uc = strtoul (ptr, &endptr, 16);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 if (endptr == ptr)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 break;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 ptr = endptr;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 /* Append uc to the sequence. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170 sequence =
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 (uint32_t *)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172 xnrealloc (sequence, sequence_length + 2, sizeof (uint32_t));
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 sequence[sequence_length] = uc;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174 sequence_length++;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
175
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 if (*ptr == ' ')
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 ptr++;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 if (sequence_length == 0)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 fprintf (stderr, "empty character sequence in '%s'\n", filename);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 exit (1);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
183 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 sequence[sequence_length] = 0; /* terminator */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 line.sequences[sequence_index] = sequence;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 if (*ptr != ';')
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
190 fprintf (stderr, "error parsing '%s'\n", filename);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
191 exit (1);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
192 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
193 ptr++;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
194 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
195
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
196 /* Append the line to the current part. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
197 if (lines_length == lines_allocated)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199 lines_allocated = 2 * lines_allocated;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200 if (lines_allocated < 7)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
201 lines_allocated = 7;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 lines =
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
203 (struct normalization_test_line *)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204 xnrealloc (lines, lines_allocated, sizeof (struct normalization_test_line));
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 lines[lines_length] = line;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 lines_length++;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
210 if (part_index >= 0)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
211 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212 lines =
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213 (struct normalization_test_line *)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 xnrealloc (lines, lines_length, sizeof (struct normalization_test_line));
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
215 file->parts[part_index].lines = lines;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
216 file->parts[part_index].lines_length = lines_length;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 /* Collect all c1 values from the part 1 in an array. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 const struct normalization_test_part *p = &file->parts[1];
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 ucs4_t *c1_array = XNMALLOC (p->lines_length + 1, ucs4_t);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223 size_t line_index;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225 for (line_index = 0; line_index < p->lines_length; line_index++)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227 const unsigned int *sequence = p->lines[line_index].sequences[0];
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 /* In part 1, every sequences[0] consists of a single character. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 if (!(sequence[0] != 0 && sequence[1] == 0))
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
230 abort ();
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
231 c1_array[line_index] = sequence[0];
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
232 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
233
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
234 /* Sort this array. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
235 qsort (c1_array, p->lines_length, sizeof (ucs4_t), cmp_ucs4_t);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
237 /* Add the sentinel at the end. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238 c1_array[p->lines_length] = 0x110000;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
239
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
240 file->part1_c1_sorted = c1_array;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
241 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
242
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
243 file->filename = xstrdup (filename);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
244
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 if (ferror (stream) || fclose (stream))
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247 fprintf (stderr, "error reading from '%s'\n", filename);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
248 exit (1);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
251
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
252 void
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
253 test_specific (const struct normalization_test_file *file,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 int (*check) (const uint32_t *c1, size_t c1_length,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 const uint32_t *c2, size_t c2_length,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256 const uint32_t *c3, size_t c3_length,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
257 const uint32_t *c4, size_t c4_length,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
258 const uint32_t *c5, size_t c5_length))
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
259 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 size_t part_index;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
261
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262 for (part_index = 0; part_index < 4; part_index++)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
264 const struct normalization_test_part *p = &file->parts[part_index];
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
265 size_t line_index;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
266
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
267 for (line_index = 0; line_index < p->lines_length; line_index++)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
268 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
269 const struct normalization_test_line *l = &p->lines[line_index];
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
270
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
271 ASSERT_WITH_LINE (check (l->sequences[0], u32_strlen (l->sequences[0]),
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
272 l->sequences[1], u32_strlen (l->sequences[1]),
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
273 l->sequences[2], u32_strlen (l->sequences[2]),
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
274 l->sequences[3], u32_strlen (l->sequences[3]),
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
275 l->sequences[4], u32_strlen (l->sequences[4]))
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
276 == 0,
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277 file->filename, l->lineno);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
280 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
281
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
282 void
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
283 test_other (const struct normalization_test_file *file, uninorm_t nf)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
284 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
285 /* Check that for every character not listed in part 1 of the
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
286 NormalizationTest.txt file, the character maps to itself in each
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
287 of the four normalization forms. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
288 const ucs4_t *p = file->part1_c1_sorted;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
289 ucs4_t uc;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
291 for (uc = 0; uc < 0x110000; uc++)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
292 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
293 if (uc >= 0xD800 && uc < 0xE000)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
294 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 /* A surrogate, not a character. Skip uc. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
296 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 else if (uc == *p)
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299 /* Skip uc. */
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 p++;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
301 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 else
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
303 {
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304 uint32_t input[1];
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 size_t length;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306 uint32_t *result;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 input[0] = uc;
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 result = u32_normalize (nf, input, 1, NULL, &length);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310 ASSERT (result != NULL && length == 1 && result[0] == uc);
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 }
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314
531b88e0986f Tests for module 'uninorm/nfd'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 #endif