OLD | NEW |
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"; | |
6 | |
7 main() { | 5 main() { |
8 Duration d; | 6 Duration d; |
9 d = new Duration(days: 1); | 7 d = new Duration(days: 1); |
10 Expect.equals(86400000000, d.inMicroseconds); | 8 Expect.equals(86400000000, d.inMicroseconds); |
11 Expect.equals(86400000, d.inMilliseconds); | 9 Expect.equals(86400000, d.inMilliseconds); |
12 Expect.equals(86400, d.inSeconds); | 10 Expect.equals(86400, d.inSeconds); |
13 Expect.equals(1440, d.inMinutes); | 11 Expect.equals(1440, d.inMinutes); |
14 Expect.equals(24, d.inHours); | 12 Expect.equals(24, d.inHours); |
15 Expect.equals(1, d.inDays); | 13 Expect.equals(1, d.inDays); |
16 d = const Duration(hours: 1); | 14 d = const Duration(hours: 1); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 d = const Duration(hours: 1999, minutes: 17, seconds: 42); | 217 d = const Duration(hours: 1999, minutes: 17, seconds: 42); |
220 Expect.equals("1999:17:42.000000", d.toString()); | 218 Expect.equals("1999:17:42.000000", d.toString()); |
221 | 219 |
222 d = const Duration(days: -1, hours: -3, minutes: -17, seconds: -42, | 220 d = const Duration(days: -1, hours: -3, minutes: -17, seconds: -42, |
223 milliseconds: -823, microseconds: -127); | 221 milliseconds: -823, microseconds: -127); |
224 Expect.equals("-27:17:42.823127", d.toString()); | 222 Expect.equals("-27:17:42.823127", d.toString()); |
225 | 223 |
226 d = const Duration(hours: -1999, minutes: -17, seconds: -42); | 224 d = const Duration(hours: -1999, minutes: -17, seconds: -42); |
227 Expect.equals("-1999:17:42.000000", d.toString()); | 225 Expect.equals("-1999:17:42.000000", d.toString()); |
228 } | 226 } |
OLD | NEW |