Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/intl/general/case-mapping.js

Issue 2533983006: Optimize case conversion with icu_case_mapping (Closed)
Patch Set: update comments with TODO Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/runtime/runtime-i18n.cc ('K') | « src/v8.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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());
55 assertEquals("ABCÀCSSA", "abcàcßa".toUpperCase());
56 assertEquals("ABCDEFGHIÀCSSA", "ABCDEFGHIàcßa".toUpperCase());
57 assertEquals("ABCDEFGHIÀCSSA", "abcdeFghiàcßa".toUpperCase());
58
36 // OneByte input with buffer size increase: non-fast path 59 // OneByte input with buffer size increase: non-fast path
37 assertEquals("ABCSS", "abCß".toLocaleUpperCase("tr")); 60 assertEquals("ABCSS", "abCß".toLocaleUpperCase("tr"));
38 61
39 // More comprehensive tests for "tr", "az" and "lt" are in 62 // More comprehensive tests for "tr", "az" and "lt" are in
40 // test262/intl402/Strings/* 63 // test262/intl402/Strings/*
41 64
42 // Buffer size decrease with a single locale or locale list. 65 // Buffer size decrease with a single locale or locale list.
43 // In Turkic (tr, az), U+0307 preceeded by Capital Letter I is dropped. 66 // In Turkic (tr, az), U+0307 preceeded by Capital Letter I is dropped.
44 assertEquals("abci", "aBcI\u0307".toLocaleLowerCase("tr")); 67 assertEquals("abci", "aBcI\u0307".toLocaleLowerCase("tr"));
45 assertEquals("abci", "aBcI\u0307".toLocaleLowerCase("az")); 68 assertEquals("abci", "aBcI\u0307".toLocaleLowerCase("az"));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("tr")); 180 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("tr"));
158 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("az")); 181 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("az"));
159 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("az")); 182 assertEquals(latin1SupplLowercased, latin1Suppl.toLocaleLowerCase("az"));
160 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("lt")); 183 assertEquals(latin1SupplUppercased, latin1Suppl.toLocaleUpperCase("lt"));
161 // Lithuanian need to have a dot-above for U+00CC(Ì) and U+00CD(Í) when 184 // Lithuanian need to have a dot-above for U+00CC(Ì) and U+00CD(Í) when
162 // lowercasing. 185 // lowercasing.
163 assertEquals("\u00A0¡¢£¤¥¦§¨©ª«¬\u00AD®°±²³´µ¶·¸¹º»¼½¾¿" + 186 assertEquals("\u00A0¡¢£¤¥¦§¨©ª«¬\u00AD®°±²³´µ¶·¸¹º»¼½¾¿" +
164 "àáâãäåæçèéêëi\u0307\u0300i\u0307\u0301îïðñòóôõö×øùúûüýþß" + 187 "àáâãäåæçèéêëi\u0307\u0300i\u0307\u0301îïðñòóôõö×øùúûüýþß" +
165 "àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ", 188 "àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
166 latin1Suppl.toLocaleLowerCase("lt")); 189 latin1Suppl.toLocaleLowerCase("lt"));
OLDNEW
« src/runtime/runtime-i18n.cc ('K') | « src/v8.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698