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('dart:math'); | 8 import 'dart:math'; |
9 | 9 |
10 class StopwatchTest { | 10 class StopwatchTest { |
11 static bool checkTicking(Stopwatch sw) { | 11 static bool checkTicking(Stopwatch sw) { |
12 sw.start(); | 12 sw.start(); |
13 for (int i = 0; i < 10000; i++) { | 13 for (int i = 0; i < 10000; i++) { |
14 parseInt(i.toString()); | 14 parseInt(i.toString()); |
15 if (sw.elapsedTicks > 0) { | 15 if (sw.elapsedTicks > 0) { |
16 break; | 16 break; |
17 } | 17 } |
18 } | 18 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 Expect.isTrue(checkTicking(sw)); | 102 Expect.isTrue(checkTicking(sw)); |
103 Expect.isTrue(checkStopping(sw)); | 103 Expect.isTrue(checkStopping(sw)); |
104 checkRestart(); | 104 checkRestart(); |
105 checkReset(); | 105 checkReset(); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 main() { | 109 main() { |
110 StopwatchTest.testMain(); | 110 StopwatchTest.testMain(); |
111 } | 111 } |
OLD | NEW |