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

Unified Diff: tests/corelib/stopwatch_test.dart

Issue 12221073: Add Stopwatch.isRunning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/core/stopwatch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/stopwatch_test.dart
diff --git a/tests/corelib/stopwatch_test.dart b/tests/corelib/stopwatch_test.dart
index b688ab3f377fad73a2b2a4aa0e64b9f83e73e668..2b9c1a6ae14e0ed48d610735f8d63c2659c10e3e 100644
--- a/tests/corelib/stopwatch_test.dart
+++ b/tests/corelib/stopwatch_test.dart
@@ -8,7 +8,9 @@ library stopwatch_test;
class StopwatchTest {
static bool checkTicking(Stopwatch sw) {
+ Expect.isFalse(sw.isRunning);
sw.start();
+ Expect.isTrue(sw.isRunning);
for (int i = 0; i < 10000; i++) {
int.parse(i.toString());
if (sw.elapsedTicks > 0) {
@@ -20,10 +22,12 @@ class StopwatchTest {
static bool checkStopping(Stopwatch sw) {
sw.stop();
+ Expect.isFalse(sw.isRunning);
int v1 = sw.elapsedTicks;
Expect.isTrue(v1 > 0); // Expect a non-zero elapsed time.
Stopwatch sw2 = new Stopwatch(); // Used for verification.
sw2.start();
+ Expect.isTrue(sw2.isRunning);
int sw2LastElapsed = 0;
for (int i = 0; i < 100000; i++) {
int.parse(i.toString());
@@ -46,7 +50,9 @@ class StopwatchTest {
static checkRestart() {
Stopwatch sw = new Stopwatch();
+ Expect.isFalse(sw.isRunning);
sw.start();
+ Expect.isTrue(sw.isRunning);
for (int i = 0; i < 100000; i++) {
int.parse(i.toString());
if (sw.elapsedTicks > 0) {
@@ -54,8 +60,10 @@ class StopwatchTest {
}
}
sw.stop();
+ Expect.isFalse(sw.isRunning);
int initial = sw.elapsedTicks;
sw.start();
+ Expect.isTrue(sw.isRunning);
for (int i = 0; i < 100000; i++) {
int.parse(i.toString());
if (sw.elapsedTicks > initial) {
@@ -63,12 +71,15 @@ class StopwatchTest {
}
}
sw.stop();
+ Expect.isFalse(sw.isRunning);
Expect.isTrue(sw.elapsedTicks > initial);
}
static checkReset() {
Stopwatch sw = new Stopwatch();
+ Expect.isFalse(sw.isRunning);
sw.start();
+ Expect.isTrue(sw.isRunning);
for (int i = 0; i < 100000; i++) {
int.parse(i.toString());
if (sw.elapsedTicks > 0) {
@@ -76,9 +87,12 @@ class StopwatchTest {
}
}
sw.stop();
+ Expect.isFalse(sw.isRunning);
sw.reset();
+ Expect.isFalse(sw.isRunning);
Expect.equals(0, sw.elapsedTicks);
sw.start();
+ Expect.isTrue(sw.isRunning);
for (int i = 0; i < 100000; i++) {
int.parse(i.toString());
if (sw.elapsedTicks > 0) {
@@ -86,6 +100,7 @@ class StopwatchTest {
}
}
sw.reset();
+ Expect.isTrue(sw.isRunning);
for (int i = 0; i < 100000; i++) {
int.parse(i.toString());
if (sw.elapsedTicks > 0) {
@@ -93,6 +108,7 @@ class StopwatchTest {
}
}
sw.stop();
+ Expect.isFalse(sw.isRunning);
Expect.isTrue(sw.elapsedTicks > 0);
}
« no previous file with comments | « sdk/lib/core/stopwatch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698