LEFT | RIGHT |
(no file at all) | |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html#License | 2 // License & terms of use: http://www.unicode.org/copyright.html#License |
3 /** | 3 /** |
4 ******************************************************************************* | 4 ******************************************************************************* |
5 * Copyright (C) 1996-2014, International Business Machines Corporation and | 5 * Copyright (C) 1996-2014, International Business Machines Corporation and |
6 * others. All Rights Reserved. | 6 * others. All Rights Reserved. |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 ", false)=" + prettify(UCharacter.foldCase(FOLDING_MIXED_[1],
false)) | 182 ", false)=" + prettify(UCharacter.foldCase(FOLDING_MIXED_[1],
false)) |
183 + " should be " + prettify(FOLDING_EXCLUDE_SPECIAL_I_[1])); | 183 + " should be " + prettify(FOLDING_EXCLUDE_SPECIAL_I_[1])); |
184 } | 184 } |
185 | 185 |
186 if (!FOLDING_EXCLUDE_SPECIAL_I_[1].equals( | 186 if (!FOLDING_EXCLUDE_SPECIAL_I_[1].equals( |
187 UCharacter.foldCase(FOLDING_MIXED_[1], UCharacte
r.FOLD_CASE_EXCLUDE_SPECIAL_I))) { | 187 UCharacter.foldCase(FOLDING_MIXED_[1], UCharacte
r.FOLD_CASE_EXCLUDE_SPECIAL_I))) { |
188 errln("FAIL: foldCase(" + prettify(FOLDING_MIXED_[1]) + | 188 errln("FAIL: foldCase(" + prettify(FOLDING_MIXED_[1]) + |
189 ", UCharacter.FOLD_CASE_EXCLUDE_SPECIAL_I)=" + prettify(UChara
cter.foldCase(FOLDING_MIXED_[1], UCharacter.FOLD_CASE_EXCLUDE_SPECIAL_I)) | 189 ", UCharacter.FOLD_CASE_EXCLUDE_SPECIAL_I)=" + prettify(UChara
cter.foldCase(FOLDING_MIXED_[1], UCharacter.FOLD_CASE_EXCLUDE_SPECIAL_I)) |
190 + " should be " | 190 + " should be " |
191 + prettify(FOLDING_EXCLUDE_SPECIAL_I_[1])); | 191 + prettify(FOLDING_EXCLUDE_SPECIAL_I_[1])); |
| 192 } |
| 193 } |
| 194 |
| 195 @Test |
| 196 public void TestInvalidCodePointFolding() { |
| 197 int[] invalidCodePoints = { |
| 198 0xD800, // lead surrogate |
| 199 0xDFFF, // trail surrogate |
| 200 0xFDD0, // noncharacter |
| 201 0xFFFF, // noncharacter |
| 202 0x110000, // out of range |
| 203 -1 // negative |
| 204 }; |
| 205 for (int cp : invalidCodePoints) { |
| 206 assertEquals("Invalid code points should be echoed back", |
| 207 cp, UCharacter.foldCase(cp, true)); |
| 208 assertEquals("Invalid code points should be echoed back", |
| 209 cp, UCharacter.foldCase(cp, false)); |
| 210 assertEquals("Invalid code points should be echoed back", |
| 211 cp, UCharacter.foldCase(cp, UCharacter.FOLD_CASE_DEFAULT)); |
| 212 assertEquals("Invalid code points should be echoed back", |
| 213 cp, UCharacter.foldCase(cp, UCharacter.FOLD_CASE_EXCLUDE_SPE
CIAL_I)); |
192 } | 214 } |
193 } | 215 } |
194 | 216 |
195 /** | 217 /** |
196 * Testing the strings case mapping methods | 218 * Testing the strings case mapping methods |
197 */ | 219 */ |
198 @Test | 220 @Test |
199 public void TestUpper() | 221 public void TestUpper() |
200 { | 222 { |
201 // uppercase with root locale and in the same buffer | 223 // uppercase with root locale and in the same buffer |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1611 } | 1633 } |
1612 } | 1634 } |
1613 int size = v.size(); | 1635 int size = v.size(); |
1614 String result[] = new String[size]; | 1636 String result[] = new String[size]; |
1615 for (int i = 0; i < size; i ++) { | 1637 for (int i = 0; i < size; i ++) { |
1616 result[i] = v.get(i); | 1638 result[i] = v.get(i); |
1617 } | 1639 } |
1618 return result; | 1640 return result; |
1619 } | 1641 } |
1620 } | 1642 } |
LEFT | RIGHT |