Mercurial > gnulib
annotate tests/uninorm/test-u32-normalize-big.h @ 40226:5b87a9bf7240
uninorm tests: Free allocated memory.
* tests/uninorm/test-u32-normalize-big.h
(struct normalization_test_file): Remove 'const' from allocated member.
(free_normalization_test_file): New declaration.
* tests/uninorm/test-u32-normalize-big.c (test_other): Free allocated
memory.
(free_normalization_test_file): New function.
* tests/uninorm/test-u32-nfc-big.c (main): Free allocated
'struct normalization_test_file' contents.
* tests/uninorm/test-u32-nfd-big.c (main): Likewise.
* tests/uninorm/test-u32-nfkc-big.c (main): Likewise.
* tests/uninorm/test-u32-nfkd-big.c (main): Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 10 Mar 2019 15:14:01 +0100 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
11193 | 1 /* Test of Unicode compliance of normalization of UTF-32 strings. |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 Copyright (C) 2009-2019 Free Software Foundation, Inc. |
11193 | 3 |
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. | |
8 | |
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. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
19190 | 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
11193 | 16 |
17 #include <stddef.h> | |
18 | |
19 #include "unitypes.h" | |
20 #include "uninorm.h" | |
21 | |
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 | |
27 by the unit tests. */ | |
28 | |
29 /* Representation of a line in the NormalizationTest.txt file. */ | |
30 struct normalization_test_line | |
31 { | |
32 unsigned int lineno; | |
33 uint32_t *sequences[5]; | |
34 }; | |
35 | |
36 /* Representation of a delimited part of the NormalizationTest.txt file. */ | |
37 struct normalization_test_part | |
38 { | |
39 struct normalization_test_line *lines; | |
40 size_t lines_length; | |
41 }; | |
42 | |
43 /* Representation of the entire NormalizationTest.txt file. */ | |
44 struct normalization_test_file | |
45 { | |
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. */ | |
40226
5b87a9bf7240
uninorm tests: Free allocated memory.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
51 char *filename; |
11193 | 52 }; |
53 | |
54 /* Read the NormalizationTest.txt file and return its contents. */ | |
55 extern void | |
56 read_normalization_test_file (const char *filename, | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11193
diff
changeset
|
57 struct normalization_test_file *file); |
11193 | 58 |
59 /* Perform the first compliance test. */ | |
60 extern void | |
61 test_specific (const struct normalization_test_file *file, | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11193
diff
changeset
|
62 int (*check) (const uint32_t *c1, size_t c1_length, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11193
diff
changeset
|
63 const uint32_t *c2, size_t c2_length, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11193
diff
changeset
|
64 const uint32_t *c3, size_t c3_length, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11193
diff
changeset
|
65 const uint32_t *c4, size_t c4_length, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11193
diff
changeset
|
66 const uint32_t *c5, size_t c5_length)); |
11193 | 67 |
68 /* Perform the second compliance test. */ | |
69 extern void | |
70 test_other (const struct normalization_test_file *file, uninorm_t nf); | |
40226
5b87a9bf7240
uninorm tests: Free allocated memory.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
71 |
5b87a9bf7240
uninorm tests: Free allocated memory.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
72 /* Free the representation of the NormalizationTest.txt file. */ |
5b87a9bf7240
uninorm tests: Free allocated memory.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
73 extern void |
5b87a9bf7240
uninorm tests: Free allocated memory.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
74 free_normalization_test_file (struct normalization_test_file *file); |