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

Unified Diff: tests/corelib/date_time_test.dart

Issue 1511773003: Fix datetime test. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add comment. Created 5 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/date_time_test.dart
diff --git a/tests/corelib/date_time_test.dart b/tests/corelib/date_time_test.dart
index 7c2940a4c5723f8e6c12366fae090710abe418d7..9a9de1cfee66dbf6122321c8030f8f8f741d4c25 100644
--- a/tests/corelib/date_time_test.dart
+++ b/tests/corelib/date_time_test.dart
@@ -37,6 +37,11 @@ void testMillisecondsSinceEpoch() {
}
void testMicrosecondsSinceEpoch() {
+ // We chose a millisecondSinceEpoch that is guaranteed to fit into 53
+ // bits when expressed as microseconds. Furthermore the microsecond part
+ // is equal to 0, which means that an implementation that discards (or
+ // rounds) microseconds should yield correct results for the following
+ // test.
var dt1 = new DateTime.fromMillisecondsSinceEpoch(1);
var microsecondsSinceEpoch = dt1.microsecondsSinceEpoch;
var dt2 = new DateTime.fromMicrosecondsSinceEpoch(microsecondsSinceEpoch);
@@ -44,7 +49,7 @@ void testMicrosecondsSinceEpoch() {
if (!supportsMicroseconds) return;
dt1 = new DateTime.now();
- microsecondsSinceEpoch = dt1.millisecondsSinceEpoch;
+ microsecondsSinceEpoch = dt1.microsecondsSinceEpoch;
dt2 = new DateTime.fromMicrosecondsSinceEpoch(microsecondsSinceEpoch);
Expect.equals(microsecondsSinceEpoch, dt2.microsecondsSinceEpoch);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698