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

Side by Side Diff: tests/isolate/mandel_isolate_test.dart

Issue 10829459: Deprecate Math object in corelib in favor of dart:math library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 3 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
« no previous file with comments | « tests/corelib/stopwatch_test.dart ('k') | tests/language/arithmetic_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #library('MandelIsolateTest'); 5 #library('MandelIsolateTest');
6 #import('dart:isolate'); 6 #import('dart:isolate');
7 #import('dart:math');
7 #import('../../pkg/unittest/unittest.dart'); 8 #import('../../pkg/unittest/unittest.dart');
8 9
9 final TERMINATION_MESSAGE = -1; 10 final TERMINATION_MESSAGE = -1;
10 final N = 100; 11 final N = 100;
11 final ISOLATES = 20; 12 final ISOLATES = 20;
12 13
13 main() { 14 main() {
14 test("Render Mandelbrot in parallel", () { 15 test("Render Mandelbrot in parallel", () {
15 final state = new MandelbrotState(); 16 final state = new MandelbrotState();
16 state._validated.future.then(expectAsync1((result) { 17 state._validated.future.then(expectAsync1((result) {
17 expect(result, isTrue); 18 expect(result, isTrue);
18 })); 19 }));
19 for (int i = 0; i < Math.min(ISOLATES, N); i++) state.startClient(i); 20 for (int i = 0; i < min(ISOLATES, N); i++) state.startClient(i);
20 }); 21 });
21 } 22 }
22 23
23 24
24 class MandelbrotState { 25 class MandelbrotState {
25 26
26 MandelbrotState() { 27 MandelbrotState() {
27 _result = new List<List<int>>(N); 28 _result = new List<List<int>>(N);
28 _lineProcessedBy = new List<LineProcessorClient>(N); 29 _lineProcessedBy = new List<LineProcessorClient>(N);
29 _sent = 0; 30 _sent = 0;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 void processLines() { 133 void processLines() {
133 port.receive((message, SendPort replyTo) { 134 port.receive((message, SendPort replyTo) {
134 if (message == TERMINATION_MESSAGE) { 135 if (message == TERMINATION_MESSAGE) {
135 assert(replyTo == null); 136 assert(replyTo == null);
136 port.close(); 137 port.close();
137 } else { 138 } else {
138 replyTo.send(processLine(message), null); 139 replyTo.send(processLine(message), null);
139 } 140 }
140 }); 141 });
141 } 142 }
OLDNEW
« no previous file with comments | « tests/corelib/stopwatch_test.dart ('k') | tests/language/arithmetic_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698