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

Side by Side Diff: tests/isolate/src/MandelIsolateTest.dart

Issue 10153005: unittest step 3 and 4: remove TestFramework.dart, make test.dart use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #library('MandelIsolateTest'); 5 #library('MandelIsolateTest');
6 #import('dart:isolate'); 6 #import('dart:isolate');
7 #import('TestFramework.dart'); 7 #import('../../../lib/unittest/unittest.dart');
8 8
9 final TERMINATION_MESSAGE = -1; 9 final TERMINATION_MESSAGE = -1;
10 final N = 100; 10 final N = 100;
11 final ISOLATES = 20; 11 final ISOLATES = 20;
12 12
13 void test(TestExpectation expect) { 13 main() {
14 final state = new MandelbrotState(); 14 test("Render mandelbroth in parallel", () {
Bob Nystrom 2012/04/20 22:31:36 "Mandelbrot"
Siggi Cherem (dart-lang) 2012/04/21 00:03:43 this one had to make you laugh :)
15 expect.completes(state._validated.future).then((result) { 15 final state = new MandelbrotState();
16 Expect.isTrue(result); 16 state._validated.future.then(later1((result) {
17 expect.succeeded(); 17 Expect.isTrue(result);
Bob Nystrom 2012/04/20 22:31:36 expect(result).isTrue();
Siggi Cherem (dart-lang) 2012/04/21 00:03:43 Done. In general I was trying to do the minimal ch
Bob Nystrom 2012/04/23 17:34:07 Totally fine. I'm OK with gradually changing this
18 }));
19 for (int i = 0; i < Math.min(ISOLATES, N); i++) state.startClient(i);
18 }); 20 });
19 for (int i = 0; i < Math.min(ISOLATES, N); i++) state.startClient(i);
20 } 21 }
21 22
22 23
23 class MandelbrotState { 24 class MandelbrotState {
24 25
25 MandelbrotState() { 26 MandelbrotState() {
26 _result = new List<List<int>>(N); 27 _result = new List<List<int>>(N);
27 _lineProcessedBy = new List<LineProcessorClient>(N); 28 _lineProcessedBy = new List<LineProcessorClient>(N);
28 _sent = 0; 29 _sent = 0;
29 _missing = N; 30 _missing = N;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 Zrv = Trv - Tiv + Crv; 142 Zrv = Trv - Tiv + Crv;
142 143
143 Trv = Zrv * Zrv; 144 Trv = Zrv * Zrv;
144 Tiv = Ziv * Ziv; 145 Tiv = Ziv * Ziv;
145 } while (((Trv + Tiv) <= 4.0) && (--i > 0)); 146 } while (((Trv + Tiv) <= 4.0) && (--i > 0));
146 147
147 result[x] = i; 148 result[x] = i;
148 } 149 }
149 return result; 150 return result;
150 } 151 }
151
152 } 152 }
153
154 main() {
155 runTests([test]);
156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698