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

Unified Diff: tests/corelib/duration_test.dart

Issue 431263004: Adding Duration documentation, abs(), and isNegative() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding unary-, and better text as per lrn@ Created 6 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 | « sdk/lib/core/duration.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/duration_test.dart
diff --git a/tests/corelib/duration_test.dart b/tests/corelib/duration_test.dart
index 306873db87ef2adb7654a70cdc2062c7475f4f5d..028d9d4008dd009df88a45b759ca826a230ad199 100644
--- a/tests/corelib/duration_test.dart
+++ b/tests/corelib/duration_test.dart
@@ -267,4 +267,14 @@ main() {
d = const Duration(microseconds: 1000000);
Expect.equals("0:00:01.000000", d.toString());
+
+ d1 = const Duration(hours: 1);
+ d2 = const Duration(hours: -1);
+ Expect.isFalse(d1.isNegative);
+ Expect.isTrue(d2.isNegative);
+ Expect.equals(d1, d1.abs());
+ Expect.equals(d1, d2.abs());
+
+ Expect.equals(d2, -d1);
+ Expect.equals(d1, -d2);
}
« no previous file with comments | « sdk/lib/core/duration.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698