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

Unified Diff: test/mjsunit/regexp-sort.js

Issue 1204123003: Reland Extend big-disjunction optimization to case-independent regexps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Skip slow architecture-independent tests on slower CPUs and simulators Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/mjsunit/regress/regress-crbug-482998.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regexp-sort.js
diff --git a/test/mjsunit/regexp-sort.js b/test/mjsunit/regexp-sort.js
new file mode 100644
index 0000000000000000000000000000000000000000..57d50701cd5807f059704657ff40bd5a3c424fee
--- /dev/null
+++ b/test/mjsunit/regexp-sort.js
@@ -0,0 +1,48 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function Test(lower, upper) {
+ var lx = lower + "x";
+ var ux = upper + "x";
+ var lp = lower + "|";
+ var uxp = upper + "x|";
+ assertEquals(lx, new RegExp(uxp + lp + lower + "cat", "i").exec(lx) + "");
+ assertEquals(ux, new RegExp(uxp + lp + lower + "cat", "i").exec(ux) + "");
+ assertEquals(lower, new RegExp(lp + uxp + lower + "cat", "i").exec(lx) + "");
+ assertEquals(upper, new RegExp(lp + uxp + lower + "cat", "i").exec(ux) + "");
+}
+
+function TestFail(lower, upper) {
+ var lx = lower + "x";
+ var ux = upper + "x";
+ var lp = lower + "|";
+ var uxp = upper + "x|";
+ assertEquals(lower, new RegExp(uxp + lp + lower + "cat", "i").exec(lx) + "");
+ assertEquals(ux, new RegExp(uxp + lp + lower + "cat", "i").exec(ux) + "");
+ assertEquals(lower, new RegExp(lp + uxp + lower + "cat", "i").exec(lx) + "");
+ assertEquals(ux, new RegExp(lp + uxp + lower + "cat", "i").exec(ux) + "");
+}
+
+Test("a", "A");
+Test("0", "0");
+TestFail("a", "b");
+// Small and capital o-umlaut
+Test(String.fromCharCode(0xf6), String.fromCharCode(0xd6));
+// Small and capital kha.
+Test(String.fromCharCode(0x445), String.fromCharCode(0x425));
+// Small and capital y-umlaut.
+Test(String.fromCharCode(0xff), String.fromCharCode(0x178));
+// Small and large Greek mu.
+Test(String.fromCharCode(0x3bc), String.fromCharCode(0x39c));
+// Micron and large Greek mu.
+Test(String.fromCharCode(0xb5), String.fromCharCode(0x39c));
+// Micron and small Greek mu.
+Test(String.fromCharCode(0xb5), String.fromCharCode(0x3bc));
+// German double s and capital S. These are not equivalent since one is double.
+TestFail(String.fromCharCode(0xdf), "S");
+// Small i and Turkish capital dotted I. These are not equivalent due to
+// 21.2.2.8.2 section 3g. One is below 128 and the other is above 127.
+TestFail("i", String.fromCharCode(0x130));
+// Small dotless i and I. These are not equivalent either.
+TestFail(String.fromCharCode(0x131), "I");
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | test/mjsunit/regress/regress-crbug-482998.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698