blob: d4c029f2e30da8bd82b79b6b77afb5f4dae155bf [file] [log] [blame]
// 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.
/// @assertion Duration difference(DateTime other)
/// Returns a [Duration] with the difference of [:this:] and [other]
/// @description Checks that the method returns Duration instance
/// @author hlodvig
import "../../../Utils/expect.dart";
main() {
Expect.isTrue(new DateTime.now().difference(new DateTime.now()) is Duration);
Expect.isTrue(new DateTime.fromMillisecondsSinceEpoch(0)
.difference(new DateTime.fromMillisecondsSinceEpoch(1000)) is Duration);
Expect.isTrue(new DateTime.fromMillisecondsSinceEpoch(0)
.difference(new DateTime.fromMillisecondsSinceEpoch(-1000)) is Duration);
Expect.isTrue(new DateTime.fromMillisecondsSinceEpoch(1000)
.difference(new DateTime.fromMillisecondsSinceEpoch(0)) is Duration);
Expect.isTrue(new DateTime.fromMillisecondsSinceEpoch(1000)
.difference(new DateTime.fromMillisecondsSinceEpoch(0)) is Duration);
Expect.isTrue(new DateTime.fromMillisecondsSinceEpoch(0)
.difference(new DateTime.fromMillisecondsSinceEpoch(1000)) is Duration);
Expect.runtimeIsType<Duration>(
new DateTime.now().difference(new DateTime.now()));
Expect.runtimeIsType<Duration>(new DateTime.fromMillisecondsSinceEpoch(0)
.difference(new DateTime.fromMillisecondsSinceEpoch(1000)));
Expect.runtimeIsType<Duration>(new DateTime.fromMillisecondsSinceEpoch(0)
.difference(new DateTime.fromMillisecondsSinceEpoch(-1000)));
Expect.runtimeIsType<Duration>(new DateTime.fromMillisecondsSinceEpoch(1000)
.difference(new DateTime.fromMillisecondsSinceEpoch(0)));
Expect.runtimeIsType<Duration>(new DateTime.fromMillisecondsSinceEpoch(1000)
.difference(new DateTime.fromMillisecondsSinceEpoch(0)));
Expect.runtimeIsType<Duration>(new DateTime.fromMillisecondsSinceEpoch(0)
.difference(new DateTime.fromMillisecondsSinceEpoch(1000)));
}