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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/duration.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 main() { 7 main() {
8 Duration d; 8 Duration d;
9 d = new Duration(days: 1); 9 d = new Duration(days: 1);
10 Expect.equals(86400000000, d.inMicroseconds); 10 Expect.equals(86400000000, d.inMicroseconds);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 Expect.equals("0:00:00.099999", d.toString()); 260 Expect.equals("0:00:00.099999", d.toString());
261 261
262 d = const Duration(microseconds: 100000); 262 d = const Duration(microseconds: 100000);
263 Expect.equals("0:00:00.100000", d.toString()); 263 Expect.equals("0:00:00.100000", d.toString());
264 264
265 d = const Duration(microseconds: 999999); 265 d = const Duration(microseconds: 999999);
266 Expect.equals("0:00:00.999999", d.toString()); 266 Expect.equals("0:00:00.999999", d.toString());
267 267
268 d = const Duration(microseconds: 1000000); 268 d = const Duration(microseconds: 1000000);
269 Expect.equals("0:00:01.000000", d.toString()); 269 Expect.equals("0:00:01.000000", d.toString());
270
271 d1 = const Duration(hours: 1);
272 d2 = const Duration(hours: -1);
273 Expect.isFalse(d1.isNegative);
274 Expect.isTrue(d2.isNegative);
275 Expect.equals(d1, d1.abs());
276 Expect.equals(d1, d2.abs());
277
278 Expect.equals(d2, -d1);
279 Expect.equals(d1, -d2);
270 } 280 }
OLDNEW
« 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