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

Side by Side Diff: mojo/public/interfaces/bindings/tests/test_structs.mojom

Issue 832583002: Mojo JS Bindings: added unit tests for int/uint values (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Sync Created 5 years, 11 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
« no previous file with comments | « no previous file | mojo/public/js/struct_unittests.js » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 [JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"] 5 [JavaPackage="org.chromium.mojo.bindings.test.mojom.test_structs"]
6 module mojo.test; 6 module mojo.test;
7 7
8 import "mojo/public/interfaces/bindings/tests/rect.mojom"; 8 import "mojo/public/interfaces/bindings/tests/rect.mojom";
9 9
10 struct NamedRegion { 10 struct NamedRegion {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 double f2 = V2; 160 double f2 = V2;
161 float f3 = V3; 161 float f3 = V3;
162 float f4 = V4; 162 float f4 = V4;
163 float f5 = V5; 163 float f5 = V5;
164 float f6 = V6; 164 float f6 = V6;
165 double f7 = V7; 165 double f7 = V7;
166 double f8 = V8; 166 double f8 = V8;
167 double f9 = V9; 167 double f9 = V9;
168 }; 168 };
169 169
170 // Used to verify that various signed integer values can be encoded and
171 // decoded correctly.
172
173 struct IntegerNumberValues {
174 const int8 V0 = -128; // Minimum
175 const int8 V1 = -1; // -1
176 const int8 V2 = 0; // 0
177 const int8 V3 = 42; // An arbitrary valid value.
178 const int8 V4 = 127; // Maximum
179
180 const int16 V5 = -32768; // ...
181 const int16 V6 = -1;
182 const int16 V7 = 0;
183 const int16 V8 = 12345;
184 const int16 V9 = 32767;
185
186 const int32 V10 = -2147483648;
187 const int32 V11 = -1;
188 const int32 V12 = 0;
189 const int32 V13 = 1234567890;
190 const int32 V14 = 2147483647;
191
192 // The limits for JavaScript integers are +/- (2^53 - 1).
193 const int64 V15 = -9007199254740991; // Number.MIN_SAFE_INTEGER
194 const int64 V16 = -1;
195 const int64 V17 = 0;
196 const int64 V18 = 1234567890123456;
197 const int64 V19 = 9007199254740991; // Number.MAX_SAFE_INTEGER
198
199 int8 f0 = V0;
200 int8 f1 = V1;
201 int8 f2 = V2;
202 int8 f3 = V3;
203 int8 f4 = V4;
204
205 int16 f5 = V5;
206 int16 f6 = V6;
207 int16 f7 = V7;
208 int16 f8 = V8;
209 int16 f9 = V9;
210
211 int32 f10 = V10;
212 int32 f11 = V11;
213 int32 f12 = V12;
214 int32 f13 = V13;
215 int32 f14 = V14;
216
217 int64 f15 = V15;
218 int64 f16 = V16;
219 int64 f17 = V17;
220 int64 f18 = V18;
221 int64 f19 = V19;
222 };
223
224 // Used to verify that various unsigned integer values can be encoded and
225 // decoded correctly.
226
227 struct UnsignedNumberValues {
228 const uint8 V0 = 0; // Minimum = 0.
229 const uint8 V1 = 42; // An arbitrary valid value.
230 const uint8 V2 = 0xFF; // Maximum
231
232 const uint16 V3 = 0; // ...
233 const uint16 V4 = 12345;
234 const uint16 V5 = 0xFFFF;
235
236 const uint32 V6 = 0;
237 const uint32 V7 = 1234567890;
238 const uint32 V8 = 0xFFFFFFFF;
239
240 // The limits for JavaScript integers are +/- (2^53 - 1).
241 const uint64 V9 = 0;
242 const uint64 V10 = 1234567890123456;
243 const uint64 V11 = 9007199254740991; // Number.MAX_SAFE_INTEGER
244
245 uint8 f0 = V0;
246 uint8 f1 = V1;
247 uint8 f2 = V2;
248
249 uint16 f3 = V3;
250 uint16 f4 = V4;
251 uint16 f5 = V5;
252
253 uint32 f6 = V6;
254 uint32 f7 = V7;
255 uint32 f8 = V8;
256
257 uint64 f9 = V9;
258 uint64 f10 = V10;
259 uint64 f11 = V11;
260 };
261
170 // Used to verify that various (packed) boolean array values can be encoded 262 // Used to verify that various (packed) boolean array values can be encoded
171 // and decoded correctly. 263 // and decoded correctly.
172 264
173 struct BitArrayValues { 265 struct BitArrayValues {
174 array<bool, 1> f0; 266 array<bool, 1> f0;
175 array<bool, 7> f1; 267 array<bool, 7> f1;
176 array<bool, 9> f2; 268 array<bool, 9> f2;
177 array<bool> f3; 269 array<bool> f3;
178 array<array<bool>> f4; 270 array<array<bool>> f4;
179 array<array<bool>?> f5; 271 array<array<bool>?> f5;
180 array<array<bool, 2>?> f6; 272 array<array<bool, 2>?> f6;
181 }; 273 };
OLDNEW
« no previous file with comments | « no previous file | mojo/public/js/struct_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698