dart-sdk/tests/corelib_2/date_time6_test.dart
Janice Collins 998dd24dcc Migrate test block 5 to Dart 2.0.
Unusual things in this block:
- date_time10_test.dart had no strong mode fork, and reveals what looks
like a legit DDC bug at first glance.  Excluded it for now in the status file.
- date_time_test.dart had small differences between the two forks that looked
like an error.  Fixed.

BUG=
R=bkonyi@google.com, rnystrom@google.com

Review-Url: https://codereview.chromium.org/2984063002 .
2017-07-24 14:18:58 -07:00

32 lines
1.1 KiB
Dart

// Copyright (c) 2012, 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.
import "package:expect/expect.dart";
// Test DateTime comparison operators.
main() {
var d = new DateTime.fromMillisecondsSinceEpoch(0, isUtc: true);
var d2 = new DateTime.fromMillisecondsSinceEpoch(1, isUtc: true);
Expect.isTrue(d.isBefore(d2));
Expect.isTrue(!d.isAfter(d2));
Expect.isTrue(d2.isAfter(d));
Expect.isTrue(!d2.isBefore(d));
Expect.isFalse(d2.isBefore(d));
Expect.isFalse(!d2.isAfter(d));
Expect.isFalse(d.isAfter(d2));
Expect.isFalse(!d.isBefore(d2));
d = new DateTime.fromMillisecondsSinceEpoch(-1, isUtc: true);
d2 = new DateTime.fromMillisecondsSinceEpoch(0, isUtc: true);
Expect.isTrue(d.isBefore(d2));
Expect.isTrue(!d.isAfter(d2));
Expect.isTrue(d2.isAfter(d));
Expect.isTrue(!d2.isBefore(d));
Expect.isFalse(d2.isBefore(d));
Expect.isFalse(!d2.isAfter(d));
Expect.isFalse(d.isAfter(d2));
Expect.isFalse(!d.isBefore(d2));
}