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

Unified Diff: test/cctest/test-regexp.cc

Issue 12638: Fixed uncanonicalization inconsistency. (Closed)
Patch Set: Created 12 years, 1 month 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 | « src/unicode.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-regexp.cc
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
index 8b1dd4f9d737111339703073378de4a3226cb35a..a2a2bbb6a5d177a146e1f21701ab98d63cb9de88 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -1086,7 +1086,10 @@ TEST(RangeCanonicalization) {
unibrow::uchar first[unibrow::Ecma262UnCanonicalize::kMaxWidth];
int first_length = un_canonicalize.get(next_block, '\0', first);
for (unsigned i = 1; i < dist; i++) {
- CHECK_EQ(i, CanonRange(i));
+ uc32 i_range = CanonRange(next_block + i);
+ if (next_block + i == 880)
Erik Corry 2008/11/25 18:24:51 I don't understand this change.
Christian Plesner Hansen 2008/11/26 06:03:45 That was a mistake.
+ CanonRange(next_block + i);
+ CHECK_EQ(i, i_range);
unibrow::uchar succ[unibrow::Ecma262UnCanonicalize::kMaxWidth];
int succ_length = un_canonicalize.get(next_block + i, '\0', succ);
CHECK_EQ(first_length, succ_length);
@@ -1101,6 +1104,22 @@ TEST(RangeCanonicalization) {
}
+TEST(UncanonicalizeEquivalence) {
+ unibrow::Mapping<unibrow::Ecma262UnCanonicalize> un_canonicalize;
+ unibrow::uchar chars[unibrow::Ecma262UnCanonicalize::kMaxWidth];
+ for (int i = 0; i < (1 << 16); i++) {
+ int length = un_canonicalize.get(i, '\0', chars);
+ for (int j = 0; j < length; j++) {
+ unibrow::uchar chars2[unibrow::Ecma262UnCanonicalize::kMaxWidth];
+ int length2 = un_canonicalize.get(chars[j], '\0', chars2);
+ CHECK_EQ(length, length2);
+ for (int k = 0; k < length; k++)
+ CHECK_EQ(static_cast<int>(chars[k]), static_cast<int>(chars2[k]));
+ }
+ }
+}
+
+
static void TestRangeCaseIndependence(CharacterRange input,
Vector<CharacterRange> expected) {
ZoneScope zone_scope(DELETE_ON_EXIT);
« no previous file with comments | « src/unicode.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698