OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --icu_case_mapping | 5 // Flags: --icu_case_mapping |
6 | 6 |
7 // Some edge cases that unibrow got wrong | 7 // Some edge cases that unibrow got wrong |
8 | 8 |
9 assertEquals("𐐘", "𐑀".toUpperCase()); | 9 assertEquals("𐐘", "𐑀".toUpperCase()); |
10 assertEquals("𐑀", "𐐘".toLowerCase()); | 10 assertEquals("𐑀", "𐐘".toLowerCase()); |
11 assertEquals("σ", "Σ".toLowerCase()); | 11 assertEquals("σ", "Σ".toLowerCase()); |
12 | 12 |
13 // Some different paths in the ICU case conversion fastpath | 13 // Some different paths in the ICU case conversion fastpath |
14 | 14 |
15 assertEquals("σς", "\u03A3\u03A3".toLowerCase()); | 15 assertEquals("σς", "\u03A3\u03A3".toLowerCase()); |
16 // Expand sharp s in latin1 fastpath | 16 // Expand sharp s in latin1 fastpath |
17 assertEquals("ASSB", "A\u00DFB".toUpperCase()); | 17 assertEquals("ASSB", "A\u00DFB".toUpperCase()); |
18 assertEquals("AB", "Ab".toUpperCase()); | 18 assertEquals("AB", "Ab".toUpperCase()); |
19 // Find first upper case in fastpath | 19 // Find first uppercase in fastpath |
| 20 // Input length < a machine word size |
| 21 assertEquals("ab", "ab".toLowerCase()); |
20 assertEquals("ab", "aB".toLowerCase()); | 22 assertEquals("ab", "aB".toLowerCase()); |
21 assertEquals("AÜ", "aü".toUpperCase()); | 23 assertEquals("AÜ", "aü".toUpperCase()); |
22 assertEquals("AÜ", "AÜ".toUpperCase()); | 24 assertEquals("AÜ", "AÜ".toUpperCase()); |
23 assertEquals("aü", "aü".toLowerCase()); | 25 assertEquals("aü", "aü".toLowerCase()); |
| 26 assertEquals("aü", "aÜ".toLowerCase()); |
24 assertEquals("aü", "AÜ".toLowerCase()); | 27 assertEquals("aü", "AÜ".toLowerCase()); |
25 assertEquals("aü", "AÜ".toLowerCase()); | 28 assertEquals("aü", "AÜ".toLowerCase()); |
26 | 29 |
| 30 // Input length >= a machine word size |
| 31 assertEquals("abcdefghij", "abcdefghij".toLowerCase()); |
| 32 assertEquals("abcdefghij", "abcdefghiJ".toLowerCase()); |
| 33 assertEquals("abçdefghij", "abçdefghiJ".toLowerCase()); |
| 34 assertEquals("abçdefghij", "abÇdefghiJ".toLowerCase()); |
| 35 assertEquals("abcdefghiá", "abcdeFghiá".toLowerCase()); |
| 36 assertEquals("abcdefghiá", "abcdeFghiÁ".toLowerCase()); |
| 37 |
| 38 assertEquals("ABCDEFGHIJ", "ABCDEFGHIJ".toUpperCase()); |
| 39 assertEquals("ABCDEFGHIJ", "ABCDEFGHIj".toUpperCase()); |
| 40 assertEquals("ABÇDEFGHIJ", "ABÇDEFGHIj".toUpperCase()); |
| 41 assertEquals("ABÇDEFGHIJ", "ABçDEFGHIj".toUpperCase()); |
| 42 assertEquals("ABCDEFGHIÁ", "ABCDEfGHIÁ".toUpperCase()); |
| 43 assertEquals("ABCDEFGHIÁ", "ABCDEfGHIá".toUpperCase()); |
| 44 |
| 45 |
27 // Starts with fastpath, but switches to full Unicode path | 46 // Starts with fastpath, but switches to full Unicode path |
28 // U+00FF is uppercased to U+0178. | 47 // U+00FF is uppercased to U+0178. |
29 assertEquals("AŸ", "aÿ".toUpperCase()); | 48 assertEquals("AŸ", "aÿ".toUpperCase()); |
30 // U+00B5 (µ) is uppercased to U+039C (Μ) | 49 // U+00B5 (µ) is uppercased to U+039C (Μ) |
31 assertEquals("AΜ", "aµ".toUpperCase()); | 50 assertEquals("AΜ", "aµ".toUpperCase()); |
32 | 51 |
33 // Buffer size increase | 52 // Buffer size increase |
34 assertEquals("CSSBẶ", "cßbặ".toUpperCase()); | 53 assertEquals("CSSBẶ", "cßbặ".toUpperCase()); |
35 assertEquals("FIFLFFIFFL", "\uFB01\uFB02\uFB03\uFB04".toUpperCase()); | 54 assertEquals("FIFLFFIFFL", "\uFB01\uFB02\uFB03\uFB04".toUpperCase()); |
36 // OneByte input with buffer size increase: non-fast path | 55 // OneByte input with buffer size increase: non-fast path |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("tr")); | 176 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("tr")); |
158 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("az")); | 177 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("az")); |
159 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("az")); | 178 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("az")); |
160 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("lt")); | 179 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("lt")); |
161 // Lithuanian need to have a dot-above for U+00CC(Ì) and U+00CD(Í) when | 180 // Lithuanian need to have a dot-above for U+00CC(Ì) and U+00CD(Í) when |
162 // lowercasing. | 181 // lowercasing. |
163 assertEquals("\u00A0¡¢£¤¥¦§¨©ª«¬\u00AD®°±²³´µ¶·¸¹º»¼½¾¿" + | 182 assertEquals("\u00A0¡¢£¤¥¦§¨©ª«¬\u00AD®°±²³´µ¶·¸¹º»¼½¾¿" + |
164 "àáâãäåæçèéêëi\u0307\u0300i\u0307\u0301îïðñòóôõö×øùúûüýþß" + | 183 "àáâãäåæçèéêëi\u0307\u0300i\u0307\u0301îïðñòóôõö×øùúûüýþß" + |
165 "àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ", | 184 "àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ", |
166 latin1Suppl.toLocaleLowerCase("lt")); | 185 latin1Suppl.toLocaleLowerCase("lt")); |
OLD | NEW |