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

Unified Diff: packages/collection/test/ignore_ascii_case_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/collection/test/functions_test.dart ('k') | packages/collection/test/iterable_zip_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/collection/test/ignore_ascii_case_test.dart
diff --git a/packages/collection/test/ignore_ascii_case_test.dart b/packages/collection/test/ignore_ascii_case_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6aee4557db5b45c671f7afdf970b2dce79c1d537
--- /dev/null
+++ b/packages/collection/test/ignore_ascii_case_test.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Tests case-ignoring compare and equality.
+
+import "package:collection/collection.dart";
+import "package:test/test.dart";
+
+main() {
+ test("equality ignore ASCII case", () {
+ var strings = [
+ "0@`aopz[{",
+ "0@`aopz[{",
+ "0@`Aopz[{",
+ "0@`aOpz[{",
+ "0@`AOpz[{",
+ "0@`aoPz[{",
+ "0@`AoPz[{",
+ "0@`aOPz[{",
+ "0@`AOPz[{",
+ "0@`aopZ[{",
+ "0@`AopZ[{",
+ "0@`aOpZ[{",
+ "0@`AOpZ[{",
+ "0@`aoPZ[{",
+ "0@`AoPZ[{",
+ "0@`aOPZ[{",
+ "0@`AOPZ[{",
+ ];
+
+ for (var s1 in strings) {
+ for (var s2 in strings) {
+ var reason = "$s1 =?= $s2";
+ expect(equalsIgnoreAsciiCase(s1, s2), true, reason: reason);
+ expect(hashIgnoreAsciiCase(s1), hashIgnoreAsciiCase(s2),
+ reason: reason);
+ }
+ }
+
+ var upperCaseLetters = "@`abcdefghijklmnopqrstuvwxyz[{åÅ";
+ var lowerCaseLetters = "@`ABCDEFGHIJKLMNOPQRSTUVWXYZ[{åÅ";
+ expect(equalsIgnoreAsciiCase(upperCaseLetters, lowerCaseLetters), true);
+
+ testChars(char1, char2, areEqual) {
+ expect(equalsIgnoreAsciiCase(char1, char2), areEqual,
+ reason: "$char1 ${areEqual ? "=" : "!"}= $char2");
+ }
+
+ for (int i = 0; i < upperCaseLetters.length; i++) {
+ for (int j = 0; i < upperCaseLetters.length; i++) {
+ testChars(upperCaseLetters[i], upperCaseLetters[j], i == j);
+ testChars(lowerCaseLetters[i], upperCaseLetters[j], i == j);
+ testChars(upperCaseLetters[i], lowerCaseLetters[j], i == j);
+ testChars(lowerCaseLetters[i], lowerCaseLetters[j], i == j);
+ }
+ }
+ });
+}
« no previous file with comments | « packages/collection/test/functions_test.dart ('k') | packages/collection/test/iterable_zip_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698