OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 a[s2] = 255; | 523 a[s2] = 255; |
524 assertEquals(undefined, a["-0"]); | 524 assertEquals(undefined, a["-0"]); |
525 assertEquals(255, a[s2]); | 525 assertEquals(255, a[s2]); |
526 assertEquals(0, a[-0]); | 526 assertEquals(0, a[-0]); |
527 | 527 |
528 /* Chromium bug: 424619 | 528 /* Chromium bug: 424619 |
529 * a[-Infinity] = 50; | 529 * a[-Infinity] = 50; |
530 * assertEquals(undefined, a[-Infinity]); | 530 * assertEquals(undefined, a[-Infinity]); |
531 */ | 531 */ |
532 a[1.5] = 10; | 532 a[1.5] = 10; |
533 assertEquals(10, a[1.5]); | 533 assertEquals(undefined, a[1.5]); |
534 var nan = Math.sqrt(-1); | 534 var nan = Math.sqrt(-1); |
535 a[nan] = 5; | 535 a[nan] = 5; |
536 assertEquals(5, a[nan]); | 536 assertEquals(5, a[nan]); |
537 | 537 |
538 var x = 0; | 538 var x = 0; |
539 var y = -0; | 539 var y = -0; |
540 assertEquals(Infinity, 1/x); | 540 assertEquals(Infinity, 1/x); |
541 assertEquals(-Infinity, 1/y); | 541 assertEquals(-Infinity, 1/y); |
542 a[x] = 5; | 542 a[x] = 5; |
543 a[y] = 27; | 543 a[y] = 27; |
(...skipping 28 matching lines...) Expand all Loading... |
572 a[s2] = 255; | 572 a[s2] = 255; |
573 assertEquals(undefined, a["-0"]); | 573 assertEquals(undefined, a["-0"]); |
574 assertEquals(255, a[s2]); | 574 assertEquals(255, a[s2]); |
575 assertEquals(0, a[-0]); | 575 assertEquals(0, a[-0]); |
576 | 576 |
577 /* Chromium bug: 424619 | 577 /* Chromium bug: 424619 |
578 * a[-Infinity] = 50; | 578 * a[-Infinity] = 50; |
579 * assertEquals(undefined, a[-Infinity]); | 579 * assertEquals(undefined, a[-Infinity]); |
580 */ | 580 */ |
581 a[1.5] = 10; | 581 a[1.5] = 10; |
582 assertEquals(10, a[1.5]); | 582 assertEquals(undefined, a[1.5]); |
583 var nan = Math.sqrt(-1); | 583 var nan = Math.sqrt(-1); |
584 a[nan] = 5; | 584 a[nan] = 5; |
585 assertEquals(5, a[nan]); | 585 assertEquals(5, a[nan]); |
586 | 586 |
587 var x = 0; | 587 var x = 0; |
588 var y = -0; | 588 var y = -0; |
589 assertEquals(Infinity, 1/x); | 589 assertEquals(Infinity, 1/x); |
590 assertEquals(-Infinity, 1/y); | 590 assertEquals(-Infinity, 1/y); |
591 a[x] = 5; | 591 a[x] = 5; |
592 a[y] = 27; | 592 a[y] = 27; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 TestArbitrary(new ArrayBuffer(256)); | 712 TestArbitrary(new ArrayBuffer(256)); |
713 for(i = 0; i < typedArrayConstructors.length; i++) { | 713 for(i = 0; i < typedArrayConstructors.length; i++) { |
714 TestArbitrary(new typedArrayConstructors[i](10)); | 714 TestArbitrary(new typedArrayConstructors[i](10)); |
715 } | 715 } |
716 TestArbitrary(new DataView(new ArrayBuffer(256))); | 716 TestArbitrary(new DataView(new ArrayBuffer(256))); |
717 | 717 |
718 | 718 |
719 // Test direct constructor call | 719 // Test direct constructor call |
720 assertThrows(function() { ArrayBuffer(); }, TypeError); | 720 assertThrows(function() { ArrayBuffer(); }, TypeError); |
721 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); | 721 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); |
OLD | NEW |