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

Side by Side Diff: test/ignore_ascii_case_test.dart

Issue 2484163002: Fix bug in equalsIgnoreAsciiCase. (Closed)
Patch Set: Address comments Created 4 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 unified diff | Download patch
« no previous file with comments | « pubspec.yaml ('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
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Tests case-ignoring compare and equality.
6
7 import "package:collection/collection.dart";
8 import "package:test/test.dart";
9
10 main() {
11 test("equality ignore ASCII case", () {
12 var strings = [
13 "0@`aopz[{",
14 "0@`aopz[{",
15 "0@`Aopz[{",
16 "0@`aOpz[{",
17 "0@`AOpz[{",
18 "0@`aoPz[{",
19 "0@`AoPz[{",
20 "0@`aOPz[{",
21 "0@`AOPz[{",
22 "0@`aopZ[{",
23 "0@`AopZ[{",
24 "0@`aOpZ[{",
25 "0@`AOpZ[{",
26 "0@`aoPZ[{",
27 "0@`AoPZ[{",
28 "0@`aOPZ[{",
29 "0@`AOPZ[{",
30 ];
31
32 for (var s1 in strings) {
33 for (var s2 in strings) {
34 var reason = "$s1 =?= $s2";
35 expect(equalsIgnoreAsciiCase(s1, s2), true, reason: reason);
36 expect(hashIgnoreAsciiCase(s1), hashIgnoreAsciiCase(s2),
37 reason: reason);
38 }
39 }
40
41 var upperCaseLetters = "@`abcdefghijklmnopqrstuvwxyz[{åÅ";
42 var lowerCaseLetters = "@`ABCDEFGHIJKLMNOPQRSTUVWXYZ[{åÅ";
43 expect(equalsIgnoreAsciiCase(upperCaseLetters, lowerCaseLetters), true);
44
45 testChars(char1, char2, areEqual) {
46 expect(equalsIgnoreAsciiCase(char1, char2), areEqual,
47 reason: "$char1 ${areEqual ? "=" : "!"}= $char2");
48 }
49 for (int i = 0; i < upperCaseLetters.length; i++) {
50 for (int j = 0; i < upperCaseLetters.length; i++) {
51 testChars(upperCaseLetters[i], upperCaseLetters[j], i == j);
52 testChars(lowerCaseLetters[i], upperCaseLetters[j], i == j);
53 testChars(upperCaseLetters[i], lowerCaseLetters[j], i == j);
54 testChars(lowerCaseLetters[i], lowerCaseLetters[j], i == j);
55 }
56 }
57 });
58 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698