1 /* Test of Unicode compliance of normalization of UTF-32 strings.
2 Copyright (C) 2009 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* The NormalizationTest.txt is from www.unicode.org, with stripped comments:
23 sed -e 's| *#.*||' < .../ucd/NormalizationTest.txt \
24 > tests/uninorm/NormalizationTest.txt
25 It is only used to verify the compliance of this implementation of the
26 Unicode normalization forms. It is not used by the library code, only
29 /* Representation of a line in the NormalizationTest.txt file. */
30 struct normalization_test_line
33 uint32_t *sequences[5];
36 /* Representation of a delimited part of the NormalizationTest.txt file. */
37 struct normalization_test_part
39 struct normalization_test_line *lines;
43 /* Representation of the entire NormalizationTest.txt file. */
44 struct normalization_test_file
46 struct normalization_test_part parts[4];
47 /* The set of c1 values from part 1, sorted in ascending order, with a
48 sentinel value of 0x110000 at the end. */
49 ucs4_t *part1_c1_sorted;
50 /* The filename of the NormalizationTest.txt file. */
54 /* Read the NormalizationTest.txt file and return its contents. */
56 read_normalization_test_file (const char *filename,
57 struct normalization_test_file *file);
59 /* Perform the first compliance test. */
61 test_specific (const struct normalization_test_file *file,
62 int (*check) (const uint32_t *c1, size_t c1_length,
63 const uint32_t *c2, size_t c2_length,
64 const uint32_t *c3, size_t c3_length,
65 const uint32_t *c4, size_t c4_length,
66 const uint32_t *c5, size_t c5_length));
68 /* Perform the second compliance test. */
70 test_other (const struct normalization_test_file *file, uninorm_t nf);