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

Side by Side Diff: tests/corelib/date_time_test.dart

Issue 12221094: Deprecate comparison operators of DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 10 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 | « tests/co19/co19-runtime.status ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 DateTime. 5 // Dart test program for DateTime.
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 DateTime.now(); 10 var t1 = new DateTime.now();
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 Expect.equals(true, 310 Expect.equals(true,
311 (dt1.minute == dt2.minute) || 311 (dt1.minute == dt2.minute) ||
312 ((dt1.minute - dt2.minute).abs() == 30) || 312 ((dt1.minute - dt2.minute).abs() == 30) ||
313 ((dt1.minute - dt2.minute).abs() == 15)); 313 ((dt1.minute - dt2.minute).abs() == 15));
314 Expect.equals(dt1.second, dt2.second); 314 Expect.equals(dt1.second, dt2.second);
315 Expect.equals(dt1.millisecond, dt2.millisecond); 315 Expect.equals(dt1.millisecond, dt2.millisecond);
316 } 316 }
317 317
318 static void testConstructors() { 318 static void testConstructors() {
319 var dt0 = new DateTime.utc(2011, 5, 11, 18, 58, 35, 0); 319 var dt0 = new DateTime.utc(2011, 5, 11, 18, 58, 35, 0);
320 var dt0b = new DateTime.utc(2011, 5, 11, 18, 58, 35, 0).toLocal();
320 Expect.equals(1305140315000, dt0.millisecondsSinceEpoch); 321 Expect.equals(1305140315000, dt0.millisecondsSinceEpoch);
321 var dt1 = new DateTime.fromMillisecondsSinceEpoch(1305140315000); 322 var dt1 = new DateTime.fromMillisecondsSinceEpoch(1305140315000);
322 Expect.equals(dt1.millisecondsSinceEpoch, dt0.millisecondsSinceEpoch); 323 Expect.equals(dt1.millisecondsSinceEpoch, dt0.millisecondsSinceEpoch);
323 Expect.equals(true, dt1 == dt0); 324 Expect.equals(false, dt1 == dt0);
325 Expect.equals(true, dt1 == dt0b);
324 var dt3 = new DateTime(dt1.year, dt1.month, dt1.day, dt1.hour, dt1.minute, 326 var dt3 = new DateTime(dt1.year, dt1.month, dt1.day, dt1.hour, dt1.minute,
325 dt1.second, dt1.millisecond); 327 dt1.second, dt1.millisecond);
326 Expect.equals(dt1.millisecondsSinceEpoch, dt3.millisecondsSinceEpoch); 328 Expect.equals(dt1.millisecondsSinceEpoch, dt3.millisecondsSinceEpoch);
329 Expect.equals(false, dt3 == dt0);
327 Expect.equals(true, dt1 == dt3); 330 Expect.equals(true, dt1 == dt3);
328 dt3 = new DateTime( 331 dt3 = new DateTime(
329 dt1.year, dt1.month, dt1.day, dt1.hour, dt1.minute, 332 dt1.year, dt1.month, dt1.day, dt1.hour, dt1.minute,
330 dt1.second, dt1.millisecond); 333 dt1.second, dt1.millisecond);
331 Expect.equals(dt1.millisecondsSinceEpoch, dt3.millisecondsSinceEpoch); 334 Expect.equals(dt1.millisecondsSinceEpoch, dt3.millisecondsSinceEpoch);
332 Expect.equals(true, dt1 == dt3); 335 Expect.equals(true, dt1 == dt3);
333 var dt2 = dt1.toLocal(); 336 var dt2 = dt1.toLocal();
334 dt3 = new DateTime(2011, 5, dt1.day, dt1.hour, dt1.minute, 35, 0); 337 dt3 = new DateTime(2011, 5, dt1.day, dt1.hour, dt1.minute, 35, 0);
335 Expect.equals(dt2.millisecondsSinceEpoch, dt3.millisecondsSinceEpoch); 338 Expect.equals(dt2.millisecondsSinceEpoch, dt3.millisecondsSinceEpoch);
336 Expect.equals(true, dt2 == dt3); 339 Expect.equals(true, dt2 == dt3);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 testEquivalentYears(); 821 testEquivalentYears();
819 testExtremes(); 822 testExtremes();
820 testFarAwayDates(); 823 testFarAwayDates();
821 testWeekday(); 824 testWeekday();
822 } 825 }
823 } 826 }
824 827
825 main() { 828 main() {
826 DateTest.testMain(); 829 DateTest.testMain();
827 } 830 }
OLDNEW
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698