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

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 int8_1 = 10;
19 const int8_2 = 100;
20
21 void int8_receiver() {
22 var sp = spawnFunction(int8_sender);
23 sp.call("hi").then((a) {
24 Expect.equals(int8_1, a[0]);
25 Expect.equals(int8_2, a[1]);
26 print("int8_receiver");
27 });
28 }
29
30 int8_sender() {
31 port.receive((m, r) {
Ivan Posva 2012/10/29 18:27:45 m is not being used below, maybe it should be on o
siva 2012/10/29 20:04:03 As discussed offline replaced "hi" with length of
32 var a = new Int8List(2);
33 a[0] = int8_1;
34 a[1] = int8_2;
35 r.send(a);
36 });
37 }
38
39 // Uint8 array.
40 const uint8_1 = 0xff;
41 const uint8_2 = 0x7f;
42
43 void uint8_receiver() {
44 var sp = spawnFunction(uint8_sender);
45 sp.call("hi").then((a) {
46 Expect.equals(uint8_1, a[0]);
47 Expect.equals(uint8_2, a[1]);
48 print("uint8_receiver");
49 });
50 }
51
52 uint8_sender() {
53 port.receive((m, r) {
54 var a = new Uint8List(2);
55 a[0] = uint8_1;
56 a[1] = uint8_2;
57 r.send(a);
58 });
59 }
60
61 // Int16 array.
62 const int16_1 = 1000;
63 const int16_2 = 10000;
64
65 void int16_receiver() {
66 var sp = spawnFunction(int16_sender);
67 sp.call("hi").then((a) {
68 Expect.equals(int16_1, a[0]);
69 Expect.equals(int16_2, a[1]);
70 print("int16_receiver");
71 });
72 }
73
74 int16_sender() {
75 port.receive((m, r) {
76 var a = new Int16List(2);
77 a[0] = int16_1;
78 a[1] = int16_2;
79 r.send(a);
80 });
81 }
82
83 // Uint16 array.
84 const uint16_1 = 0xffff;
85 const uint16_2 = 0x7fff;
86
87 void uint16_receiver() {
88 var sp = spawnFunction(uint16_sender);
89 sp.call("hi").then((a) {
90 Expect.equals(uint16_1, a[0]);
91 Expect.equals(uint16_2, a[1]);
92 print("uint16_receiver");
93 });
94 }
95
96 uint16_sender() {
97 port.receive((m, r) {
98 var a = new Uint16List(2);
99 a[0] = uint16_1;
100 a[1] = uint16_2;
101 r.send(a);
102 });
103 }
104
105 // Int32 array.
106 const int32_1 = 100000;
107 const int32_2 = 1000000;
108
109 void int32_receiver() {
110 var sp = spawnFunction(int32_sender);
111 sp.call("hi").then((a) {
112 Expect.equals(int32_1, a[0]);
113 Expect.equals(int32_2, a[1]);
114 print("int32_receiver");
115 });
116 }
117
118 int32_sender() {
119 port.receive((m, r) {
120 var a = new Int32List(2);
121 a[0] = int32_1;
122 a[1] = int32_2;
123 r.send(a);
124 });
125 }
126
127 // Uint32 array.
128 const uint32_1 = 0xffffffff;
129 const uint32_2 = 0x7fffffff;
130
131 void uint32_receiver() {
132 var sp = spawnFunction(uint32_sender);
133 sp.call("hi").then((a) {
134 Expect.equals(uint32_1, a[0]);
135 Expect.equals(uint32_2, a[1]);
136 print("uint32_receiver");
137 });
138 }
139
140 uint32_sender() {
141 port.receive((m, r) {
142 var a = new Uint32List(2);
143 a[0] = uint32_1;
144 a[1] = uint32_2;
145 r.send(a);
146 });
147 }
148
149 // Int64 array.
150 const int64_1 = 10000000;
151 const int64_2 = 100000000;
152
153 void int64_receiver() {
154 var sp = spawnFunction(int64_sender);
155 sp.call("hi").then((a) {
156 Expect.equals(int64_1, a[0]);
157 Expect.equals(int64_2, a[1]);
158 print("int64_receiver");
159 });
160 }
161
162 int64_sender() {
163 port.receive((m, r) {
164 var a = new Int64List(2);
165 a[0] = int64_1;
166 a[1] = int64_2;
167 r.send(a);
168 });
169 }
170
171 // Uint64 array.
172 const uint64_1 = 0xffffffffffffffff;
173 const uint64_2 = 0x7fffffffffffffff;
174
175 void uint64_receiver() {
176 var sp = spawnFunction(uint64_sender);
177 sp.call("hi").then((a) {
178 Expect.equals(uint64_1, a[0]);
179 Expect.equals(uint64_2, a[1]);
180 print("uint64_receiver");
181 });
182 }
183
184 uint64_sender() {
185 port.receive((m, r) {
186 var a = new Uint64List(2);
187 a[0] = uint64_1;
188 a[1] = uint64_2;
189 r.send(a);
190 });
191 }
192
193 // Float32 Array.
194 const float32_1 = 1.0;
195 const float32_2 = 2.0;
196
197 void float32_receiver() {
198 var sp = spawnFunction(float32_sender);
199 sp.call("hi").then((a) {
200 Expect.equals(float32_1, a[0]);
201 Expect.equals(float32_2, a[1]);
202 print("float32_receiver");
203 });
204 }
205
206 float32_sender() {
207 port.receive((m, r) {
208 var a = new Float32List(2);
209 a[0] = float32_1;
210 a[1] = float32_2;
211 r.send(a);
212 });
213 }
214
215 // Float64 Array.
216 const float64_1 = 101.234;
217 const float64_2 = 201.765;
218
219 void float64_receiver() {
220 var sp = spawnFunction(float64_sender);
221 sp.call("hi").then((a) {
222 Expect.equals(float64_1, a[0]);
223 Expect.equals(float64_2, a[1]);
224 print("float64_receiver");
225 });
226 }
227
228 float64_sender() {
229 port.receive((m, r) {
230 var a = new Float64List(2);
231 a[0] = float64_1;
232 a[1] = float64_2;
233 r.send(a);
234 });
235 }
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