OLD | NEW |
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 testing stopwatch support. | 5 // Dart test program for testing stopwatch support. |
6 | 6 |
7 library stopwatch_test; | 7 library stopwatch_test; |
8 import "package:expect/expect.dart"; | |
9 | 8 |
10 class StopwatchTest { | 9 class StopwatchTest { |
11 static bool checkTicking(Stopwatch sw) { | 10 static bool checkTicking(Stopwatch sw) { |
12 Expect.isFalse(sw.isRunning); | 11 Expect.isFalse(sw.isRunning); |
13 sw.start(); | 12 sw.start(); |
14 Expect.isTrue(sw.isRunning); | 13 Expect.isTrue(sw.isRunning); |
15 for (int i = 0; i < 1000000; i++) { | 14 for (int i = 0; i < 1000000; i++) { |
16 int.parse(i.toString()); | 15 int.parse(i.toString()); |
17 if (sw.elapsedTicks > 0) { | 16 if (sw.elapsedTicks > 0) { |
18 break; | 17 break; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 Expect.isTrue(checkTicking(sw)); | 117 Expect.isTrue(checkTicking(sw)); |
119 Expect.isTrue(checkStopping(sw)); | 118 Expect.isTrue(checkStopping(sw)); |
120 checkRestart(); | 119 checkRestart(); |
121 checkReset(); | 120 checkReset(); |
122 } | 121 } |
123 } | 122 } |
124 | 123 |
125 main() { | 124 main() { |
126 StopwatchTest.testMain(); | 125 StopwatchTest.testMain(); |
127 } | 126 } |
OLD | NEW |