mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-23 05:20:29 +02:00
Added typed array unit test
This commit is contained in:
parent
28438d66b1
commit
a76ebae771
1 changed files with 22 additions and 3 deletions
|
@ -11,12 +11,31 @@
|
|||
|
||||
Script.include("Test.js");
|
||||
|
||||
test("ArrayBuffer", function(finished) {
|
||||
this.assertEquals(new ArrayBuffer().byteLength, 0, 'no length');
|
||||
test('ArrayBuffer', function(finished) {
|
||||
this.assertEquals(new ArrayBuffer(0).byteLength, 0, 'no length');
|
||||
|
||||
this.assertEquals(typeof(new ArrayBuffer(0)), 'object', 'creation');
|
||||
this.assertEquals(typeof(new ArrayBuffer(1)), 'object', 'creation');
|
||||
this.assertEquals(typeof(new ArrayBuffer(123)), 'object', 'creation');
|
||||
|
||||
this.assertEquals(new ArrayBuffer(123).byteLength, 123, 'length');
|
||||
});
|
||||
});
|
||||
|
||||
test('DataView constructors', function (finished) {
|
||||
var d = new DataView(new ArrayBuffer(8));
|
||||
|
||||
d.setUint32(0, 0x12345678);
|
||||
this.assertEquals(d.getUint32(0), 0x12345678, 'big endian/big endian');
|
||||
|
||||
d.setUint32(0, 0x12345678, true);
|
||||
this.assertEquals(d.getUint32(0, true), 0x12345678, 'little endian/little endian');
|
||||
|
||||
d.setUint32(0, 0x12345678, true);
|
||||
this.assertEquals(d.getUint32(0), 0x78563412, 'little endian/big endian');
|
||||
|
||||
d.setUint32(0, 0x12345678);
|
||||
this.assertEquals(d.getUint32(0, true), 0x78563412, 'big endian/little endian');
|
||||
|
||||
// raises(function () { return new DataView({}); }, 'non-ArrayBuffer argument');
|
||||
// raises(function () { return new DataView("bogus"); }, TypeError, 'non-ArrayBuffer argument');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue