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

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: Fix test failure 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");
339 convert(type, "Number.MIN_VALUE", "0"); 348 convert(type, "Number.MIN_VALUE", "0");
340 convert(type, "-Number.MIN_VALUE", "0"); 349 convert(type, "-Number.MIN_VALUE", "0");
341 convert(type, "Number.MAX_VALUE", "0"); 350 convert(type, "Number.MAX_VALUE", "0");
342 convert(type, "-Number.MAX_VALUE", "0"); 351 convert(type, "-Number.MAX_VALUE", "0");
343 convert(type, "1.99", "1"); 352 convert(type, "1.99", "1");
344 convert(type, "-1.99", "-1"); 353 convert(type, "-1.99", "-1");
345 convert(type, "4660.99", "0x34"); 354 convert(type, "4660.99", "0x34");
346 convert(type, "Infinity", "0"); 355 convert(type, "Infinity", "0");
347 convert(type, "-Infinity", "0"); 356 convert(type, "-Infinity", "0");
348 convert(type, "NaN", "0"); 357 convert(type, "NaN", "0");
349 testNonNumericToNumeric(type); 358 testNonNumericToNumeric(type);
350 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 359 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
351 debug(""); 360 debug("");
352 361
353 type = "testEnforceRangeByte"; 362 type = "testEnforceRangeByte";
354 verifyAttribute(type); 363 verifyAttribute(type);
355 convert(type, "0"); 364 convert(type, "0");
365 convert(type, "-0", "0");
356 convert(type, "-1"); 366 convert(type, "-1");
357 convert(type, "1"); 367 convert(type, "1");
358 convert(type, "0x7F"); 368 convert(type, "0x7F");
359 convertThrows(type, "0x80"); 369 convertThrows(type, "0x80");
360 convert(type, "-0x7F"); 370 convert(type, "-0x7F");
361 convert(type, "-0x80"); 371 convert(type, "-0x80");
362 convertThrows(type, "-0x81"); 372 convertThrows(type, "-0x81");
363 convertThrows(type, "0x1234"); 373 convertThrows(type, "0x1234");
364 convert(type, "Number.MIN_VALUE", "0"); 374 convert(type, "Number.MIN_VALUE", "0");
365 convert(type, "-Number.MIN_VALUE", "0"); 375 convert(type, "-Number.MIN_VALUE", "0");
366 convertThrows(type, "Number.MAX_VALUE"); 376 convertThrows(type, "Number.MAX_VALUE");
367 convertThrows(type, "-Number.MAX_VALUE"); 377 convertThrows(type, "-Number.MAX_VALUE");
368 convert(type, "1.99", "1"); 378 convert(type, "1.99", "1");
369 convert(type, "-1.99", "-1"); 379 convert(type, "-1.99", "-1");
370 convertThrows(type, "4660.99"); 380 convertThrows(type, "4660.99");
371 convertThrows(type, "Infinity"); 381 convertThrows(type, "Infinity");
372 convertThrows(type, "-Infinity"); 382 convertThrows(type, "-Infinity");
373 convertThrows(type, "NaN"); 383 convertThrows(type, "NaN");
374 testNonNumericToNumericEnforceRange(type); 384 testNonNumericToNumericEnforceRange(type);
375 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 385 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
376 debug(""); 386 debug("");
377 387
378 type = "testOctet"; 388 type = "testOctet";
379 verifyAttribute(type); 389 verifyAttribute(type);
380 convert(type, "0"); 390 convert(type, "0");
391 convert(type, "-0", "0");
381 convert(type, "-1", "0xFF"); 392 convert(type, "-1", "0xFF");
382 convert(type, "1"); 393 convert(type, "1");
383 convert(type, "0x7F"); 394 convert(type, "0x7F");
384 convert(type, "0x80"); 395 convert(type, "0x80");
385 convert(type, "0xFF"); 396 convert(type, "0xFF");
386 convert(type, "0x100", "0"); 397 convert(type, "0x100", "0");
387 convert(type, "0x101", "1"); 398 convert(type, "0x101", "1");
388 convert(type, "-0x80", "0x80"); 399 convert(type, "-0x80", "0x80");
389 convert(type, "-0x81", "0x7F"); 400 convert(type, "-0x81", "0x7F");
390 convert(type, "0x1234", "0x34"); 401 convert(type, "0x1234", "0x34");
391 convert(type, "Number.MAX_VALUE", "0"); 402 convert(type, "Number.MAX_VALUE", "0");
392 convert(type, "Number.MIN_VALUE", "0"); 403 convert(type, "Number.MIN_VALUE", "0");
393 convert(type, "-Number.MAX_VALUE", "0"); 404 convert(type, "-Number.MAX_VALUE", "0");
394 convert(type, "-Number.MIN_VALUE", "0"); 405 convert(type, "-Number.MIN_VALUE", "0");
395 convert(type, "1.99", "1"); 406 convert(type, "1.99", "1");
396 convert(type, "-1.99", "0xFF"); 407 convert(type, "-1.99", "0xFF");
397 convert(type, "4660.99", "0x34"); 408 convert(type, "4660.99", "0x34");
398 convert(type, "Infinity", "0"); 409 convert(type, "Infinity", "0");
399 convert(type, "-Infinity", "0"); 410 convert(type, "-Infinity", "0");
400 convert(type, "NaN", "0"); 411 convert(type, "NaN", "0");
401 testNonNumericToNumeric(type); 412 testNonNumericToNumeric(type);
402 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 413 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
403 debug(""); 414 debug("");
404 415
405 type = "testEnforceRangeOctet"; 416 type = "testEnforceRangeOctet";
406 verifyAttribute(type); 417 verifyAttribute(type);
407 convert(type, "0"); 418 convert(type, "0");
419 convert(type, "-0", "0");
408 convertThrows(type, "-1"); 420 convertThrows(type, "-1");
409 convert(type, "1"); 421 convert(type, "1");
410 convert(type, "0x7F"); 422 convert(type, "0x7F");
411 convert(type, "0x80"); 423 convert(type, "0x80");
412 convert(type, "0xFF"); 424 convert(type, "0xFF");
413 convertThrows(type, "0x100"); 425 convertThrows(type, "0x100");
414 convertThrows(type, "0x101"); 426 convertThrows(type, "0x101");
415 convertThrows(type, "-0x80"); 427 convertThrows(type, "-0x80");
416 convertThrows(type, "-0x81"); 428 convertThrows(type, "-0x81");
417 convertThrows(type, "0x1234"); 429 convertThrows(type, "0x1234");
418 convertThrows(type, "Number.MAX_VALUE"); 430 convertThrows(type, "Number.MAX_VALUE");
419 convert(type, "Number.MIN_VALUE", "0"); 431 convert(type, "Number.MIN_VALUE", "0");
420 convertThrows(type, "-Number.MAX_VALUE"); 432 convertThrows(type, "-Number.MAX_VALUE");
421 convert(type, "-Number.MIN_VALUE", "0"); 433 convert(type, "-Number.MIN_VALUE", "0");
422 convert(type, "1.99", "1"); 434 convert(type, "1.99", "1");
423 convertThrows(type, "-1.99"); 435 convertThrows(type, "-1.99");
424 convertThrows(type, "4660.99"); 436 convertThrows(type, "4660.99");
425 convertThrows(type, "Infinity"); 437 convertThrows(type, "Infinity");
426 convertThrows(type, "-Infinity"); 438 convertThrows(type, "-Infinity");
427 convertThrows(type, "NaN"); 439 convertThrows(type, "NaN");
428 testNonNumericToNumericEnforceRange(type); 440 testNonNumericToNumericEnforceRange(type);
429 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 441 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
430 debug(""); 442 debug("");
431 443
444 type = "testShort";
445 verifyAttribute(type);
446 convert(type, "0");
447 convert(type, "-0", "0");
448 convert(type, "-1");
449 convert(type, "1");
450 convert(type, "0x7F");
451 convert(type, "0x80");
452 convert(type, "0xFF");
453 convert(type, "-0x80");
454 convert(type, "-0x81");
455 convert(type, "0x7FFF");
456 convert(type, "0x8000", "-0x8000");
457 convert(type, "0xFFFF", "-1");
458 convert(type, "-0x8000");
459 convert(type, "-0x8001", "0x7FFF");
460 convert(type, "0xDCBA9876543210", "0x3210");
461 convert(type, "Number.MAX_VALUE", "0");
462 convert(type, "Number.MIN_VALUE", "0");
463 convert(type, "-Number.MAX_VALUE", "0");
464 convert(type, "-Number.MIN_VALUE", "0");
465 convert(type, "1.99", "1");
466 convert(type, "-1.99", "-1");
467 convert(type, "Infinity", "0");
468 convert(type, "-Infinity", "0");
469 convert(type, "NaN", "0");
470 testNonNumericToNumeric(type);
471 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
472 debug("");
473
474 type = "testEnforceRangeShort";
475 verifyAttribute(type);
476 convert(type, "0");
477 convert(type, "-0", "0");
478 convert(type, "-1");
479 convert(type, "1");
480 convert(type, "0x7F");
481 convert(type, "0x80");
482 convert(type, "0xFF");
483 convert(type, "-0x80");
484 convert(type, "-0x81");
485 convert(type, "0x7FFF");
486 convertThrows(type, "0x8000");
487 convertThrows(type, "0xFFFF");
488 convert(type, "-0x8000");
489 convertThrows(type, "-0x8001");
490 convertThrows(type, "0xDCBA9876543210");
491 convertThrows(type, "Number.MAX_VALUE");
492 convert(type, "Number.MIN_VALUE", "0");
493 convertThrows(type, "-Number.MAX_VALUE");
494 convert(type, "-Number.MIN_VALUE", "0");
495 convert(type, "1.99", "1");
496 convert(type, "-1.99", "-1");
497 convertThrows(type, "Infinity");
498 convertThrows(type, "-Infinity");
499 convertThrows(type, "NaN");
500 testNonNumericToNumericEnforceRange(type);
501 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
502 debug("");
503
504 type = "testUnsignedShort";
505 verifyAttribute(type);
506 convert(type, "0");
507 convert(type, "-0", "0");
508 convert(type, "-1", "0xFFFF");
509 convert(type, "1");
510 convert(type, "0x7F");
511 convert(type, "0x80");
512 convert(type, "0xFF");
513 convert(type, "-0x80", "0xFF80");
514 convert(type, "-0x81", "0xFF7F");
515 convert(type, "0x7FFF");
516 convert(type, "0x8000");
517 convert(type, "0xFFFF");
518 convert(type, "0x10000", "0");
519 convert(type, "-0x8000", "0x8000");
520 convert(type, "-0x8001", "0x7FFF");
521 convert(type, "0xDCBA9876543210", "0x3210");
522 convert(type, "Number.MAX_VALUE", "0");
523 convert(type, "Number.MIN_VALUE", "0");
524 convert(type, "-Number.MAX_VALUE", "0");
525 convert(type, "-Number.MIN_VALUE", "0");
526 convert(type, "1.99", "1");
527 convert(type, "-1.99", "0xFFFF");
528 convert(type, "Infinity", "0");
529 convert(type, "-Infinity", "0");
530 convert(type, "NaN", "0");
531 testNonNumericToNumeric(type);
532 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
533 debug("");
534
535 type = "testEnforceRangeUnsignedShort";
536 verifyAttribute(type);
537 convert(type, "0");
538 convert(type, "-0", "0");
539 convertThrows(type, "-1");
540 convert(type, "1");
541 convert(type, "0x7F");
542 convert(type, "0x80");
543 convert(type, "0xFF");
544 convertThrows(type, "-0x80");
545 convertThrows(type, "-0x81");
546 convert(type, "0x7FFF");
547 convert(type, "0x8000");
548 convert(type, "0xFFFF");
549 convertThrows(type, "0x10000");
550 convertThrows(type, "-0x8000");
551 convertThrows(type, "-0x8001");
552 convert(type, "0x3210");
553 convertThrows(type, "Number.MAX_VALUE");
554 convert(type, "Number.MIN_VALUE", "0");
555 convertThrows(type, "-Number.MAX_VALUE");
556 convert(type, "-Number.MIN_VALUE", "0");
557 convert(type, "1.99", "1");
558 convertThrows(type, "-1.99");
559 convertThrows(type, "Infinity");
560 convertThrows(type, "-Infinity");
561 convertThrows(type, "NaN");
562 testNonNumericToNumericEnforceRange(type);
563 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
564 debug("");
565
432 </script> 566 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/js/webidl-type-mapping-expected.txt » ('j') | Source/bindings/v8/V8Binding.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698