1 | #!/bin/sh
|
---|
2 | # Check that case folding works even with titlecase and similarly odd chars.
|
---|
3 |
|
---|
4 | # Copyright 2014-2021 Free Software Foundation, Inc.
|
---|
5 |
|
---|
6 | # This program is free software: you can redistribute it and/or modify
|
---|
7 | # it under the terms of the GNU General Public License as published by
|
---|
8 | # the Free Software Foundation, either version 3 of the License, or
|
---|
9 | # (at your option) any later version.
|
---|
10 |
|
---|
11 | # This program is distributed in the hope that it will be useful,
|
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | # GNU General Public License for more details.
|
---|
15 |
|
---|
16 | # You should have received a copy of the GNU General Public License
|
---|
17 | # along with this program. If not, see <https://www.gnu.org/licenses/>.
|
---|
18 |
|
---|
19 | . "${srcdir=.}/init.sh"; path_prepend_ ../src
|
---|
20 |
|
---|
21 | require_en_utf8_locale_
|
---|
22 | require_compiled_in_MB_support
|
---|
23 | LC_ALL=en_US.UTF-8
|
---|
24 | export LC_ALL
|
---|
25 |
|
---|
26 | fail=0
|
---|
27 |
|
---|
28 | for testcase in \
|
---|
29 | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
---|
30 | do
|
---|
31 | case $testcase in
|
---|
32 | 0)
|
---|
33 | a='\302\265' # U+00B5
|
---|
34 | b='\316\234' # U+039C
|
---|
35 | c='\316\274' # U+03BC
|
---|
36 | ;;
|
---|
37 | 1)
|
---|
38 | a='\111' # U+0049
|
---|
39 | b='\151' # U+0069
|
---|
40 | c='\304\260' # U+0130
|
---|
41 | ;;
|
---|
42 | 2)
|
---|
43 | a='\111' # U+0049
|
---|
44 | b='\151' # U+0069
|
---|
45 | c='\304\261' # U+0131
|
---|
46 | ;;
|
---|
47 | 3)
|
---|
48 | a='\123' # U+0053
|
---|
49 | b='\163' # U+0073
|
---|
50 | c='\305\277' # U+017F
|
---|
51 | ;;
|
---|
52 | 4)
|
---|
53 | a='\307\204' # U+01C4
|
---|
54 | b='\307\205' # U+01C5
|
---|
55 | c='\307\206' # U+01C6
|
---|
56 | ;;
|
---|
57 | 5)
|
---|
58 | a='\307\207' # U+01C7
|
---|
59 | b='\307\210' # U+01C8
|
---|
60 | c='\307\211' # U+01C9
|
---|
61 | ;;
|
---|
62 | 6)
|
---|
63 | a='\307\212' # U+01CA
|
---|
64 | b='\307\213' # U+01CB
|
---|
65 | c='\307\214' # U+01CC
|
---|
66 | ;;
|
---|
67 | 7)
|
---|
68 | a='\307\261' # U+01F1
|
---|
69 | b='\307\262' # U+01F2
|
---|
70 | c='\307\263' # U+01F3
|
---|
71 | ;;
|
---|
72 | 8)
|
---|
73 | a='\315\205' # U+0345
|
---|
74 | b='\316\231' # U+0399
|
---|
75 | c='\316\271' # U+03B9
|
---|
76 | ;;
|
---|
77 | 9)
|
---|
78 | a='\316\243' # U+03A3
|
---|
79 | b='\317\202' # U+03C2
|
---|
80 | c='\317\203' # U+03C3
|
---|
81 | ;;
|
---|
82 | 10)
|
---|
83 | a='\316\222' # U+0392
|
---|
84 | b='\316\262' # U+03B2
|
---|
85 | c='\317\220' # U+03D0
|
---|
86 | ;;
|
---|
87 | 11)
|
---|
88 | a='\316\230' # U+0398
|
---|
89 | b='\316\270' # U+03B8
|
---|
90 | c='\317\221' # U+03D1
|
---|
91 | ;;
|
---|
92 | 12)
|
---|
93 | a='\316\246' # U+03A6
|
---|
94 | b='\317\206' # U+03C6
|
---|
95 | c='\317\225' # U+03D5
|
---|
96 | ;;
|
---|
97 | 13)
|
---|
98 | a='\316\240' # U+03A0
|
---|
99 | b='\317\200' # U+03C0
|
---|
100 | c='\317\226' # U+03D6
|
---|
101 | ;;
|
---|
102 | 14)
|
---|
103 | a='\316\232' # U+039A
|
---|
104 | b='\316\272' # U+03BA
|
---|
105 | c='\317\260' # U+03F0
|
---|
106 | ;;
|
---|
107 | 15)
|
---|
108 | a='\316\241' # U+03A1
|
---|
109 | b='\317\201' # U+03C1
|
---|
110 | c='\317\261' # U+03F1
|
---|
111 | ;;
|
---|
112 | 16)
|
---|
113 | a='\316\230' # U+0398
|
---|
114 | b='\316\270' # U+03B8
|
---|
115 | c='\317\264' # U+03F4
|
---|
116 | ;;
|
---|
117 | 17)
|
---|
118 | a='\316\225' # U+0395
|
---|
119 | b='\316\265' # U+03B5
|
---|
120 | c='\317\265' # U+03F5
|
---|
121 | ;;
|
---|
122 | 18)
|
---|
123 | a='\341\271\240' # U+1E60
|
---|
124 | b='\341\271\241' # U+1E61
|
---|
125 | c='\341\272\233' # U+1E9B
|
---|
126 | ;;
|
---|
127 | 19)
|
---|
128 | a='\303\237' # U+00DF
|
---|
129 | b='\303\237' # U+00DF
|
---|
130 | c='\341\272\236' # U+1E9E
|
---|
131 | ;;
|
---|
132 | 20)
|
---|
133 | a='\316\231' # U+0399
|
---|
134 | b='\316\271' # U+03B9
|
---|
135 | c='\341\276\276' # U+1FBE
|
---|
136 | ;;
|
---|
137 | 21)
|
---|
138 | a='\316\251' # U+03A9
|
---|
139 | b='\317\211' # U+03C9
|
---|
140 | c='\342\204\246' # U+2126
|
---|
141 | ;;
|
---|
142 | 22)
|
---|
143 | a='\113' # U+004B
|
---|
144 | b='\153' # U+006B
|
---|
145 | c='\342\204\252' # U+212A
|
---|
146 | ;;
|
---|
147 | 23)
|
---|
148 | a='\303\205' # U+00C5
|
---|
149 | b='\303\245' # U+00E5
|
---|
150 | c='\342\204\253' # U+212B
|
---|
151 | ;;
|
---|
152 | 24)
|
---|
153 | a='\316\243' # U+03A3
|
---|
154 | b='\317\203' # U+03C3
|
---|
155 | c='\317\262' # U+03F2
|
---|
156 | ;;
|
---|
157 | esac
|
---|
158 |
|
---|
159 | printf "$a\\n$b\\n$c\\n" >in || framework_failure_
|
---|
160 | for pattern in "$a" "$b" "$c"; do
|
---|
161 | pat=$(printf "$pattern\\n") || framework_failure_
|
---|
162 | grep -i "\\(\\)\\1$pat" in >out-regex || fail=1
|
---|
163 | grep -i "$pat" in >out-dfa || fail=1
|
---|
164 | compare_ out-regex out-dfa || fail=1
|
---|
165 | grep -iF "$pat" in >out-fixed || fail=1
|
---|
166 | compare_ out-regex out-fixed || fail=1
|
---|
167 | done
|
---|
168 | done
|
---|
169 |
|
---|
170 | # Try a unibyte test with ISO 8859-7, if available.
|
---|
171 | if test "$(get-mb-cur-max el_GR.iso88597)" -eq 1; then
|
---|
172 | LC_ALL=el_GR.iso88597
|
---|
173 | export LC_ALL
|
---|
174 |
|
---|
175 | a='\323' # SIGMA
|
---|
176 | b='\362' # stigma
|
---|
177 | c='\363' # sigma
|
---|
178 |
|
---|
179 | printf "$a\\n$b\\n$c\\n" >in || framework_failure_
|
---|
180 | for pattern in "$a" "$b" "$c"; do
|
---|
181 | pat=$(printf "$pattern\\n") || framework_failure_
|
---|
182 | grep -i "\\(\\)\\1$pat" in >out-regex || fail=1
|
---|
183 | grep -i "$pat" in >out-dfa || fail=1
|
---|
184 | compare_ out-regex out-dfa || fail=1
|
---|
185 | grep -iF "$pat" in >out-fixed || fail=1
|
---|
186 | compare_ out-regex out-fixed || fail=1
|
---|
187 | done
|
---|
188 | fi
|
---|
189 |
|
---|
190 | Exit $fail
|
---|