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

Unified Diff: tests/language/comparison_test.dart

Issue 3002573002: Migrating another batch of tests to dart 2. (Closed)
Patch Set: Removed library closure_type_test from test_file Created 3 years, 4 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 | « tests/language/code_motion_crash_test.dart ('k') | tests/language/compile_time_constant10_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/comparison_test.dart
diff --git a/tests/language/comparison_test.dart b/tests/language/comparison_test.dart
deleted file mode 100644
index 59d700563d9e098bda97b77e7be63e3c637d0138..0000000000000000000000000000000000000000
--- a/tests/language/comparison_test.dart
+++ /dev/null
@@ -1,325 +0,0 @@
-// Copyright (c) 2011, 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.
-// Dart test program for testing comparison operators.
-
-import "package:expect/expect.dart";
-
-class Helper {
- static bool STRICT_EQ(a, b) {
- return identical(a, b);
- }
-
- static bool STRICT_NE(a, b) {
- return !identical(a, b);
- }
-
- static bool EQ(a, b) {
- return a == b;
- }
-
- static bool NE(a, b) {
- return a != b;
- }
-
- static bool LT(a, b) {
- return a < b;
- }
-
- static bool LE(a, b) {
- return a <= b;
- }
-
- static bool GT(a, b) {
- return a > b;
- }
-
- static bool GE(a, b) {
- return a >= b;
- }
-}
-
-class A {
- var b;
-
- A(x) : b = x {}
-}
-
-class ComparisonTest {
- static testMain() {
- var a = new A(0);
- var b = new A(1);
- Expect.isTrue(Helper.STRICT_EQ(a, a));
- Expect.isFalse(Helper.STRICT_EQ(a, b));
- Expect.isFalse(Helper.STRICT_EQ(b, a));
- Expect.isTrue(Helper.STRICT_EQ(b, b));
-
- Expect.isFalse(Helper.STRICT_NE(a, a));
- Expect.isTrue(Helper.STRICT_NE(a, b));
- Expect.isTrue(Helper.STRICT_NE(b, a));
- Expect.isFalse(Helper.STRICT_NE(b, b));
-
- Expect.isTrue(Helper.STRICT_EQ(false, false));
- Expect.isFalse(Helper.STRICT_EQ(false, true));
- Expect.isFalse(Helper.STRICT_EQ(true, false));
- Expect.isTrue(Helper.STRICT_EQ(true, true));
-
- Expect.isFalse(Helper.STRICT_NE(false, false));
- Expect.isTrue(Helper.STRICT_NE(false, true));
- Expect.isTrue(Helper.STRICT_NE(true, false));
- Expect.isFalse(Helper.STRICT_NE(true, true));
-
- Expect.isTrue(Helper.STRICT_EQ(false, false));
- Expect.isFalse(Helper.STRICT_EQ(false, true));
- Expect.isFalse(Helper.STRICT_EQ(true, false));
- Expect.isTrue(Helper.STRICT_EQ(true, true));
-
- Expect.isFalse(Helper.STRICT_NE(false, false));
- Expect.isTrue(Helper.STRICT_NE(false, true));
- Expect.isTrue(Helper.STRICT_NE(true, false));
- Expect.isFalse(Helper.STRICT_NE(true, true));
-
- Expect.isTrue(Helper.EQ(false, false));
- Expect.isFalse(Helper.EQ(false, true));
- Expect.isFalse(Helper.EQ(true, false));
- Expect.isTrue(Helper.EQ(true, true));
-
- Expect.isFalse(Helper.NE(false, false));
- Expect.isTrue(Helper.NE(false, true));
- Expect.isTrue(Helper.NE(true, false));
- Expect.isFalse(Helper.NE(true, true));
-
- Expect.isTrue(Helper.STRICT_EQ(-1, -1));
- Expect.isTrue(Helper.STRICT_EQ(0, 0));
- Expect.isTrue(Helper.STRICT_EQ(1, 1));
- Expect.isFalse(Helper.STRICT_EQ(-1, 0));
- Expect.isFalse(Helper.STRICT_EQ(-1, 1));
- Expect.isFalse(Helper.STRICT_EQ(0, 1));
-
- Expect.isFalse(Helper.STRICT_NE(-1, -1));
- Expect.isFalse(Helper.STRICT_NE(0, 0));
- Expect.isFalse(Helper.STRICT_NE(1, 1));
- Expect.isTrue(Helper.STRICT_NE(-1, 0));
- Expect.isTrue(Helper.STRICT_NE(-1, 1));
- Expect.isTrue(Helper.STRICT_NE(0, 1));
-
- Expect.isTrue(Helper.EQ(-1, -1));
- Expect.isTrue(Helper.EQ(0, 0));
- Expect.isTrue(Helper.EQ(1, 1));
- Expect.isFalse(Helper.EQ(-1, 0));
- Expect.isFalse(Helper.EQ(-1, 1));
- Expect.isFalse(Helper.EQ(0, 1));
-
- Expect.isFalse(Helper.NE(-1, -1));
- Expect.isFalse(Helper.NE(0, 0));
- Expect.isFalse(Helper.NE(1, 1));
- Expect.isTrue(Helper.NE(-1, 0));
- Expect.isTrue(Helper.NE(-1, 1));
- Expect.isTrue(Helper.NE(0, 1));
-
- Expect.isFalse(Helper.LT(-1, -1));
- Expect.isFalse(Helper.LT(0, 0));
- Expect.isFalse(Helper.LT(1, 1));
- Expect.isTrue(Helper.LT(-1, 0));
- Expect.isTrue(Helper.LT(-1, 1));
- Expect.isTrue(Helper.LT(0, 1));
- Expect.isFalse(Helper.LT(0, -1));
- Expect.isFalse(Helper.LT(1, -1));
- Expect.isFalse(Helper.LT(1, 0));
-
- Expect.isTrue(Helper.LE(-1, -1));
- Expect.isTrue(Helper.LE(0, 0));
- Expect.isTrue(Helper.LE(1, 1));
- Expect.isTrue(Helper.LE(-1, 0));
- Expect.isTrue(Helper.LE(-1, 1));
- Expect.isTrue(Helper.LE(0, 1));
- Expect.isFalse(Helper.LE(0, -1));
- Expect.isFalse(Helper.LE(1, -1));
- Expect.isFalse(Helper.LE(1, 0));
-
- Expect.isFalse(Helper.GT(-1, -1));
- Expect.isFalse(Helper.GT(0, 0));
- Expect.isFalse(Helper.GT(1, 1));
- Expect.isFalse(Helper.GT(-1, 0));
- Expect.isFalse(Helper.GT(-1, 1));
- Expect.isFalse(Helper.GT(0, 1));
- Expect.isTrue(Helper.GT(0, -1));
- Expect.isTrue(Helper.GT(1, -1));
- Expect.isTrue(Helper.GT(1, 0));
-
- Expect.isTrue(Helper.GE(-1, -1));
- Expect.isTrue(Helper.GE(0, 0));
- Expect.isTrue(Helper.GE(1, 1));
- Expect.isFalse(Helper.GE(-1, 0));
- Expect.isFalse(Helper.GE(-1, 1));
- Expect.isFalse(Helper.GE(0, 1));
- Expect.isTrue(Helper.GE(0, -1));
- Expect.isTrue(Helper.GE(1, -1));
- Expect.isTrue(Helper.GE(1, 0));
-
- Expect.isTrue(Helper.STRICT_EQ(-1.0, -1.0));
- Expect.isTrue(Helper.STRICT_EQ(0.0, 0.0));
- Expect.isTrue(Helper.STRICT_EQ(1.0, 1.0));
- Expect.isFalse(Helper.STRICT_EQ(-1.0, 0.0));
- Expect.isFalse(Helper.STRICT_EQ(-1.0, 1.0));
- Expect.isFalse(Helper.STRICT_EQ(0.0, 1.0));
-
- Expect.isFalse(Helper.STRICT_NE(-1.0, -1.0));
- Expect.isFalse(Helper.STRICT_NE(0.0, 0.0));
- Expect.isFalse(Helper.STRICT_NE(1.0, 1.0));
- Expect.isTrue(Helper.STRICT_NE(-1.0, 0.0));
- Expect.isTrue(Helper.STRICT_NE(-1.0, 1.0));
- Expect.isTrue(Helper.STRICT_NE(0.0, 1.0));
-
- Expect.isTrue(Helper.EQ(-1.0, -1.0));
- Expect.isTrue(Helper.EQ(0.0, 0.0));
- Expect.isTrue(Helper.EQ(1.0, 1.0));
- Expect.isFalse(Helper.EQ(-1.0, 0.0));
- Expect.isFalse(Helper.EQ(-1.0, 1.0));
- Expect.isFalse(Helper.EQ(0.0, 1.0));
-
- Expect.isFalse(Helper.NE(-1.0, -1.0));
- Expect.isFalse(Helper.NE(0.0, 0.0));
- Expect.isFalse(Helper.NE(1.0, 1.0));
- Expect.isTrue(Helper.NE(-1.0, 0.0));
- Expect.isTrue(Helper.NE(-1.0, 1.0));
- Expect.isTrue(Helper.NE(0.0, 1.0));
-
- Expect.isFalse(Helper.LT(-1.0, -1.0));
- Expect.isFalse(Helper.LT(0.0, 0.0));
- Expect.isFalse(Helper.LT(1.0, 1.0));
- Expect.isTrue(Helper.LT(-1.0, 0.0));
- Expect.isTrue(Helper.LT(-1.0, 1.0));
- Expect.isTrue(Helper.LT(0.0, 1.0));
- Expect.isFalse(Helper.LT(0.0, -1.0));
- Expect.isFalse(Helper.LT(1.0, -1.0));
- Expect.isFalse(Helper.LT(1.0, 0.0));
-
- Expect.isTrue(Helper.LE(-1.0, -1.0));
- Expect.isTrue(Helper.LE(0.0, 0.0));
- Expect.isTrue(Helper.LE(1.0, 1.0));
- Expect.isTrue(Helper.LE(-1.0, 0.0));
- Expect.isTrue(Helper.LE(-1.0, 1.0));
- Expect.isTrue(Helper.LE(0.0, 1.0));
- Expect.isFalse(Helper.LE(0.0, -1.0));
- Expect.isFalse(Helper.LE(1.0, -1.0));
- Expect.isFalse(Helper.LE(1.0, 0.0));
-
- Expect.isFalse(Helper.GT(-1.0, -1.0));
- Expect.isFalse(Helper.GT(0.0, 0.0));
- Expect.isFalse(Helper.GT(1.0, 1.0));
- Expect.isFalse(Helper.GT(-1.0, 0.0));
- Expect.isFalse(Helper.GT(-1.0, 1.0));
- Expect.isFalse(Helper.GT(0.0, 1.0));
- Expect.isTrue(Helper.GT(0.0, -1.0));
- Expect.isTrue(Helper.GT(1.0, -1.0));
- Expect.isTrue(Helper.GT(1.0, 0.0));
-
- Expect.isTrue(Helper.GE(-1.0, -1.0));
- Expect.isTrue(Helper.GE(0.0, 0.0));
- Expect.isTrue(Helper.GE(1.0, 1.0));
- Expect.isFalse(Helper.GE(-1.0, 0.0));
- Expect.isFalse(Helper.GE(-1.0, 1.0));
- Expect.isFalse(Helper.GE(0.0, 1.0));
- Expect.isTrue(Helper.GE(0.0, -1.0));
- Expect.isTrue(Helper.GE(1.0, -1.0));
- Expect.isTrue(Helper.GE(1.0, 0.0));
-
- Expect.isTrue(Helper.EQ(null, null));
- Expect.isFalse(Helper.EQ(null, "Str"));
- Expect.isTrue(Helper.NE(null, 2));
- Expect.isFalse(Helper.NE(null, null));
-
- Expect.isTrue(Helper.STRICT_EQ(null, null));
- Expect.isFalse(Helper.STRICT_EQ(null, "Str"));
- Expect.isTrue(Helper.STRICT_NE(null, 2));
- Expect.isFalse(Helper.STRICT_NE(null, null));
-
- Expect.isFalse(Helper.GT(1, 1.2));
- Expect.isTrue(Helper.GT(3, 1.2));
- Expect.isTrue(Helper.GT(2.0, 1));
- Expect.isFalse(Helper.GT(3.1, 4));
-
- Expect.isFalse(Helper.GE(1, 1.2));
- Expect.isTrue(Helper.GE(3, 1.2));
- Expect.isTrue(Helper.GE(2.0, 1));
- Expect.isFalse(Helper.GE(3.1, 4));
- Expect.isTrue(Helper.GE(2.0, 2));
- Expect.isTrue(Helper.GE(2, 2.0));
-
- Expect.isTrue(Helper.LT(1, 1.2));
- Expect.isFalse(Helper.LT(3, 1.2));
- Expect.isFalse(Helper.LT(2.0, 1));
- Expect.isTrue(Helper.LT(3.1, 4));
-
- Expect.isTrue(Helper.LE(1, 1.2));
- Expect.isFalse(Helper.LE(3, 1.2));
- Expect.isFalse(Helper.LE(2.0, 1));
- Expect.isTrue(Helper.LE(3.1, 4));
- Expect.isTrue(Helper.LE(2.0, 2));
- Expect.isTrue(Helper.LE(2, 2.0));
-
- // Bignums.
- Expect.isTrue(Helper.LE(0xF00000000005, 0xF00000000006));
- Expect.isTrue(Helper.LE(0xF00000000005, 0xF00000000005));
- Expect.isFalse(Helper.LE(0xF00000000006, 0xF00000000005));
- Expect.isTrue(Helper.LE(12, 0xF00000000005));
- Expect.isTrue(Helper.LE(12.2, 0xF00000000005));
-
- Expect.isTrue(Helper.EQ(4294967295, 4.294967295e9));
- Expect.isTrue(Helper.EQ(4.294967295e9, 4294967295));
- Expect.isFalse(Helper.EQ(4.294967295e9, 42));
- Expect.isFalse(Helper.EQ(42, 4.294967295e9));
- Expect.isFalse(Helper.EQ(4294967295, 42));
- Expect.isFalse(Helper.EQ(42, 4294967295));
-
- // Fractions & mixed
- Expect.isTrue(Helper.EQ(1.0, 1));
- Expect.isTrue(Helper.EQ(1.0, 1));
- Expect.isTrue(Helper.EQ(1, 1.0));
- Expect.isTrue(Helper.EQ(1, 1.0));
- Expect.isTrue(Helper.EQ(1.1, 1.1));
- Expect.isTrue(Helper.EQ(1.1, 1.1));
- Expect.isTrue(Helper.EQ(1.1, 1.1));
-
- Expect.isFalse(Helper.GT(1, 1.2));
- Expect.isTrue(Helper.GT(1.2, 1));
- Expect.isTrue(Helper.GT(1.2, 1.1));
- Expect.isTrue(Helper.GT(1.2, 1.1));
- Expect.isTrue(Helper.GT(1.2, 1.1));
-
- Expect.isTrue(Helper.LT(1, 1.2));
- Expect.isFalse(Helper.LT(1.2, 1));
- Expect.isFalse(Helper.LT(1.2, 1.1));
- Expect.isFalse(Helper.LT(1.2, 1.1));
- Expect.isFalse(Helper.LT(1.2, 1.1));
-
- Expect.isFalse(Helper.GE(1.1, 1.2));
- Expect.isFalse(Helper.GE(1.1, 1.2));
- Expect.isTrue(Helper.GE(1.2, 1.2));
- Expect.isTrue(Helper.GE(1.2, 1.2));
-
- // With non-number classes.
- Expect.isFalse(Helper.EQ(1, "eeny"));
- Expect.isFalse(Helper.EQ("meeny", 1));
- Expect.isFalse(Helper.EQ(1.1, "miny"));
- Expect.isFalse(Helper.EQ("moe", 1.1));
- Expect.isFalse(Helper.EQ(1.1, "catch"));
- Expect.isFalse(Helper.EQ("the", 1.1));
-
- // With null.
- Expect.isFalse(Helper.EQ(1, null));
- Expect.isFalse(Helper.EQ(null, 1));
- Expect.isFalse(Helper.EQ(1.1, null));
- Expect.isFalse(Helper.EQ(null, 1.1));
- Expect.isFalse(Helper.EQ(1.1, null));
- Expect.isFalse(Helper.EQ(null, 1.1));
-
- // TODO(srdjan): Clarify behaviour of greater/less comparisons
- // between numbers and non-numbers.
- }
-}
-
-main() {
- ComparisonTest.testMain();
-}
« no previous file with comments | « tests/language/code_motion_crash_test.dart ('k') | tests/language/compile_time_constant10_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698