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

Side by Side Diff: standalone/typed_array_test.dart

Issue 11341012: Added some new tests for issue 6311 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/tests/
Patch Set: Created 8 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import 'dart:isolate';
2 import 'dart:scalarlist';
3
4 void main() {
5 int8_receiver();
6 uint8_receiver();
7 int16_receiver();
8 uint16_receiver();
9 int32_receiver();
10 uint32_receiver();
11 int64_receiver();
12 uint64_receiver();
13 float32_receiver();
14 float64_receiver();
15 }
16
17 // Int8 array.
18 const Int8List int8 = const [ 10, 100 ];
19
20 void int8_receiver() {
21 var sp = spawnFunction(int8_sender);
22 sp.call(int8.length).then((a) {
23 Expect.equals(int8.length, a.length);
24 for (int i = 0; i < a.length; i++) {
25 Expect.equals(int8[i], a[i]);
26 }
27 print("int8_receiver");
28 });
29 }
30
31 int8_sender() {
32 port.receive((len, r) {
33 Expect.equals(int8.length, len);
34 var a = new Int8List(len);
35 for (int i = 0; i < len; i++) {
36 a[i] = int8[i];
37 }
38 r.send(a);
39 });
40 }
41
42
43 // Uint8 array.
44 const Uint8List uint8 = const [ 0xff, 0x7f ];
45
46 void uint8_receiver() {
47 var sp = spawnFunction(uint8_sender);
48 sp.call(uint8.length).then((a) {
49 Expect.equals(uint8.length, a.length);
50 for (int i = 0; i < a.length; i++) {
51 Expect.equals(uint8[i], a[i]);
52 }
53 print("uint8_receiver");
54 });
55 }
56
57 uint8_sender() {
58 port.receive((len, r) {
59 Expect.equals(uint8.length, len);
60 var a = new Uint8List(len);
61 for (int i = 0; i < len; i++) {
62 a[i] = uint8[i];
63 }
64 r.send(a);
65 });
66 }
67
68
69 // Int16 array.
70 const Int16List int16 = const [ 1000, 10000 ];
71
72 void int16_receiver() {
73 var sp = spawnFunction(int16_sender);
74 sp.call(int16.length).then((a) {
75 Expect.equals(int16.length, a.length);
76 for (int i = 0; i < a.length; i++) {
77 Expect.equals(int16[i], a[i]);
78 }
79 print("int16_receiver");
80 });
81 }
82
83 int16_sender() {
84 port.receive((len, r) {
85 Expect.equals(int16.length, len);
86 var a = new Int16List(len);
87 for (int i = 0; i < len; i++) {
88 a[i] = int16[i];
89 }
90 r.send(a);
91 });
92 }
93
94
95 // Uint16 array.
96 const Uint16List uint16 = const [ 0xffff, 0x7fff ];
97
98 void uint16_receiver() {
99 var sp = spawnFunction(uint16_sender);
100 sp.call(uint16.length).then((a) {
101 Expect.equals(uint16.length, a.length);
102 for (int i = 0; i < a.length; i++) {
103 Expect.equals(uint16[i], a[i]);
104 }
105 print("uint16_receiver");
106 });
107 }
108
109 uint16_sender() {
110 port.receive((len, r) {
111 Expect.equals(uint16.length, len);
112 var a = new Uint16List(len);
113 for (int i = 0; i < len; i++) {
114 a[i] = uint16[i];
115 }
116 r.send(a);
117 });
118 }
119
120
121 // Int32 array.
122 const Int32List int32 = const [ 100000, 1000000 ];
123
124 void int32_receiver() {
125 var sp = spawnFunction(int32_sender);
126 sp.call(int32.length).then((a) {
127 Expect.equals(int32.length, a.length);
128 for (int i = 0; i < a.length; i++) {
129 Expect.equals(int32[i], a[i]);
130 }
131 print("int32_receiver");
132 });
133 }
134
135 int32_sender() {
136 port.receive((len, r) {
137 Expect.equals(int32.length, len);
138 var a = new Int32List(len);
139 for (int i = 0; i < len; i++) {
140 a[i] = int32[i];
141 }
142 r.send(a);
143 });
144 }
145
146
147 // Uint32 array.
148 const Uint32List uint32 = const [ 0xffffffff, 0x7fffffff ];
149
150 void uint32_receiver() {
151 var sp = spawnFunction(uint32_sender);
152 sp.call(uint32.length).then((a) {
153 Expect.equals(uint32.length, a.length);
154 for (int i = 0; i < a.length; i++) {
155 Expect.equals(uint32[i], a[i]);
156 }
157 print("uint32_receiver");
158 });
159 }
160
161 uint32_sender() {
162 port.receive((len, r) {
163 Expect.equals(uint32.length, len);
164 var a = new Uint32List(len);
165 for (int i = 0; i < len; i++) {
166 a[i] = uint32[i];
167 }
168 r.send(a);
169 });
170 }
171
172
173 // Int64 array.
174 const Int64List int64 = const [ 10000000, 100000000 ];
175
176 void int64_receiver() {
177 var sp = spawnFunction(int64_sender);
178 sp.call(int64.length).then((a) {
179 Expect.equals(int64.length, a.length);
180 for (int i = 0; i < a.length; i++) {
181 Expect.equals(int64[i], a[i]);
182 }
183 print("int64_receiver");
184 });
185 }
186
187 int64_sender() {
188 port.receive((len, r) {
189 Expect.equals(int64.length, len);
190 var a = new Int64List(len);
191 for (int i = 0; i < len; i++) {
192 a[i] = int64[i];
193 }
194 r.send(a);
195 });
196 }
197
198
199 // Uint64 array.
200 const Uint64List uint64 = const [ 0xffffffffffffffff, 0x7fffffffffffffff ];
201
202 void uint64_receiver() {
203 var sp = spawnFunction(uint64_sender);
204 sp.call(uint64.length).then((a) {
205 Expect.equals(uint64.length, a.length);
206 for (int i = 0; i < a.length; i++) {
207 Expect.equals(uint64[i], a[i]);
208 }
209 print("uint64_receiver");
210 });
211 }
212
213 uint64_sender() {
214 port.receive((len, r) {
215 Expect.equals(uint64.length, len);
216 var a = new Uint64List(len);
217 for (int i = 0; i < len; i++) {
218 a[i] = uint64[i];
219 }
220 r.send(a);
221 });
222 }
223
224
225 // Float32 Array.
226 const Float32List float32 = const [ 1.0, 2.0 ];
227
228 void float32_receiver() {
229 var sp = spawnFunction(float32_sender);
230 sp.call(float32.length).then((a) {
231 Expect.equals(float32.length, a.length);
232 for (int i = 0; i < a.length; i++) {
233 Expect.equals(float32[i], a[i]);
234 }
235 print("float32_receiver");
236 });
237 }
238
239 float32_sender() {
240 port.receive((len, r) {
241 Expect.equals(float32.length, len);
242 var a = new Float32List(len);
243 for (int i = 0; i < len; i++) {
244 a[i] = float32[i];
245 }
246 r.send(a);
247 });
248 }
249
250
251 // Float64 Array.
252 const Float64List float64 = const [ 101.234, 201.765 ];
253
254 void float64_receiver() {
255 var sp = spawnFunction(float64_sender);
256 sp.call(float64.length).then((a) {
257 Expect.equals(float64.length, a.length);
258 for (int i = 0; i < a.length; i++) {
259 Expect.equals(float64[i], a[i]);
260 }
261 print("float64_receiver");
262 });
263 }
264
265 float64_sender() {
266 port.receive((len, r) {
267 Expect.equals(float64.length, len);
268 var a = new Float64List(len);
269 for (int i = 0; i < len; i++) {
270 a[i] = float64[i];
271 }
272 r.send(a);
273 });
274 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698