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

Side by Side Diff: LayoutTests/fast/js/webidl-type-mapping.html

Issue 54903014: [EnforceRange] doesn't enforce range of a short (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Extend layout test Created 7 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="resources/js-test-pre.js"></script> 2 <script src="resources/js-test-pre.js"></script>
3 <script> 3 <script>
4 description("Exercise WebIDL type conversions."); 4 description("Exercise WebIDL type conversions.");
5 5
6 quiet = true; 6 quiet = true;
7 evalAndLog("converter = window.internals.typeConversions()"); 7 evalAndLog("converter = window.internals.typeConversions()");
8 debug(""); 8 debug("");
9 9
10 function verifyAttribute(attribute) 10 function verifyAttribute(attribute)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 convert(attribute, "''", "0"); 49 convert(attribute, "''", "0");
50 convert(attribute, "'1'", "1"); 50 convert(attribute, "'1'", "1");
51 convertThrows(attribute, "'abc'"); 51 convertThrows(attribute, "'abc'");
52 convert(attribute, "null", "0"); 52 convert(attribute, "null", "0");
53 convertThrows(attribute, "undefined"); 53 convertThrows(attribute, "undefined");
54 } 54 }
55 55
56 type = "testLong"; 56 type = "testLong";
57 verifyAttribute(type); 57 verifyAttribute(type);
58 convert(type, "0"); 58 convert(type, "0");
59 convert(type, "-0", "0");
59 convert(type, "-1"); 60 convert(type, "-1");
60 convert(type, "1"); 61 convert(type, "1");
61 convert(type, "0x7F"); 62 convert(type, "0x7F");
62 convert(type, "0x80"); 63 convert(type, "0x80");
63 convert(type, "0xFF"); 64 convert(type, "0xFF");
64 convert(type, "-0x80"); 65 convert(type, "-0x80");
65 convert(type, "-0x81"); 66 convert(type, "-0x81");
66 convert(type, "0x7FFF"); 67 convert(type, "0x7FFF");
67 convert(type, "0x8000"); 68 convert(type, "0x8000");
68 convert(type, "0xFFFF"); 69 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
83 convert(type, "Infinity", "0"); 84 convert(type, "Infinity", "0");
84 convert(type, "-Infinity", "0"); 85 convert(type, "-Infinity", "0");
85 convert(type, "NaN", "0"); 86 convert(type, "NaN", "0");
86 testNonNumericToNumeric(type); 87 testNonNumericToNumeric(type);
87 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 88 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
88 debug(""); 89 debug("");
89 90
90 type = "testEnforceRangeLong"; 91 type = "testEnforceRangeLong";
91 verifyAttribute(type); 92 verifyAttribute(type);
92 convert(type, "0"); 93 convert(type, "0");
94 convert(type, "-0", "0");
93 convert(type, "-1"); 95 convert(type, "-1");
94 convert(type, "1"); 96 convert(type, "1");
95 convert(type, "0x7F"); 97 convert(type, "0x7F");
96 convert(type, "0x80"); 98 convert(type, "0x80");
97 convert(type, "0xFF"); 99 convert(type, "0xFF");
98 convert(type, "-0x80"); 100 convert(type, "-0x80");
99 convert(type, "-0x81"); 101 convert(type, "-0x81");
100 convert(type, "0x7FFF"); 102 convert(type, "0x7FFF");
101 convert(type, "0x8000"); 103 convert(type, "0x8000");
102 convert(type, "0xFFFF"); 104 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
117 convertThrows(type, "Infinity"); 119 convertThrows(type, "Infinity");
118 convertThrows(type, "-Infinity"); 120 convertThrows(type, "-Infinity");
119 convertThrows(type, "NaN"); 121 convertThrows(type, "NaN");
120 testNonNumericToNumericEnforceRange(type); 122 testNonNumericToNumericEnforceRange(type);
121 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 123 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
122 debug(""); 124 debug("");
123 125
124 type = "testUnsignedLong"; 126 type = "testUnsignedLong";
125 verifyAttribute(type); 127 verifyAttribute(type);
126 convert(type, "0"); 128 convert(type, "0");
129 convert(type, "-0", "0");
127 convert(type, "-1", "0xFFFFFFFF"); 130 convert(type, "-1", "0xFFFFFFFF");
128 convert(type, "1"); 131 convert(type, "1");
129 convert(type, "0x7F"); 132 convert(type, "0x7F");
130 convert(type, "0x80"); 133 convert(type, "0x80");
131 convert(type, "0xFF"); 134 convert(type, "0xFF");
132 convert(type, "-0x80", "0xFFFFFF80"); 135 convert(type, "-0x80", "0xFFFFFF80");
133 convert(type, "-0x81", "0xFFFFFF7F"); 136 convert(type, "-0x81", "0xFFFFFF7F");
134 convert(type, "0x7FFF"); 137 convert(type, "0x7FFF");
135 convert(type, "0x8000"); 138 convert(type, "0x8000");
136 convert(type, "0xFFFF"); 139 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
151 convert(type, "Infinity", "0"); 154 convert(type, "Infinity", "0");
152 convert(type, "-Infinity", "0"); 155 convert(type, "-Infinity", "0");
153 convert(type, "NaN", "0"); 156 convert(type, "NaN", "0");
154 testNonNumericToNumeric(type); 157 testNonNumericToNumeric(type);
155 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 158 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
156 debug(""); 159 debug("");
157 160
158 type = "testEnforceRangeUnsignedLong"; 161 type = "testEnforceRangeUnsignedLong";
159 verifyAttribute(type); 162 verifyAttribute(type);
160 convert(type, "0"); 163 convert(type, "0");
164 convert(type, "-0", "0");
161 convertThrows(type, "-1"); 165 convertThrows(type, "-1");
162 convert(type, "1"); 166 convert(type, "1");
163 convert(type, "0x7F"); 167 convert(type, "0x7F");
164 convert(type, "0x80"); 168 convert(type, "0x80");
165 convert(type, "0xFF"); 169 convert(type, "0xFF");
166 convertThrows(type, "-0x80"); 170 convertThrows(type, "-0x80");
167 convertThrows(type, "-0x81"); 171 convertThrows(type, "-0x81");
168 convert(type, "0x7FFF"); 172 convert(type, "0x7FFF");
169 convert(type, "0x8000"); 173 convert(type, "0x8000");
170 convert(type, "0xFFFF"); 174 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
185 convertThrows(type, "Infinity"); 189 convertThrows(type, "Infinity");
186 convertThrows(type, "-Infinity"); 190 convertThrows(type, "-Infinity");
187 convertThrows(type, "NaN"); 191 convertThrows(type, "NaN");
188 testNonNumericToNumericEnforceRange(type); 192 testNonNumericToNumericEnforceRange(type);
189 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 193 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
190 debug(""); 194 debug("");
191 195
192 type = "testLongLong"; 196 type = "testLongLong";
193 verifyAttribute(type); 197 verifyAttribute(type);
194 convert(type, "0"); 198 convert(type, "0");
199 convert(type, "-0", "0");
195 convert(type, "-1"); 200 convert(type, "-1");
196 convert(type, "1"); 201 convert(type, "1");
197 convert(type, "0x7F"); 202 convert(type, "0x7F");
198 convert(type, "0x80"); 203 convert(type, "0x80");
199 convert(type, "0xFF"); 204 convert(type, "0xFF");
200 convert(type, "-0x80"); 205 convert(type, "-0x80");
201 convert(type, "-0x81"); 206 convert(type, "-0x81");
202 convert(type, "0x7FFF"); 207 convert(type, "0x7FFF");
203 convert(type, "0x8000"); 208 convert(type, "0x8000");
204 convert(type, "0xFFFF"); 209 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
219 convert(type, "Infinity", "0"); 224 convert(type, "Infinity", "0");
220 convert(type, "-Infinity", "0"); 225 convert(type, "-Infinity", "0");
221 convert(type, "NaN", "0"); 226 convert(type, "NaN", "0");
222 testNonNumericToNumeric(type); 227 testNonNumericToNumeric(type);
223 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 228 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
224 debug(""); 229 debug("");
225 230
226 type = "testEnforceRangeLongLong"; 231 type = "testEnforceRangeLongLong";
227 verifyAttribute(type); 232 verifyAttribute(type);
228 convert(type, "0"); 233 convert(type, "0");
234 convert(type, "-0", "0");
229 convert(type, "-1"); 235 convert(type, "-1");
230 convert(type, "1"); 236 convert(type, "1");
231 convert(type, "0x7F"); 237 convert(type, "0x7F");
232 convert(type, "0x80"); 238 convert(type, "0x80");
233 convert(type, "0xFF"); 239 convert(type, "0xFF");
234 convert(type, "-0x80"); 240 convert(type, "-0x80");
235 convert(type, "-0x81"); 241 convert(type, "-0x81");
236 convert(type, "0x7FFF"); 242 convert(type, "0x7FFF");
237 convert(type, "0x8000"); 243 convert(type, "0x8000");
238 convert(type, "0xFFFF"); 244 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
253 convertThrows(type, "Infinity"); 259 convertThrows(type, "Infinity");
254 convertThrows(type, "-Infinity"); 260 convertThrows(type, "-Infinity");
255 convertThrows(type, "NaN", "0"); 261 convertThrows(type, "NaN", "0");
256 testNonNumericToNumericEnforceRange(type); 262 testNonNumericToNumericEnforceRange(type);
257 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 263 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
258 debug(""); 264 debug("");
259 265
260 type = "testUnsignedLongLong"; 266 type = "testUnsignedLongLong";
261 verifyAttribute(type); 267 verifyAttribute(type);
262 convert(type, "0"); 268 convert(type, "0");
269 convert(type, "-0", "0");
263 convert(type, "-1", "0xFFFFFFFFFFFFFFFF"); 270 convert(type, "-1", "0xFFFFFFFFFFFFFFFF");
264 convert(type, "1"); 271 convert(type, "1");
265 convert(type, "0x7F"); 272 convert(type, "0x7F");
266 convert(type, "0x80"); 273 convert(type, "0x80");
267 convert(type, "0xFF"); 274 convert(type, "0xFF");
268 convert(type, "-0x80", "0xFFFFFFFFFFFFFF80"); 275 convert(type, "-0x80", "0xFFFFFFFFFFFFFF80");
269 convert(type, "-0x81", "0xFFFFFFFFFFFFFF7F"); 276 convert(type, "-0x81", "0xFFFFFFFFFFFFFF7F");
270 convert(type, "0x7FFF"); 277 convert(type, "0x7FFF");
271 convert(type, "0x8000"); 278 convert(type, "0x8000");
272 convert(type, "0xFFFF"); 279 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
287 convert(type, "Infinity", "0"); 294 convert(type, "Infinity", "0");
288 convert(type, "-Infinity", "0"); 295 convert(type, "-Infinity", "0");
289 convert(type, "NaN", "0"); 296 convert(type, "NaN", "0");
290 testNonNumericToNumeric(type); 297 testNonNumericToNumeric(type);
291 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 298 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
292 debug(""); 299 debug("");
293 300
294 type = "testEnforceRangeUnsignedLongLong"; 301 type = "testEnforceRangeUnsignedLongLong";
295 verifyAttribute(type); 302 verifyAttribute(type);
296 convert(type, "0"); 303 convert(type, "0");
304 convert(type, "-0", "0");
297 convertThrows(type, "-1"); 305 convertThrows(type, "-1");
298 convert(type, "1"); 306 convert(type, "1");
299 convert(type, "0x7F"); 307 convert(type, "0x7F");
300 convert(type, "0x80"); 308 convert(type, "0x80");
301 convert(type, "0xFF"); 309 convert(type, "0xFF");
302 convertThrows(type, "-0x80"); 310 convertThrows(type, "-0x80");
303 convertThrows(type, "-0x81"); 311 convertThrows(type, "-0x81");
304 convert(type, "0x7FFF"); 312 convert(type, "0x7FFF");
305 convert(type, "0x8000"); 313 convert(type, "0x8000");
306 convert(type, "0xFFFF"); 314 convert(type, "0xFFFF");
(...skipping 14 matching lines...) Expand all
321 convertThrows(type, "Infinity"); 329 convertThrows(type, "Infinity");
322 convertThrows(type, "-Infinity"); 330 convertThrows(type, "-Infinity");
323 convertThrows(type, "NaN"); 331 convertThrows(type, "NaN");
324 testNonNumericToNumericEnforceRange(type); 332 testNonNumericToNumericEnforceRange(type);
325 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 333 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
326 debug(""); 334 debug("");
327 335
328 type = "testByte"; 336 type = "testByte";
329 verifyAttribute(type); 337 verifyAttribute(type);
330 convert(type, "0"); 338 convert(type, "0");
339 convert(type, "-0", "0");
331 convert(type, "-1"); 340 convert(type, "-1");
332 convert(type, "1"); 341 convert(type, "1");
333 convert(type, "0x7F"); 342 convert(type, "0x7F");
334 convert(type, "0x80", "-0x80"); 343 convert(type, "0x80", "-0x80");
335 convert(type, "-0x7F"); 344 convert(type, "-0x7F");
336 convert(type, "-0x80"); 345 convert(type, "-0x80");
337 convert(type, "-0x81", "0x7F"); 346 convert(type, "-0x81", "0x7F");
338 convert(type, "0x1234", "0x34"); 347 convert(type, "0x1234", "0x34");
348 convert(type, "0xDCBA9876543210", "0x10");
339 convert(type, "Number.MIN_VALUE", "0"); 349 convert(type, "Number.MIN_VALUE", "0");
340 convert(type, "-Number.MIN_VALUE", "0"); 350 convert(type, "-Number.MIN_VALUE", "0");
341 convert(type, "Number.MAX_VALUE", "0"); 351 convert(type, "Number.MAX_VALUE", "0");
342 convert(type, "-Number.MAX_VALUE", "0"); 352 convert(type, "-Number.MAX_VALUE", "0");
343 convert(type, "1.99", "1"); 353 convert(type, "1.99", "1");
344 convert(type, "-1.99", "-1"); 354 convert(type, "-1.99", "-1");
345 convert(type, "4660.99", "0x34"); 355 convert(type, "4660.99", "0x34");
346 convert(type, "Infinity", "0"); 356 convert(type, "Infinity", "0");
347 convert(type, "-Infinity", "0"); 357 convert(type, "-Infinity", "0");
348 convert(type, "NaN", "0"); 358 convert(type, "NaN", "0");
349 testNonNumericToNumeric(type); 359 testNonNumericToNumeric(type);
350 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 360 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
351 debug(""); 361 debug("");
352 362
353 type = "testEnforceRangeByte"; 363 type = "testEnforceRangeByte";
354 verifyAttribute(type); 364 verifyAttribute(type);
355 convert(type, "0"); 365 convert(type, "0");
366 convert(type, "-0", "0");
356 convert(type, "-1"); 367 convert(type, "-1");
357 convert(type, "1"); 368 convert(type, "1");
358 convert(type, "0x7F"); 369 convert(type, "0x7F");
359 convertThrows(type, "0x80"); 370 convertThrows(type, "0x80");
360 convert(type, "-0x7F"); 371 convert(type, "-0x7F");
361 convert(type, "-0x80"); 372 convert(type, "-0x80");
362 convertThrows(type, "-0x81"); 373 convertThrows(type, "-0x81");
363 convertThrows(type, "0x1234"); 374 convertThrows(type, "0x1234");
364 convert(type, "Number.MIN_VALUE", "0"); 375 convert(type, "Number.MIN_VALUE", "0");
365 convert(type, "-Number.MIN_VALUE", "0"); 376 convert(type, "-Number.MIN_VALUE", "0");
366 convertThrows(type, "Number.MAX_VALUE"); 377 convertThrows(type, "Number.MAX_VALUE");
367 convertThrows(type, "-Number.MAX_VALUE"); 378 convertThrows(type, "-Number.MAX_VALUE");
368 convert(type, "1.99", "1"); 379 convert(type, "1.99", "1");
369 convert(type, "-1.99", "-1"); 380 convert(type, "-1.99", "-1");
370 convertThrows(type, "4660.99"); 381 convertThrows(type, "4660.99");
371 convertThrows(type, "Infinity"); 382 convertThrows(type, "Infinity");
372 convertThrows(type, "-Infinity"); 383 convertThrows(type, "-Infinity");
373 convertThrows(type, "NaN"); 384 convertThrows(type, "NaN");
374 testNonNumericToNumericEnforceRange(type); 385 testNonNumericToNumericEnforceRange(type);
375 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 386 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
376 debug(""); 387 debug("");
377 388
378 type = "testOctet"; 389 type = "testOctet";
379 verifyAttribute(type); 390 verifyAttribute(type);
380 convert(type, "0"); 391 convert(type, "0");
392 convert(type, "-0", "0");
381 convert(type, "-1", "0xFF"); 393 convert(type, "-1", "0xFF");
382 convert(type, "1"); 394 convert(type, "1");
383 convert(type, "0x7F"); 395 convert(type, "0x7F");
384 convert(type, "0x80"); 396 convert(type, "0x80");
385 convert(type, "0xFF"); 397 convert(type, "0xFF");
386 convert(type, "0x100", "0"); 398 convert(type, "0x100", "0");
387 convert(type, "0x101", "1"); 399 convert(type, "0x101", "1");
388 convert(type, "-0x80", "0x80"); 400 convert(type, "-0x80", "0x80");
389 convert(type, "-0x81", "0x7F"); 401 convert(type, "-0x81", "0x7F");
390 convert(type, "0x1234", "0x34"); 402 convert(type, "0x1234", "0x34");
403 convert(type, "0xDCBA9876543210", "0x10");
391 convert(type, "Number.MAX_VALUE", "0"); 404 convert(type, "Number.MAX_VALUE", "0");
392 convert(type, "Number.MIN_VALUE", "0"); 405 convert(type, "Number.MIN_VALUE", "0");
393 convert(type, "-Number.MAX_VALUE", "0"); 406 convert(type, "-Number.MAX_VALUE", "0");
394 convert(type, "-Number.MIN_VALUE", "0"); 407 convert(type, "-Number.MIN_VALUE", "0");
395 convert(type, "1.99", "1"); 408 convert(type, "1.99", "1");
396 convert(type, "-1.99", "0xFF"); 409 convert(type, "-1.99", "0xFF");
397 convert(type, "4660.99", "0x34"); 410 convert(type, "4660.99", "0x34");
398 convert(type, "Infinity", "0"); 411 convert(type, "Infinity", "0");
399 convert(type, "-Infinity", "0"); 412 convert(type, "-Infinity", "0");
400 convert(type, "NaN", "0"); 413 convert(type, "NaN", "0");
401 testNonNumericToNumeric(type); 414 testNonNumericToNumeric(type);
402 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 415 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
403 debug(""); 416 debug("");
404 417
405 type = "testEnforceRangeOctet"; 418 type = "testEnforceRangeOctet";
406 verifyAttribute(type); 419 verifyAttribute(type);
407 convert(type, "0"); 420 convert(type, "0");
421 convert(type, "-0", "0");
408 convertThrows(type, "-1"); 422 convertThrows(type, "-1");
409 convert(type, "1"); 423 convert(type, "1");
410 convert(type, "0x7F"); 424 convert(type, "0x7F");
411 convert(type, "0x80"); 425 convert(type, "0x80");
412 convert(type, "0xFF"); 426 convert(type, "0xFF");
413 convertThrows(type, "0x100"); 427 convertThrows(type, "0x100");
414 convertThrows(type, "0x101"); 428 convertThrows(type, "0x101");
415 convertThrows(type, "-0x80"); 429 convertThrows(type, "-0x80");
416 convertThrows(type, "-0x81"); 430 convertThrows(type, "-0x81");
417 convertThrows(type, "0x1234"); 431 convertThrows(type, "0x1234");
418 convertThrows(type, "Number.MAX_VALUE"); 432 convertThrows(type, "Number.MAX_VALUE");
419 convert(type, "Number.MIN_VALUE", "0"); 433 convert(type, "Number.MIN_VALUE", "0");
420 convertThrows(type, "-Number.MAX_VALUE"); 434 convertThrows(type, "-Number.MAX_VALUE");
421 convert(type, "-Number.MIN_VALUE", "0"); 435 convert(type, "-Number.MIN_VALUE", "0");
422 convert(type, "1.99", "1"); 436 convert(type, "1.99", "1");
423 convertThrows(type, "-1.99"); 437 convertThrows(type, "-1.99");
424 convertThrows(type, "4660.99"); 438 convertThrows(type, "4660.99");
425 convertThrows(type, "Infinity"); 439 convertThrows(type, "Infinity");
426 convertThrows(type, "-Infinity"); 440 convertThrows(type, "-Infinity");
427 convertThrows(type, "NaN"); 441 convertThrows(type, "NaN");
428 testNonNumericToNumericEnforceRange(type); 442 testNonNumericToNumericEnforceRange(type);
429 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 443 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
430 debug(""); 444 debug("");
431 445
446 type = "testShort";
447 verifyAttribute(type);
448 convert(type, "0");
449 convert(type, "-0", "0");
450 convert(type, "-1");
451 convert(type, "1");
452 convert(type, "0x7F");
453 convert(type, "0x80");
454 convert(type, "0xFF");
455 convert(type, "-0x80");
456 convert(type, "-0x81");
457 convert(type, "0x7FFF");
458 convert(type, "0x8000", "-0x8000");
459 convert(type, "0xFFFF", "-1");
460 convert(type, "-0x8000");
461 convert(type, "-0x8001", "0x7FFF");
462 convert(type, "0xDCBA9876543210", "0x3210");
463 convert(type, "Number.MAX_VALUE", "0");
464 convert(type, "Number.MIN_VALUE", "0");
465 convert(type, "-Number.MAX_VALUE", "0");
466 convert(type, "-Number.MIN_VALUE", "0");
467 convert(type, "1.99", "1");
468 convert(type, "-1.99", "-1");
469 convert(type, "Infinity", "0");
470 convert(type, "-Infinity", "0");
471 convert(type, "NaN", "0");
472 testNonNumericToNumeric(type);
473 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
474 debug("");
475
476 type = "testEnforceRangeShort";
477 verifyAttribute(type);
478 convert(type, "0");
479 convert(type, "-0", "0");
480 convert(type, "-1");
481 convert(type, "1");
482 convert(type, "0x7F");
483 convert(type, "0x80");
484 convert(type, "0xFF");
485 convert(type, "-0x80");
486 convert(type, "-0x81");
487 convert(type, "0x7FFF");
488 convertThrows(type, "0x8000");
489 convertThrows(type, "0xFFFF");
490 convert(type, "-0x8000");
491 convertThrows(type, "-0x8001");
492 convertThrows(type, "0xDCBA9876543210");
493 convertThrows(type, "Number.MAX_VALUE");
494 convert(type, "Number.MIN_VALUE", "0");
495 convertThrows(type, "-Number.MAX_VALUE");
496 convert(type, "-Number.MIN_VALUE", "0");
497 convert(type, "1.99", "1");
498 convert(type, "-1.99", "-1");
499 convertThrows(type, "Infinity");
500 convertThrows(type, "-Infinity");
501 convertThrows(type, "NaN");
502 testNonNumericToNumericEnforceRange(type);
503 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
504 debug("");
505
506 type = "testUnsignedShort";
507 verifyAttribute(type);
508 convert(type, "0");
509 convert(type, "-0", "0");
510 convert(type, "-1", "0xFFFF");
511 convert(type, "1");
512 convert(type, "0x7F");
513 convert(type, "0x80");
514 convert(type, "0xFF");
515 convert(type, "-0x80", "0xFF80");
516 convert(type, "-0x81", "0xFF7F");
517 convert(type, "0x7FFF");
518 convert(type, "0x8000");
519 convert(type, "0xFFFF");
520 convert(type, "0x10000", "0");
521 convert(type, "-0x8000", "0x8000");
522 convert(type, "-0x8001", "0x7FFF");
523 convert(type, "0xDCBA9876543210", "0x3210");
524 convert(type, "Number.MAX_VALUE", "0");
525 convert(type, "Number.MIN_VALUE", "0");
526 convert(type, "-Number.MAX_VALUE", "0");
527 convert(type, "-Number.MIN_VALUE", "0");
528 convert(type, "1.99", "1");
529 convert(type, "-1.99", "0xFFFF");
530 convert(type, "Infinity", "0");
531 convert(type, "-Infinity", "0");
532 convert(type, "NaN", "0");
533 testNonNumericToNumeric(type);
534 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
535 debug("");
536
537 type = "testEnforceRangeUnsignedShort";
538 verifyAttribute(type);
539 convert(type, "0");
540 convert(type, "-0", "0");
541 convertThrows(type, "-1");
542 convert(type, "1");
543 convert(type, "0x7F");
544 convert(type, "0x80");
545 convert(type, "0xFF");
546 convertThrows(type, "-0x80");
547 convertThrows(type, "-0x81");
548 convert(type, "0x7FFF");
549 convert(type, "0x8000");
550 convert(type, "0xFFFF");
551 convertThrows(type, "0x10000");
552 convertThrows(type, "-0x8000");
553 convertThrows(type, "-0x8001");
554 convert(type, "0x3210");
555 convertThrows(type, "Number.MAX_VALUE");
556 convert(type, "Number.MIN_VALUE", "0");
557 convertThrows(type, "-Number.MAX_VALUE");
558 convert(type, "-Number.MIN_VALUE", "0");
559 convert(type, "1.99", "1");
560 convertThrows(type, "-1.99");
561 convertThrows(type, "Infinity");
562 convertThrows(type, "-Infinity");
563 convertThrows(type, "NaN");
564 testNonNumericToNumericEnforceRange(type);
565 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
566 debug("");
567
432 </script> 568 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/js/webidl-type-mapping-expected.txt » ('j') | Source/bindings/scripts/code_generator_v8.pm » ('J')

Powered by Google App Engine
This is Rietveld 408576698