| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test program for Date. | 5 // Dart test program for Date. |
| 6 | 6 |
| 7 class DateTest { | 7 class DateTest { |
| 8 // Tests if the time moves eventually forward. | 8 // Tests if the time moves eventually forward. |
| 9 static void testNow() { | 9 static void testNow() { |
| 10 var t1 = new Date.now(); | 10 var t1 = new Date.now(); |
| 11 bool timeMovedForward = false; | 11 bool timeMovedForward = false; |
| 12 for (int i = 0; i < 1000000; i++) { | 12 for (int i = 0; i < 1000000; i++) { |
| 13 var t2 = new Date.now(); | 13 var t2 = new Date.now(); |
| 14 if (t1.value < t2.value) { | 14 if (t1.value < t2.value) { |
| 15 timeMovedForward = true; | 15 timeMovedForward = true; |
| 16 break; | 16 break; |
| 17 } | 17 } |
| 18 } | 18 } |
| 19 Expect.equals(true, timeMovedForward); | 19 Expect.equals(true, timeMovedForward); |
| 20 Expect.isFalse(t1.isUtc()); |
| 20 } | 21 } |
| 21 | 22 |
| 22 static void testValue() { | 23 static void testValue() { |
| 23 var dt1 = new Date.now(); | 24 var dt1 = new Date.now(); |
| 24 var value = dt1.value; | 25 var value = dt1.value; |
| 25 var dt2 = new Date.fromEpoch(value); | 26 var dt2 = new Date.fromEpoch(value); |
| 26 Expect.equals(value, dt2.value); | 27 Expect.equals(value, dt2.value); |
| 27 } | 28 } |
| 28 | 29 |
| 29 static void testFarAwayDates() { | 30 static void testFarAwayDates() { |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 testDateStrings(); | 537 testDateStrings(); |
| 537 testEquivalentYears(); | 538 testEquivalentYears(); |
| 538 testFarAwayDates(); | 539 testFarAwayDates(); |
| 539 testWeekday(); | 540 testWeekday(); |
| 540 } | 541 } |
| 541 } | 542 } |
| 542 | 543 |
| 543 main() { | 544 main() { |
| 544 DateTest.testMain(); | 545 DateTest.testMain(); |
| 545 } | 546 } |
| OLD | NEW |