mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 09:43:08 +00:00
998dd24dcc
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 .
31 lines
1.1 KiB
Dart
31 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));
|
|
}
|