| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // Mixed types of same size. | 446 // Mixed types of same size. |
| 447 var a61 = new Float32Array([1.2, 12.3]) | 447 var a61 = new Float32Array([1.2, 12.3]) |
| 448 var a62 = new Int32Array(2) | 448 var a62 = new Int32Array(2) |
| 449 a62.set(a61) | 449 a62.set(a61) |
| 450 assertArrayPrefix([1, 12], a62) | 450 assertArrayPrefix([1, 12], a62) |
| 451 a61.set(a62) | 451 a61.set(a62) |
| 452 assertArrayPrefix([1, 12], a61) | 452 assertArrayPrefix([1, 12], a61) |
| 453 | 453 |
| 454 // Invalid source | 454 // Invalid source |
| 455 var a = new Uint16Array(50); | 455 var a = new Uint16Array(50); |
| 456 assertThrows(function() { a.set(0) }, TypeError); | 456 var expected = []; |
| 457 assertThrows(function() { a.set({}) }, TypeError); | 457 for (i = 0; i < 50; i++) { |
| 458 a[i] = i; |
| 459 expected.push(i); |
| 460 } |
| 461 a.set(0); |
| 462 assertArrayPrefix(expected, a); |
| 463 a.set({}); |
| 464 assertArrayPrefix(expected, a); |
| 458 assertThrows(function() { a.set.call({}) }, TypeError); | 465 assertThrows(function() { a.set.call({}) }, TypeError); |
| 459 assertThrows(function() { a.set.call([]) }, TypeError); | 466 assertThrows(function() { a.set.call([]) }, TypeError); |
| 460 } | 467 } |
| 461 | 468 |
| 462 TestTypedArraySet(); | 469 TestTypedArraySet(); |
| 463 | 470 |
| 464 // DataView | 471 // DataView |
| 465 function TestDataViewConstructor() { | 472 function TestDataViewConstructor() { |
| 466 var ab = new ArrayBuffer(256); | 473 var ab = new ArrayBuffer(256); |
| 467 | 474 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 TestArbitrary(new ArrayBuffer(256)); | 570 TestArbitrary(new ArrayBuffer(256)); |
| 564 for(i = 0; i < typedArrayConstructors.lenght; i++) { | 571 for(i = 0; i < typedArrayConstructors.lenght; i++) { |
| 565 TestArbitary(new typedArrayConstructors[i](10)); | 572 TestArbitary(new typedArrayConstructors[i](10)); |
| 566 } | 573 } |
| 567 TestArbitrary(new DataView(new ArrayBuffer(256))); | 574 TestArbitrary(new DataView(new ArrayBuffer(256))); |
| 568 | 575 |
| 569 | 576 |
| 570 // Test direct constructor call | 577 // Test direct constructor call |
| 571 assertThrows(function() { ArrayBuffer(); }, TypeError); | 578 assertThrows(function() { ArrayBuffer(); }, TypeError); |
| 572 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); | 579 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); |
| OLD | NEW |