Mercurial > gnulib
annotate tests/uninorm/test-u32-nfkd-big.c @ 11197:e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 21 Feb 2009 12:51:31 +0100 |
parents | |
children | e8d2c6fc33ad |
rev | line source |
---|---|
11197
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Test of Unicode compliance of compatibility decomposition of UTF-32 strings. |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 Copyright (C) 2009 Free Software Foundation, Inc. |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 (at your option) any later version. |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 GNU General Public License for more details. |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 /* Written by Bruno Haible <bruno@clisp.org>, 2009. */ |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 #include <config.h> |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 #if GNULIB_UNINORM_U32_NORMALIZE |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 #include "uninorm.h" |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 #include <stdlib.h> |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 #include "unistr.h" |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 #include "progname.h" |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 #include "test-u32-normalize-big.h" |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 static int |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 check (const uint32_t *c1, size_t c1_length, |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 const uint32_t *c2, size_t c2_length, |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 const uint32_t *c3, size_t c3_length, |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 const uint32_t *c4, size_t c4_length, |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 const uint32_t *c5, size_t c5_length) |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 /* Check c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5). */ |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 size_t length; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 uint32_t *result; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 result = u32_normalize (UNINORM_NFKD, c1, c1_length, NULL, &length); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 if (!(result != NULL |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 && length == c5_length |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 && u32_cmp (result, c5, c5_length) == 0)) |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 return 1; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 free (result); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 size_t length; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 uint32_t *result; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 result = u32_normalize (UNINORM_NFKD, c2, c2_length, NULL, &length); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 if (!(result != NULL |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 && length == c5_length |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 && u32_cmp (result, c5, c5_length) == 0)) |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 return 2; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 free (result); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 size_t length; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 uint32_t *result; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 result = u32_normalize (UNINORM_NFKD, c3, c3_length, NULL, &length); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 if (!(result != NULL |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 && length == c5_length |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
68 && u32_cmp (result, c5, c5_length) == 0)) |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
69 return 3; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
70 free (result); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 size_t length; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 uint32_t *result; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 result = u32_normalize (UNINORM_NFKD, c4, c4_length, NULL, &length); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
77 if (!(result != NULL |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
78 && length == c5_length |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
79 && u32_cmp (result, c5, c5_length) == 0)) |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
80 return 4; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
81 free (result); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
82 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
83 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
84 size_t length; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
85 uint32_t *result; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
86 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
87 result = u32_normalize (UNINORM_NFKD, c5, c5_length, NULL, &length); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
88 if (!(result != NULL |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 && length == c5_length |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 && u32_cmp (result, c5, c5_length) == 0)) |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 return 5; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 free (result); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
94 return 0; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
95 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 int |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 main (int argc, char *argv[]) |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
100 struct normalization_test_file file; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
101 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
102 set_program_name (argv[0]); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
103 read_normalization_test_file (argv[1], &file); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
104 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
105 test_specific (&file, check); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
106 test_other (&file, UNINORM_NFKD); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
107 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
108 return 0; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
109 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
110 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
111 #else |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
112 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
113 #include <stdio.h> |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
114 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
115 int |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
116 main () |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
117 { |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
118 fprintf (stderr, "Skipping test: uninorm/u32-normalize module not included.\n"); |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
119 return 77; |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
120 } |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
121 |
e2cc4f2d133f
Tests for module 'uninorm/nfkd'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
122 #endif |