mirror of https://github.com/tc39/test262.git
Update tests for TypedArrays, DataView and ArrayBuffer
Ref tc39/ecma262#410
This commit is contained in:
parent
dee1526ca7
commit
cfc77c83e3
|
@ -1,21 +1,18 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.1.2.1
|
||||
esid: sec-arraybuffer-length
|
||||
description: >
|
||||
The `length` parameter must be a positive, numeric integral value.
|
||||
info: >
|
||||
Returns an empty instance if length is absent
|
||||
info: |
|
||||
ArrayBuffer( length )
|
||||
|
||||
...
|
||||
2. Let numberLength be ToNumber(length).
|
||||
3. Let byteLength be ToLength(numberLength).
|
||||
4. ReturnIfAbrupt(byteLength).
|
||||
5. If SameValueZero(numberLength, byteLength) is false, throw a RangeError exception.
|
||||
...
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
2. Let byteLength be ? ToIndex(length).
|
||||
3. Return ? AllocateArrayBuffer(NewTarget, byteLength).
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer();
|
||||
}, "`length` parameter absent");
|
||||
var buffer = new ArrayBuffer();
|
||||
|
||||
assert.sameValue(buffer.byteLength, 0);
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.1.2.1
|
||||
description: >
|
||||
The `length` parameter is converted to a number value.
|
||||
info: >
|
||||
ArrayBuffer( length )
|
||||
|
||||
...
|
||||
2. Let numberLength be ToNumber(length).
|
||||
3. Let byteLength be ToLength(numberLength).
|
||||
4. ReturnIfAbrupt(byteLength).
|
||||
5. If SameValueZero(numberLength, byteLength) is false, throw a RangeError exception.
|
||||
...
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(undefined);
|
||||
}, "`length` parameter is undefined");
|
||||
|
||||
var result = new ArrayBuffer(null);
|
||||
assert.sameValue(result.byteLength, 0, "`length` parameter is null");
|
||||
|
||||
var result = new ArrayBuffer(true);
|
||||
assert.sameValue(result.byteLength, 1, "`length` parameter is a Boolean");
|
||||
|
||||
var result = new ArrayBuffer("");
|
||||
assert.sameValue(result.byteLength, 0, "`length` parameter is a String");
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new ArrayBuffer(Symbol());
|
||||
}, "`length` parameter is a Symbol");
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.1.2.1
|
||||
esid: sec-arraybuffer-length
|
||||
description: >
|
||||
Throws a RangeError if length >= 2 ** 53
|
||||
info: >
|
||||
ArrayBuffer( length )
|
||||
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
2. Let byteLength be ? ToIndex(length).
|
||||
|
||||
ToIndex( value )
|
||||
|
||||
1. If value is undefined, then
|
||||
a. Let index be 0.
|
||||
2. Else,
|
||||
a. Let integerIndex be ? ToInteger(value).
|
||||
b. If integerIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
// Math.pow(2, 53) = 9007199254740992
|
||||
new ArrayBuffer(9007199254740992);
|
||||
}, "`length` parameter is too large");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(Infinity);
|
||||
}, "`length` parameter is positive Infinity");
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-arraybuffer-length
|
||||
description: >
|
||||
Throws a Range Error if length represents an integer < 0
|
||||
info: |
|
||||
ArrayBuffer( length )
|
||||
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
2. Let byteLength be ? ToIndex(length).
|
||||
|
||||
ToIndex( value )
|
||||
|
||||
1. If value is undefined, then
|
||||
a. Let index be 0.
|
||||
2. Else,
|
||||
a. Let integerIndex be ? ToInteger(value).
|
||||
b. If integerIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(-1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(-1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(-Infinity);
|
||||
});
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.1.2.1
|
||||
description: >
|
||||
The `length` parameter is converted to a number value.
|
||||
info: >
|
||||
ArrayBuffer( length )
|
||||
|
||||
...
|
||||
2. Let numberLength be ToNumber(length).
|
||||
...
|
||||
---*/
|
||||
|
||||
var log = "";
|
||||
var lengthValue = {
|
||||
valueOf: function() {
|
||||
log += "ok";
|
||||
return 10;
|
||||
}
|
||||
};
|
||||
|
||||
var arrayBuffer = new ArrayBuffer(lengthValue);
|
||||
|
||||
assert.sameValue(log, "ok");
|
||||
assert.sameValue(arrayBuffer.byteLength, 10);
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.1.2.1
|
||||
description: >
|
||||
The `length` parameter must be a positive, numeric integral value.
|
||||
info: >
|
||||
ArrayBuffer( length )
|
||||
|
||||
...
|
||||
2. Let numberLength be ToNumber(length).
|
||||
3. Let byteLength be ToLength(numberLength).
|
||||
4. ReturnIfAbrupt(byteLength).
|
||||
5. If SameValueZero(numberLength, byteLength) is false, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(-10);
|
||||
}, "`length` parameter is negative");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(3.8);
|
||||
}, "`length` parameter is not integral value");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
// Math.pow(2, 53) = 9007199254740992
|
||||
new ArrayBuffer(9007199254740992);
|
||||
}, "`length` parameter is too large");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(+Infinity);
|
||||
}, "`length` parameter is positive Infinity");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(-Infinity);
|
||||
}, "`length` parameter is negative Infinity");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new ArrayBuffer(NaN);
|
||||
}, "`length` parameter is NaN");
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-arraybuffer-length
|
||||
description: >
|
||||
Throws a TypeError if length is a symbol
|
||||
info: |
|
||||
ArrayBuffer( length )
|
||||
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
2. Let byteLength be ? ToIndex(length).
|
||||
...
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var s = Symbol();
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new ArrayBuffer(s);
|
||||
}, "`length` parameter is a Symbol");
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-arraybuffer-length
|
||||
description: >
|
||||
Return abrupt from ToIndex(length)
|
||||
info: |
|
||||
ArrayBuffer( length )
|
||||
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
2. Let byteLength be ? ToIndex(length).
|
||||
...
|
||||
---*/
|
||||
|
||||
var len = {
|
||||
valueOf: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
new ArrayBuffer(len);
|
||||
});
|
|
@ -0,0 +1,87 @@
|
|||
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-arraybuffer-length
|
||||
description: >
|
||||
The `length` parameter is converted to a value numeric index value.
|
||||
info: |
|
||||
ArrayBuffer( length )
|
||||
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
2. Let byteLength be ? ToIndex(length).
|
||||
3. Return ? AllocateArrayBuffer(NewTarget, byteLength).
|
||||
|
||||
ToIndex( value )
|
||||
|
||||
1. If value is undefined, then
|
||||
a. Let index be 0.
|
||||
2. Else,
|
||||
a. Let integerIndex be ? ToInteger(value).
|
||||
b. If integerIndex < 0, throw a RangeError exception.
|
||||
c. Let index be ! ToLength(integerIndex).
|
||||
d. If SameValueZero(integerIndex, index) is false, throw a RangeError exception.
|
||||
3. Return index.
|
||||
---*/
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
var buffer;
|
||||
|
||||
buffer = new ArrayBuffer(obj1);
|
||||
assert.sameValue(buffer.byteLength, 42, "object's valueOf");
|
||||
|
||||
buffer = new ArrayBuffer(obj2);
|
||||
assert.sameValue(buffer.byteLength, 42, "object's toString");
|
||||
|
||||
buffer = new ArrayBuffer("");
|
||||
assert.sameValue(buffer.byteLength, 0, "the Empty string");
|
||||
|
||||
buffer = new ArrayBuffer("0");
|
||||
assert.sameValue(buffer.byteLength, 0, "string '0'");
|
||||
|
||||
buffer = new ArrayBuffer("1");
|
||||
assert.sameValue(buffer.byteLength, 1, "string '1'");
|
||||
|
||||
buffer = new ArrayBuffer(true);
|
||||
assert.sameValue(buffer.byteLength, 1, "true");
|
||||
|
||||
buffer = new ArrayBuffer(false);
|
||||
assert.sameValue(buffer.byteLength, 0, "false");
|
||||
|
||||
buffer = new ArrayBuffer(NaN);
|
||||
assert.sameValue(buffer.byteLength, 0, "NaN");
|
||||
|
||||
buffer = new ArrayBuffer(null);
|
||||
assert.sameValue(buffer.byteLength, 0, "null");
|
||||
|
||||
buffer = new ArrayBuffer(undefined);
|
||||
assert.sameValue(buffer.byteLength, 0, "undefined");
|
||||
|
||||
buffer = new ArrayBuffer(0.1);
|
||||
assert.sameValue(buffer.byteLength, 0, "0.1");
|
||||
|
||||
buffer = new ArrayBuffer(0.9);
|
||||
assert.sameValue(buffer.byteLength, 0, "0.9");
|
||||
|
||||
buffer = new ArrayBuffer(1.1);
|
||||
assert.sameValue(buffer.byteLength, 1, "1.1");
|
||||
|
||||
buffer = new ArrayBuffer(1.9);
|
||||
assert.sameValue(buffer.byteLength, 1, "1.9");
|
||||
|
||||
buffer = new ArrayBuffer(-0.1);
|
||||
assert.sameValue(buffer.byteLength, 0, "-0.1");
|
||||
|
||||
buffer = new ArrayBuffer(-0.99999);
|
||||
assert.sameValue(buffer.byteLength, 0, "-0.99999");
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.2.1
|
||||
esid: sec-dataview-buffer-byteoffset-bytelength
|
||||
description: >
|
||||
Throws a RangeError if ToNumber(byteOffset) diffs ToInteger(byteOffset)
|
||||
info: |
|
||||
24.2.2.1 DataView (buffer, byteOffset, byteLength )
|
||||
|
||||
...
|
||||
4. Let numberOffset be ? ToNumber(byteOffset).
|
||||
5. Let offset be ToInteger(numberOffset).
|
||||
6. If numberOffset ≠ offset or offset < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var ab = new ArrayBuffer(42);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(ab, 1.1);
|
||||
}, "1.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(ab, 0.0000001);
|
||||
}, "0.0000001");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(ab, NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(ab, -1.1);
|
||||
}, "-1.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(ab, undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(ab);
|
||||
}, "no byteOffset arg");
|
|
@ -9,6 +9,9 @@ description: >
|
|||
info: |
|
||||
24.2.2.1 DataView (buffer, byteOffset, byteLength )
|
||||
|
||||
...
|
||||
8. If byteLength is either not present or undefined, then
|
||||
a. Let viewByteLength be bufferByteLength - offset.
|
||||
...
|
||||
17. Return O.
|
||||
---*/
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.2.1
|
||||
esid: sec-dataview-buffer-byteoffset-bytelength
|
||||
description: >
|
||||
Return new instance from negative lengths
|
||||
info: |
|
||||
24.2.2.1 DataView (buffer, byteOffset, byteLength )
|
||||
|
||||
...
|
||||
17. Return O.
|
||||
---*/
|
||||
|
||||
var sample;
|
||||
var buffer = new ArrayBuffer(2);
|
||||
|
||||
sample = new DataView(buffer, 0, -1);
|
||||
assert.sameValue(sample.byteLength, 0, "sample.byteLength");
|
||||
assert.sameValue(sample.byteOffset, 0, "sample.byteOffset");
|
||||
assert.sameValue(sample.buffer, buffer);
|
||||
assert.sameValue(sample.constructor, DataView);
|
||||
assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype);
|
||||
|
||||
sample = new DataView(buffer, 0, -Infinity);
|
||||
assert.sameValue(sample.byteLength, 0, "sample.byteLength");
|
||||
assert.sameValue(sample.byteOffset, 0, "sample.byteOffset");
|
||||
assert.sameValue(sample.buffer, buffer);
|
||||
assert.sameValue(sample.constructor, DataView);
|
||||
assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype);
|
||||
|
||||
sample = new DataView(buffer, 1, -1);
|
||||
assert.sameValue(sample.byteLength, 0, "sample.byteLength");
|
||||
assert.sameValue(sample.byteOffset, 1, "sample.byteOffset");
|
||||
assert.sameValue(sample.buffer, buffer);
|
||||
assert.sameValue(sample.constructor, DataView);
|
||||
assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype);
|
||||
|
||||
sample = new DataView(buffer, 2, -Infinity);
|
||||
assert.sameValue(sample.byteLength, 0, "sample.byteLength");
|
||||
assert.sameValue(sample.byteOffset, 2, "sample.byteOffset");
|
||||
assert.sameValue(sample.buffer, buffer);
|
||||
assert.sameValue(sample.constructor, DataView);
|
||||
assert.sameValue(Object.getPrototypeOf(sample), DataView.prototype);
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview-buffer-byteoffset-bytelength
|
||||
description: >
|
||||
Throws a RangeError if ToInteger(byteLength) < 0
|
||||
info: |
|
||||
24.2.2.1 DataView (buffer, byteOffset, byteLength )
|
||||
|
||||
...
|
||||
8. If byteLength is either not present or undefined, then
|
||||
a. Let viewByteLength be bufferByteLength - offset.
|
||||
9. Else,
|
||||
a. Let viewByteLength be ? ToIndex(byteLength).
|
||||
...
|
||||
|
||||
ToIndex ( value )
|
||||
|
||||
1. If value is undefined, then
|
||||
a. Let index be 0.
|
||||
2. Else,
|
||||
a. Let integerIndex be ? ToInteger(value).
|
||||
b. If integerIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(2);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(buffer, 0, -1);
|
||||
}, "new DataView(buffer, 0, -1);");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(buffer, 0, -Infinity);
|
||||
}, "new DataView(buffer, 0, -Infinity);");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(buffer, 1, -1);
|
||||
}, "new DataView(buffer, 1, -1);");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(buffer, 2, -Infinity);
|
||||
}, "new DataView(buffer, 2, -Infinity);");
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview-buffer-byteoffset-bytelength
|
||||
description: >
|
||||
Throws a RangeError if ToInteger(byteOffset) < 0
|
||||
info: |
|
||||
24.2.2.1 DataView (buffer, byteOffset, byteLength )
|
||||
|
||||
...
|
||||
4. Let offset be ? ToIndex(byteOffset).
|
||||
...
|
||||
|
||||
ToIndex ( value )
|
||||
|
||||
1. If value is undefined, then
|
||||
a. Let index be 0.
|
||||
2. Else,
|
||||
a. Let integerIndex be ? ToInteger(value).
|
||||
b. If integerIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(2);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(buffer, -1);
|
||||
}, "new DataView(buffer, -1);");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
new DataView(buffer, -Infinity);
|
||||
}, "new DataView(buffer, -Infinity);");
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getfloat32
|
||||
es6id: 24.2.4.5
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.5 DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Float32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(-1.1);
|
||||
}, "-1.1");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(6);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat32(-1);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
esid: sec-dataview.prototype.getfloat32
|
||||
es6id: 24.2.4.5
|
||||
description: >
|
||||
Throws a RangeError if getIndex < 0
|
||||
Throws a RangeError if ToInteger(byteOffset) < 0
|
||||
info: |
|
||||
24.2.4.5 DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getfloat32
|
||||
es6id: 24.2.4.5
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.5 DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Float32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(8);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 75);
|
||||
sample.setUint8(1, 75);
|
||||
sample.setUint8(2, 76);
|
||||
sample.setUint8(3, 76);
|
||||
sample.setUint8(4, 75);
|
||||
sample.setUint8(5, 75);
|
||||
sample.setUint8(6, 76);
|
||||
sample.setUint8(7, 76);
|
||||
|
||||
assert.sameValue(sample.getFloat32("", false), 13323340, "'', false");
|
||||
assert.sameValue(sample.getFloat32("", true), 53554476, "'', true");
|
||||
|
||||
assert.sameValue(sample.getFloat32("0", false), 13323340, "'0', false");
|
||||
assert.sameValue(sample.getFloat32("0", true), 53554476, "'0', true");
|
||||
|
||||
assert.sameValue(sample.getFloat32("1", false), 13388875, "'1', false");
|
||||
assert.sameValue(sample.getFloat32("1", true), 13388875, "'1', true");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getFloat32(obj1, false), 13388875, "{}.valueOf, false");
|
||||
assert.sameValue(sample.getFloat32(obj1, true), 13388875, "{}.valueOf, true");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getFloat32(obj2, false), 13388875, "{}.toString, false");
|
||||
assert.sameValue(sample.getFloat32(obj2, true), 13388875, "{}.toString, true");
|
||||
|
||||
assert.sameValue(sample.getFloat32(true, false), 13388875, "true, false");
|
||||
assert.sameValue(sample.getFloat32(true, true), 13388875, "true, true");
|
||||
|
||||
assert.sameValue(sample.getFloat32(false, false), 13323340, "false, false");
|
||||
assert.sameValue(sample.getFloat32(false, true), 53554476, "false, true");
|
||||
|
||||
assert.sameValue(sample.getFloat32(null, false), 13323340, "null, false");
|
||||
assert.sameValue(sample.getFloat32(null, true), 53554476, "null, true");
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getfloat32
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.5 DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Float32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 75);
|
||||
sample.setUint8(1, 75);
|
||||
sample.setUint8(2, 76);
|
||||
sample.setUint8(3, 76);
|
||||
sample.setUint8(4, 75);
|
||||
sample.setUint8(5, 75);
|
||||
sample.setUint8(6, 76);
|
||||
sample.setUint8(7, 76);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getFloat32(-0), 13323340, "-0");
|
||||
assert.sameValue(sample.getFloat32(obj1), 53292336, "object's valueOf");
|
||||
assert.sameValue(sample.getFloat32(obj2), 53554476, "object's toString");
|
||||
assert.sameValue(sample.getFloat32(""), 13323340, "the Empty string");
|
||||
assert.sameValue(sample.getFloat32("0"), 13323340, "string '0'");
|
||||
assert.sameValue(sample.getFloat32("2"), 53554476, "string '2'");
|
||||
assert.sameValue(sample.getFloat32(true), 13388875, "true");
|
||||
assert.sameValue(sample.getFloat32(false), 13323340, "false");
|
||||
assert.sameValue(sample.getFloat32(NaN), 13323340, "NaN");
|
||||
assert.sameValue(sample.getFloat32(null), 13323340, "null");
|
||||
assert.sameValue(sample.getFloat32(0.1), 13323340, "0.1");
|
||||
assert.sameValue(sample.getFloat32(0.9), 13323340, "0.9");
|
||||
assert.sameValue(sample.getFloat32(1.1), 13388875, "1.1");
|
||||
assert.sameValue(sample.getFloat32(1.9), 13388875, "1.9");
|
||||
assert.sameValue(sample.getFloat32(-0.1), 13323340, "-0.1");
|
||||
assert.sameValue(sample.getFloat32(-0.99999), 13323340, "-0.99999");
|
||||
assert.sameValue(sample.getFloat32(undefined), 13323340, "undefined");
|
||||
assert.sameValue(sample.getFloat32(), 13323340, "no arg");
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getfloat64
|
||||
es6id: 24.2.4.6
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.6 DataView.prototype.getFloat64 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Float64").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(-1.1);
|
||||
}, "-1.1");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(10);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getFloat64(-1);
|
||||
|
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getfloat64
|
||||
es6id: 24.2.4.6
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.6 DataView.prototype.getFloat64 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Float64").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(9);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 67);
|
||||
sample.setUint8(1, 67);
|
||||
sample.setUint8(2, 68);
|
||||
sample.setUint8(3, 68);
|
||||
sample.setUint8(4, 67);
|
||||
sample.setUint8(5, 67);
|
||||
sample.setUint8(6, 68);
|
||||
sample.setUint8(7, 68);
|
||||
sample.setUint8(8, 67);
|
||||
|
||||
assert.sameValue(sample.getFloat64("", false), 10846169068898440, "'', false");
|
||||
assert.sameValue(sample.getFloat64("", true), 747563348316297500000, "'', true");
|
||||
|
||||
assert.sameValue(sample.getFloat64("0", false), 10846169068898440, "'0', false");
|
||||
assert.sameValue(sample.getFloat64("0", true), 747563348316297500000, "'0', true");
|
||||
|
||||
assert.sameValue(sample.getFloat64("1", false), 11409110432516230, "'1', false");
|
||||
assert.sameValue(sample.getFloat64("1", true), 11409110432516230, "'1', true");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getFloat64(obj1, false), 11409110432516230, "{}.valueOf, false");
|
||||
assert.sameValue(sample.getFloat64(obj1, true), 11409110432516230, "{}.valueOf, true");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getFloat64(obj2, false), 11409110432516230, "{}.toString, false");
|
||||
assert.sameValue(sample.getFloat64(obj2, true), 11409110432516230, "{}.toString, true");
|
||||
|
||||
assert.sameValue(sample.getFloat64(true, false), 11409110432516230, "true, false");
|
||||
assert.sameValue(sample.getFloat64(true, true), 11409110432516230, "true, true");
|
||||
|
||||
assert.sameValue(sample.getFloat64(false, false), 10846169068898440, "false, false");
|
||||
assert.sameValue(sample.getFloat64(false, true), 747563348316297500000, "false, true");
|
||||
|
||||
assert.sameValue(sample.getFloat64(null, false), 10846169068898440, "null, false");
|
||||
assert.sameValue(sample.getFloat64(null, true), 747563348316297500000, "null, true");
|
|
@ -0,0 +1,69 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getfloat64
|
||||
es6id: 24.2.4.6
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.6 DataView.prototype.getFloat64 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Float64").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 67);
|
||||
sample.setUint8(1, 67);
|
||||
sample.setUint8(2, 68);
|
||||
sample.setUint8(3, 68);
|
||||
sample.setUint8(4, 67);
|
||||
sample.setUint8(5, 67);
|
||||
sample.setUint8(6, 68);
|
||||
sample.setUint8(7, 68);
|
||||
sample.setUint8(8, 67);
|
||||
sample.setUint8(9, 68);
|
||||
sample.setUint8(10, 68);
|
||||
sample.setUint8(11, 68);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getFloat64(-0), 10846169068898440, "-0");
|
||||
assert.sameValue(sample.getFloat64(obj1), 747563348316297600000, "{}.valueOf");
|
||||
assert.sameValue(sample.getFloat64(obj2), 710670423110275600000, "{}.toString");
|
||||
assert.sameValue(sample.getFloat64(""), 10846169068898440, "the Empty string");
|
||||
assert.sameValue(sample.getFloat64("0"), 10846169068898440, "string '0'");
|
||||
assert.sameValue(sample.getFloat64("2"), 747563348316297600000, "string '2'");
|
||||
assert.sameValue(sample.getFloat64(true), 11409110432516230, "true");
|
||||
assert.sameValue(sample.getFloat64(false), 10846169068898440, "false");
|
||||
assert.sameValue(sample.getFloat64(NaN), 10846169068898440, "NaN");
|
||||
assert.sameValue(sample.getFloat64(null), 10846169068898440, "null");
|
||||
assert.sameValue(sample.getFloat64(0.1), 10846169068898440, "0.1");
|
||||
assert.sameValue(sample.getFloat64(0.9), 10846169068898440, "0.9");
|
||||
assert.sameValue(sample.getFloat64(1.1), 11409110432516230, "1.1");
|
||||
assert.sameValue(sample.getFloat64(1.9), 11409110432516230, "1.9");
|
||||
assert.sameValue(sample.getFloat64(-0.1), 10846169068898440, "-0.1");
|
||||
assert.sameValue(sample.getFloat64(-0.99999), 10846169068898440, "-0.99999");
|
||||
assert.sameValue(sample.getFloat64(undefined), 10846169068898440, "undefined");
|
||||
assert.sameValue(sample.getFloat64(), 10846169068898440, "no arg");
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint16
|
||||
es6id: 24.2.4.8
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.8 DataView.prototype.getInt16 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Int16").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(-1.1);
|
||||
}, "-1.1");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(8);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt16(-1);
|
||||
|
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint16
|
||||
es6id: 24.2.4.8
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.8 DataView.prototype.getInt16 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Int16").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(3);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 1);
|
||||
|
||||
assert.sameValue(sample.getInt16("", false), 32767, "'', false");
|
||||
assert.sameValue(sample.getInt16("", true), -129, "'', true");
|
||||
|
||||
assert.sameValue(sample.getInt16("0", false), 32767, "'0', false");
|
||||
assert.sameValue(sample.getInt16("0", true), -129, "'0', true");
|
||||
|
||||
assert.sameValue(sample.getInt16("1", false), -255, "'1', false");
|
||||
assert.sameValue(sample.getInt16("1", true), 511, "'1', true");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getInt16(obj1, false), -255, "{}.valueOf, false");
|
||||
assert.sameValue(sample.getInt16(obj1, true), 511, "{}.valueOf, true");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getInt16(obj2, false), -255, "{}.toString, false");
|
||||
assert.sameValue(sample.getInt16(obj2, true), 511, "{}.toString, true");
|
||||
|
||||
assert.sameValue(sample.getInt16(true, false), -255, "true, false");
|
||||
assert.sameValue(sample.getInt16(true, true), 511, "true, true");
|
||||
|
||||
assert.sameValue(sample.getInt16(false, false), 32767, "false, false");
|
||||
assert.sameValue(sample.getInt16(false, true), -129, "false, true");
|
||||
|
||||
assert.sameValue(sample.getInt16(null, false), 32767, "null, false");
|
||||
assert.sameValue(sample.getInt16(null, true), -129, "null, true");
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint16
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.8 DataView.prototype.getInt16 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Int16").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(8);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 1);
|
||||
sample.setUint8(3, 127);
|
||||
sample.setUint8(4, 255);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getInt16(-0), 32767, "-0");
|
||||
assert.sameValue(sample.getInt16(obj1), 383, "object's valueOf");
|
||||
assert.sameValue(sample.getInt16(obj2), 32767, "object's toString");
|
||||
assert.sameValue(sample.getInt16(""), 32767, "the Empty string");
|
||||
assert.sameValue(sample.getInt16("0"), 32767, "string '0'");
|
||||
assert.sameValue(sample.getInt16("2"), 383, "string '2'");
|
||||
assert.sameValue(sample.getInt16(true), -255, "true");
|
||||
assert.sameValue(sample.getInt16(false), 32767, "false");
|
||||
assert.sameValue(sample.getInt16(NaN), 32767, "NaN");
|
||||
assert.sameValue(sample.getInt16(null), 32767, "null");
|
||||
assert.sameValue(sample.getInt16(0.1), 32767, "0.1");
|
||||
assert.sameValue(sample.getInt16(0.9), 32767, "0.9");
|
||||
assert.sameValue(sample.getInt16(1.1), -255, "1.1");
|
||||
assert.sameValue(sample.getInt16(1.9), -255, "1.9");
|
||||
assert.sameValue(sample.getInt16(-0.1), 32767, "-0.1");
|
||||
assert.sameValue(sample.getInt16(-0.99999), 32767, "-0.99999");
|
||||
assert.sameValue(sample.getInt16(undefined), 32767, "undefined");
|
||||
assert.sameValue(sample.getInt16(), 32767, "no arg");
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint32
|
||||
es6id: 24.2.4.9
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.9 DataView.prototype.getInt32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Int32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(-1.1);
|
||||
}, "-1.1");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(8);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt32(-1);
|
||||
|
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint32
|
||||
es6id: 24.2.4.9
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.9 DataView.prototype.getInt32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Int32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(5);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 255);
|
||||
sample.setUint8(3, 255);
|
||||
sample.setUint8(4, 128);
|
||||
|
||||
assert.sameValue(sample.getInt32("", false), 2147483647, "'', false");
|
||||
assert.sameValue(sample.getInt32("", true), -129, "'', true");
|
||||
|
||||
assert.sameValue(sample.getInt32("0", false), 2147483647, "'0', false");
|
||||
assert.sameValue(sample.getInt32("0", true), -129, "'0', true");
|
||||
|
||||
assert.sameValue(sample.getInt32("1", false), -128, "'1', false");
|
||||
assert.sameValue(sample.getInt32("1", true), -2130706433, "'1', true");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getInt32(obj1, false), -128, "{}.valueOf, false");
|
||||
assert.sameValue(sample.getInt32(obj1, true), -2130706433, "{}.valueOf, true");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getInt32(obj2, false), -128, "{}.toString, false");
|
||||
assert.sameValue(sample.getInt32(obj2, true), -2130706433, "{}.toString, true");
|
||||
|
||||
assert.sameValue(sample.getInt32(true, false), -128, "true, false");
|
||||
assert.sameValue(sample.getInt32(true, true), -2130706433, "true, true");
|
||||
|
||||
assert.sameValue(sample.getInt32(false, false), 2147483647, "false, false");
|
||||
assert.sameValue(sample.getInt32(false, true), -129, "false, true");
|
||||
|
||||
assert.sameValue(sample.getInt32(null, false), 2147483647, "null, false");
|
||||
assert.sameValue(sample.getInt32(null, true), -129, "null, true");
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint32
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.9 DataView.prototype.getInt32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Int32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(8);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 255);
|
||||
sample.setUint8(3, 255);
|
||||
sample.setUint8(4, 128);
|
||||
sample.setUint8(5, 255);
|
||||
sample.setUint8(6, 255);
|
||||
sample.setUint8(7, 255);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getInt32(-0), 2147483647, "-0");
|
||||
assert.sameValue(sample.getInt32(obj1), -32513, "object's valueOf");
|
||||
assert.sameValue(sample.getInt32(obj2), -8323073, "object's toString");
|
||||
assert.sameValue(sample.getInt32(""), 2147483647, "the Empty string");
|
||||
assert.sameValue(sample.getInt32("0"), 2147483647, "string '0'");
|
||||
assert.sameValue(sample.getInt32("2"), -32513, "string '2'");
|
||||
assert.sameValue(sample.getInt32(true), -128, "true");
|
||||
assert.sameValue(sample.getInt32(false), 2147483647, "false");
|
||||
assert.sameValue(sample.getInt32(NaN), 2147483647, "NaN");
|
||||
assert.sameValue(sample.getInt32(null), 2147483647, "null");
|
||||
assert.sameValue(sample.getInt32(0.1), 2147483647, "0.1");
|
||||
assert.sameValue(sample.getInt32(0.9), 2147483647, "0.9");
|
||||
assert.sameValue(sample.getInt32(1.1), -128, "1.1");
|
||||
assert.sameValue(sample.getInt32(1.9), -128, "1.9");
|
||||
assert.sameValue(sample.getInt32(-0.1), 2147483647, "-0.1");
|
||||
assert.sameValue(sample.getInt32(-0.99999), 2147483647, "-0.99999");
|
||||
assert.sameValue(sample.getInt32(undefined), 2147483647, "undefined");
|
||||
assert.sameValue(sample.getInt32(), 2147483647, "no arg");
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint8
|
||||
es6id: 24.2.4.7
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.7 DataView.prototype.getInt8 ( byteOffset )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? GetViewValue(v, byteOffset, true, "Int8").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(-1.1);
|
||||
}, "-1.1");
|
|
@ -16,10 +16,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -28,9 +28,6 @@ var buffer = new ArrayBuffer(8);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getInt8(-1);
|
||||
|
|
|
@ -15,9 +15,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint8
|
||||
es6id: 24.2.4.7
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.7 DataView.prototype.getInt8 ( byteOffset )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? GetViewValue(v, byteOffset, true, "Int8").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(2);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 39);
|
||||
sample.setUint8(1, 42);
|
||||
|
||||
assert.sameValue(sample.getInt8(""), 39, "''");
|
||||
|
||||
assert.sameValue(sample.getInt8("0"), 39, "'0'");
|
||||
|
||||
assert.sameValue(sample.getInt8("1"), 42, "'1'");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getInt8(obj1), 42, "{}.valueOf");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getInt8(obj2), 42, "{}.toString");
|
||||
|
||||
assert.sameValue(sample.getInt8(true), 42, "true");
|
||||
|
||||
assert.sameValue(sample.getInt8(false), 39, "false");
|
||||
|
||||
assert.sameValue(sample.getInt8(null), 39, "null");
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getint8
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.7 DataView.prototype.getInt8 ( byteOffset )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? GetViewValue(v, byteOffset, true, "Int8").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(4);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 39);
|
||||
sample.setUint8(1, 42);
|
||||
sample.setUint8(2, 7);
|
||||
sample.setUint8(3, 77);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getInt8(-0), 39, "-0");
|
||||
assert.sameValue(sample.getInt8(obj1), 7, "object's valueOf");
|
||||
assert.sameValue(sample.getInt8(obj2), 77, "object's toString");
|
||||
assert.sameValue(sample.getInt8(""), 39, "the Empty string");
|
||||
assert.sameValue(sample.getInt8("0"), 39, "string '0'");
|
||||
assert.sameValue(sample.getInt8("2"), 7, "string '2'");
|
||||
assert.sameValue(sample.getInt8(true), 42, "true");
|
||||
assert.sameValue(sample.getInt8(false), 39, "false");
|
||||
assert.sameValue(sample.getInt8(NaN), 39, "NaN");
|
||||
assert.sameValue(sample.getInt8(null), 39, "null");
|
||||
assert.sameValue(sample.getInt8(0.1), 39, "0.1");
|
||||
assert.sameValue(sample.getInt8(0.9), 39, "0.9");
|
||||
assert.sameValue(sample.getInt8(1.1), 42, "1.1");
|
||||
assert.sameValue(sample.getInt8(1.9), 42, "1.9");
|
||||
assert.sameValue(sample.getInt8(-0.1), 39, "-0.1");
|
||||
assert.sameValue(sample.getInt8(-0.99999), 39, "-0.99999");
|
||||
assert.sameValue(sample.getInt8(undefined), 39, "undefined");
|
||||
assert.sameValue(sample.getInt8(), 39, "no arg");
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint16
|
||||
es6id: 24.2.4.11
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.11 DataView.prototype.getUint16 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Uint16").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(-1.1);
|
||||
}, "-1.1");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(8);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint16(-1);
|
||||
|
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint16
|
||||
es6id: 24.2.4.11
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.11 DataView.prototype.getUint16 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Uint16").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(3);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 1);
|
||||
|
||||
assert.sameValue(sample.getUint16("", false), 32767, "'', false");
|
||||
assert.sameValue(sample.getUint16("", true), 65407, "'', true");
|
||||
|
||||
assert.sameValue(sample.getUint16("0", false), 32767, "'0', false");
|
||||
assert.sameValue(sample.getUint16("0", true), 65407, "'0', true");
|
||||
|
||||
assert.sameValue(sample.getUint16("1", false), 65281, "'1', false");
|
||||
assert.sameValue(sample.getUint16("1", true), 511, "'1', true");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getUint16(obj1, false), 65281, "{}.valueOf, false");
|
||||
assert.sameValue(sample.getUint16(obj1, true), 511, "{}.valueOf, true");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getUint16(obj2, false), 65281, "{}.toString, false");
|
||||
assert.sameValue(sample.getUint16(obj2, true), 511, "{}.toString, true");
|
||||
|
||||
assert.sameValue(sample.getUint16(true, false), 65281, "true, false");
|
||||
assert.sameValue(sample.getUint16(true, true), 511, "true, true");
|
||||
|
||||
assert.sameValue(sample.getUint16(false, false), 32767, "false, false");
|
||||
assert.sameValue(sample.getUint16(false, true), 65407, "false, true");
|
||||
|
||||
assert.sameValue(sample.getUint16(null, false), 32767, "null, false");
|
||||
assert.sameValue(sample.getUint16(null, true), 65407, "null, true");
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint16
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.11 DataView.prototype.getUint16 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Uint16").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(8);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 1);
|
||||
sample.setUint8(3, 127);
|
||||
sample.setUint8(4, 255);
|
||||
sample.setUint8(5, 1);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getUint16(-0), 32767, "-0");
|
||||
assert.sameValue(sample.getUint16(obj1), 383, "object's valueOf");
|
||||
assert.sameValue(sample.getUint16(obj2), 32767, "object's toString");
|
||||
assert.sameValue(sample.getUint16(""), 32767, "the Empty string");
|
||||
assert.sameValue(sample.getUint16("0"), 32767, "string '0'");
|
||||
assert.sameValue(sample.getUint16("2"), 383, "string '2'");
|
||||
assert.sameValue(sample.getUint16(true), 65281, "true");
|
||||
assert.sameValue(sample.getUint16(false), 32767, "false");
|
||||
assert.sameValue(sample.getUint16(NaN), 32767, "NaN");
|
||||
assert.sameValue(sample.getUint16(null), 32767, "null");
|
||||
assert.sameValue(sample.getUint16(0.1), 32767, "0.1");
|
||||
assert.sameValue(sample.getUint16(0.9), 32767, "0.9");
|
||||
assert.sameValue(sample.getUint16(1.1), 65281, "1.1");
|
||||
assert.sameValue(sample.getUint16(1.9), 65281, "1.9");
|
||||
assert.sameValue(sample.getUint16(-0.1), 32767, "-0.1");
|
||||
assert.sameValue(sample.getUint16(-0.99999), 32767, "-0.99999");
|
||||
assert.sameValue(sample.getUint16(undefined), 32767, "undefined");
|
||||
assert.sameValue(sample.getUint16(), 32767, "no arg");
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint32
|
||||
es6id: 24.2.4.12
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.12 DataView.prototype.getUint32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Uint32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(-1.1);
|
||||
}, "-1.1");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(8);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint32(-1);
|
||||
|
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint32
|
||||
es6id: 24.2.4.12
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.12 DataView.prototype.getUint32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Uint32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(5);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 255);
|
||||
sample.setUint8(3, 255);
|
||||
sample.setUint8(4, 128);
|
||||
|
||||
assert.sameValue(sample.getUint32("", false), 2147483647, "'', false");
|
||||
assert.sameValue(sample.getUint32("", true), 4294967167, "'', true");
|
||||
|
||||
assert.sameValue(sample.getUint32("0", false), 2147483647, "'0', false");
|
||||
assert.sameValue(sample.getUint32("0", true), 4294967167, "'0', true");
|
||||
|
||||
assert.sameValue(sample.getUint32("1", false), 4294967168, "'1', false");
|
||||
assert.sameValue(sample.getUint32("1", true), 2164260863, "'1', true");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getUint32(obj1, false), 4294967168, "{}.valueOf, false");
|
||||
assert.sameValue(sample.getUint32(obj1, true), 2164260863, "{}.valueOf, true");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getUint32(obj2, false), 4294967168, "{}.toString, false");
|
||||
assert.sameValue(sample.getUint32(obj2, true), 2164260863, "{}.toString, true");
|
||||
|
||||
assert.sameValue(sample.getUint32(true, false), 4294967168, "true, false");
|
||||
assert.sameValue(sample.getUint32(true, true), 2164260863, "true, true");
|
||||
|
||||
assert.sameValue(sample.getUint32(false, false), 2147483647, "false, false");
|
||||
assert.sameValue(sample.getUint32(false, true), 4294967167, "false, true");
|
||||
|
||||
assert.sameValue(sample.getUint32(null, false), 2147483647, "null, false");
|
||||
assert.sameValue(sample.getUint32(null, true), 4294967167, "null, true");
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint32
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.12 DataView.prototype.getUint32 ( byteOffset [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? GetViewValue(v, byteOffset, littleEndian, "Uint32").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(8);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 127);
|
||||
sample.setUint8(1, 255);
|
||||
sample.setUint8(2, 255);
|
||||
sample.setUint8(3, 255);
|
||||
sample.setUint8(4, 128);
|
||||
sample.setUint8(5, 255);
|
||||
sample.setUint8(6, 128);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getUint32(-0), 2147483647, "-0");
|
||||
assert.sameValue(sample.getUint32(obj1), 4294934783, "object's valueOf");
|
||||
assert.sameValue(sample.getUint32(obj2), 4286644096, "object's toString");
|
||||
assert.sameValue(sample.getUint32(""), 2147483647, "the Empty string");
|
||||
assert.sameValue(sample.getUint32("0"), 2147483647, "string '0'");
|
||||
assert.sameValue(sample.getUint32("2"), 4294934783, "string '2'");
|
||||
assert.sameValue(sample.getUint32(true), 4294967168, "true");
|
||||
assert.sameValue(sample.getUint32(false), 2147483647, "false");
|
||||
assert.sameValue(sample.getUint32(NaN), 2147483647, "NaN");
|
||||
assert.sameValue(sample.getUint32(null), 2147483647, "null");
|
||||
assert.sameValue(sample.getUint32(0.1), 2147483647, "0.1");
|
||||
assert.sameValue(sample.getUint32(0.9), 2147483647, "0.9");
|
||||
assert.sameValue(sample.getUint32(1.1), 4294967168, "1.1");
|
||||
assert.sameValue(sample.getUint32(1.9), 4294967168, "1.9");
|
||||
assert.sameValue(sample.getUint32(-0.1), 2147483647, "-0.1");
|
||||
assert.sameValue(sample.getUint32(-0.99999), 2147483647, "-0.99999");
|
||||
assert.sameValue(sample.getUint32(undefined), 2147483647, "undefined");
|
||||
assert.sameValue(sample.getUint32(), 2147483647, "no arg");
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint8
|
||||
es6id: 24.2.4.10
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.10 DataView.prototype.getUint8 ( byteOffset )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? GetViewValue(v, byteOffset, true, "Uint8").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8();
|
||||
}, "no args");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(undefined);
|
||||
}, "undefined");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(1.1);
|
||||
}, "floating number");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(0.1);
|
||||
}, "0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(NaN);
|
||||
}, "NaN");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(-0.1);
|
||||
}, "-0.1");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(-1.1);
|
||||
}, "-1.1");
|
|
@ -16,10 +16,10 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
8. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -28,9 +28,6 @@ var buffer = new ArrayBuffer(8);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(1.1);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.getUint8(-1);
|
||||
|
|
|
@ -15,9 +15,7 @@ info: |
|
|||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint8
|
||||
es6id: 24.2.4.10
|
||||
description: >
|
||||
Return values using coerced ToInteger byteOffset values
|
||||
info: |
|
||||
24.2.4.10 DataView.prototype.getUint8 ( byteOffset )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? GetViewValue(v, byteOffset, true, "Uint8").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
14. Let bufferIndex be getIndex + viewOffset.
|
||||
15. Return GetValueFromBuffer(buffer, bufferIndex, type, isLittleEndian).
|
||||
...
|
||||
|
||||
24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type [ , isLittleEndian
|
||||
] )
|
||||
|
||||
...
|
||||
8. If isLittleEndian is false, reverse the order of the elements of rawValue.
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(2);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 39);
|
||||
sample.setUint8(1, 42);
|
||||
|
||||
assert.sameValue(sample.getUint8(""), 39, "''");
|
||||
|
||||
assert.sameValue(sample.getUint8("0"), 39, "'0'");
|
||||
|
||||
assert.sameValue(sample.getUint8("1"), 42, "'1'");
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getUint8(obj1), 42, "{}.valueOf");
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
assert.sameValue(sample.getUint8(obj2), 42, "{}.toString");
|
||||
|
||||
assert.sameValue(sample.getUint8(true), 42, "true");
|
||||
|
||||
assert.sameValue(sample.getUint8(false), 39, "false");
|
||||
|
||||
assert.sameValue(sample.getUint8(null), 39, "null");
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.getuint8
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.10 DataView.prototype.getUint8 ( byteOffset )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? GetViewValue(v, byteOffset, true, "Uint8").
|
||||
|
||||
24.2.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.setUint8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(4);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
sample.setUint8(0, 39);
|
||||
sample.setUint8(1, 42);
|
||||
sample.setUint8(2, 7);
|
||||
sample.setUint8(3, 77);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(sample.getUint8(-0), 39, "-0");
|
||||
assert.sameValue(sample.getUint8(obj1), 7, "object's valueOf");
|
||||
assert.sameValue(sample.getUint8(obj2), 77, "object's toString");
|
||||
assert.sameValue(sample.getUint8(""), 39, "the Empty string");
|
||||
assert.sameValue(sample.getUint8("0"), 39, "string '0'");
|
||||
assert.sameValue(sample.getUint8("2"), 7, "string '1'");
|
||||
assert.sameValue(sample.getUint8(true), 42, "true");
|
||||
assert.sameValue(sample.getUint8(false), 39, "false");
|
||||
assert.sameValue(sample.getUint8(NaN), 39, "NaN");
|
||||
assert.sameValue(sample.getUint8(null), 39, "null");
|
||||
assert.sameValue(sample.getUint8(0.1), 39, "0.1");
|
||||
assert.sameValue(sample.getUint8(0.9), 39, "0.9");
|
||||
assert.sameValue(sample.getUint8(1.1), 42, "1.1");
|
||||
assert.sameValue(sample.getUint8(1.9), 42, "1.9");
|
||||
assert.sameValue(sample.getUint8(-0.1), 39, "-0.1");
|
||||
assert.sameValue(sample.getUint8(-0.99999), 39, "-0.99999");
|
||||
assert.sameValue(sample.getUint8(undefined), 39, "undefined");
|
||||
assert.sameValue(sample.getUint8(), 39, "no arg");
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setfloat32
|
||||
es6id: 24.2.4.13
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.13 DataView.prototype.setFloat32 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Float32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [DataView.prototype.getFloat32]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32();
|
||||
}, "no args");
|
||||
assert.sameValue(sample.getFloat32(0), 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(sample.getFloat32(0), 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(sample.getFloat32(0), 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(sample.getFloat32(0), 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(sample.getFloat32(0), 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(sample.getFloat32(0), 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(sample.getFloat32(0), 0, "-1.1 - no value was set");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(8);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat32(-1, 0);
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
/*---
|
||||
esid: sec-dataview.prototype.setfloat32
|
||||
description: >
|
||||
RangeError exception for negative or non-integral index is thrown before
|
||||
the value conversion.
|
||||
RangeError exception for negative index is thrown before the value conversion.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Float32", value).
|
||||
|
@ -13,10 +12,7 @@ info: >
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ToNumber(requestIndex).
|
||||
5. Let getIndex be ? ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
7. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -28,14 +24,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(NaN, poisoned);
|
||||
}, "setFloat32(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(1.5, poisoned);
|
||||
}, "setFloat32(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(-1.5, poisoned);
|
||||
}, "setFloat32(-1.5, poisoned)");
|
||||
|
@ -47,40 +35,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(-Infinity, poisoned);
|
||||
}, "setFloat32(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(undefined, poisoned);
|
||||
}, "setFloat32(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32('invalid', poisoned);
|
||||
}, "setFloat32('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32('NaN', poisoned);
|
||||
}, "setFloat32('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32('1.5', poisoned);
|
||||
}, "setFloat32('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32('-1.5', poisoned);
|
||||
}, "setFloat32('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32('-1', poisoned);
|
||||
}, "setFloat32('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32('-Infinity', poisoned);
|
||||
}, "setFloat32('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(obj, poisoned);
|
||||
}, "setFloat32(obj, poisoned)");
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.4.13
|
||||
description: >
|
||||
The requested index is converted with ToInteger.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Float32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ToInteger(numberIndex).
|
||||
5. ReturnIfAbrupt(getIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||
|
||||
dataView.setFloat32(+0, 1);
|
||||
assert.sameValue(dataView.getFloat32(0), 1, "setFloat32(+0, 1)");
|
||||
|
||||
dataView.setFloat32(-0, 2);
|
||||
assert.sameValue(dataView.getFloat32(0), 2, "setFloat32(-0, 2)");
|
||||
|
||||
dataView.setFloat32(1, 3);
|
||||
assert.sameValue(dataView.getFloat32(1), 3, "setFloat32(1, 3)");
|
||||
|
||||
dataView.setFloat32(null, 4);
|
||||
assert.sameValue(dataView.getFloat32(0), 4, "setFloat32(null, 4)");
|
||||
|
||||
dataView.setFloat32(false, 5);
|
||||
assert.sameValue(dataView.getFloat32(0), 5, "setFloat32(false, 5)");
|
||||
|
||||
dataView.setFloat32(true, 6);
|
||||
assert.sameValue(dataView.getFloat32(1), 6, "setFloat32(true, 6)");
|
||||
|
||||
dataView.setFloat32("", 7);
|
||||
assert.sameValue(dataView.getFloat32(0), 7, "setFloat32('', 7)");
|
||||
|
||||
// Math.pow(2, 31) = 2147483648
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(2147483648, 8);
|
||||
}, "setFloat32(2147483648, 8)");
|
||||
|
||||
// Math.pow(2, 32) = 4294967296
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat32(4294967296, 9);
|
||||
}, "setFloat32(4294967296, 9)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
dataView.setFloat32(obj, 10);
|
||||
assert.sameValue(dataView.getFloat32(1), 10, "setFloat32(obj, 10)");
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getFloat32]
|
||||
---*/
|
|
@ -0,0 +1,108 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setfloat32
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.13 DataView.prototype.setFloat32 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Float32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getFloat32]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(8);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(-0, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "-0");
|
||||
|
||||
sample.setFloat32(3, 0);
|
||||
sample.setFloat32(obj1, 42);
|
||||
assert.sameValue(sample.getFloat32(3), 42, "object's valueOf");
|
||||
|
||||
sample.setFloat32(4, 0);
|
||||
sample.setFloat32(obj2, 42);
|
||||
assert.sameValue(sample.getFloat32(4), 42, "object's toString");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32("", 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "the Empty string");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32("0", 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "string '0'");
|
||||
|
||||
sample.setFloat32(2, 0);
|
||||
sample.setFloat32("2", 42);
|
||||
assert.sameValue(sample.getFloat32(2), 42, "string '2'");
|
||||
|
||||
sample.setFloat32(1, 0);
|
||||
sample.setFloat32(true, 42);
|
||||
assert.sameValue(sample.getFloat32(1), 42, "true");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(false, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "false");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(NaN, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "NaN");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(null, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "null");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(0.1, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "0.1");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(0.9, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "0.9");
|
||||
|
||||
sample.setFloat32(1, 0);
|
||||
sample.setFloat32(1.1, 42);
|
||||
assert.sameValue(sample.getFloat32(1), 42, "1.1");
|
||||
|
||||
sample.setFloat32(1, 0);
|
||||
sample.setFloat32(1.9, 42);
|
||||
assert.sameValue(sample.getFloat32(1), 42, "1.9");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(-0.1, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "-0.1");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(-0.99999, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "-0.99999");
|
||||
|
||||
sample.setFloat32(0, 0);
|
||||
sample.setFloat32(undefined, 42);
|
||||
assert.sameValue(sample.getFloat32(0), 42, "undefined");
|
||||
|
||||
sample.setFloat32(0, 7);
|
||||
sample.setFloat32();
|
||||
assert.sameValue(sample.getFloat32(0), 0, "no arg");
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setfloat64
|
||||
es6id: 24.2.4.14
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.14 DataView.prototype.setFloat64 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Float64", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [DataView.prototype.getFloat64]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64();
|
||||
}, "no args");
|
||||
assert.sameValue(sample.getFloat64(0), 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(sample.getFloat64(0), 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(sample.getFloat64(0), 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(sample.getFloat64(0), 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(sample.getFloat64(0), 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(sample.getFloat64(0), 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(sample.getFloat64(0), 0, "-1.1 - no value was set");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(12);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setFloat64(-1, 0);
|
||||
|
|
|
@ -13,10 +13,7 @@ info: >
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ToNumber(requestIndex).
|
||||
5. Let getIndex be ? ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
7. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -28,14 +25,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(NaN, poisoned);
|
||||
}, "setFloat64(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(1.5, poisoned);
|
||||
}, "setFloat64(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(-1.5, poisoned);
|
||||
}, "setFloat64(-1.5, poisoned)");
|
||||
|
@ -47,40 +36,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(-Infinity, poisoned);
|
||||
}, "setFloat64(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(undefined, poisoned);
|
||||
}, "setFloat64(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64('invalid', poisoned);
|
||||
}, "setFloat64('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64('NaN', poisoned);
|
||||
}, "setFloat64('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64('1.5', poisoned);
|
||||
}, "setFloat64('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64('-1.5', poisoned);
|
||||
}, "setFloat64('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64('-1', poisoned);
|
||||
}, "setFloat64('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64('-Infinity', poisoned);
|
||||
}, "setFloat64('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(obj, poisoned);
|
||||
}, "setFloat64(obj, poisoned)");
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.4.14
|
||||
description: >
|
||||
The requested index is converted with ToInteger.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Float64", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ToInteger(numberIndex).
|
||||
5. ReturnIfAbrupt(getIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dataView = new DataView(new ArrayBuffer(16), 0);
|
||||
|
||||
dataView.setFloat64(+0, 1);
|
||||
assert.sameValue(dataView.getFloat64(0), 1, "setFloat64(+0, 1)");
|
||||
|
||||
dataView.setFloat64(-0, 2);
|
||||
assert.sameValue(dataView.getFloat64(0), 2, "setFloat64(-0, 2)");
|
||||
|
||||
dataView.setFloat64(1, 3);
|
||||
assert.sameValue(dataView.getFloat64(1), 3, "setFloat64(1, 3)");
|
||||
|
||||
dataView.setFloat64(null, 4);
|
||||
assert.sameValue(dataView.getFloat64(0), 4, "setFloat64(null, 4)");
|
||||
|
||||
dataView.setFloat64(false, 5);
|
||||
assert.sameValue(dataView.getFloat64(0), 5, "setFloat64(false, 5)");
|
||||
|
||||
dataView.setFloat64(true, 6);
|
||||
assert.sameValue(dataView.getFloat64(1), 6, "setFloat64(true, 6)");
|
||||
|
||||
dataView.setFloat64("", 7);
|
||||
assert.sameValue(dataView.getFloat64(0), 7, "setFloat64('', 7)");
|
||||
|
||||
// Math.pow(2, 31) = 2147483648
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(2147483648, 8);
|
||||
}, "setFloat64(2147483648, 8)");
|
||||
|
||||
// Math.pow(2, 32) = 4294967296
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setFloat64(4294967296, 9);
|
||||
}, "setFloat64(4294967296, 9)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
dataView.setFloat64(obj, 10);
|
||||
assert.sameValue(dataView.getFloat64(1), 10, "setFloat64(obj, 10)");
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getFloat64]
|
||||
---*/
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setfloat64
|
||||
es6id: 24.2.4.14
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.14 DataView.prototype.setFloat64 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Float64", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getFloat64]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(-0, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "-0");
|
||||
|
||||
sample.setFloat64(3, 0);
|
||||
sample.setFloat64(obj1, 42);
|
||||
assert.sameValue(sample.getFloat64(3), 42, "object's valueOf");
|
||||
|
||||
sample.setFloat64(4, 0);
|
||||
sample.setFloat64(obj2, 42);
|
||||
assert.sameValue(sample.getFloat64(4), 42, "object's toString");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64("", 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "the Empty string");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64("0", 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "string '0'");
|
||||
|
||||
sample.setFloat64(2, 0);
|
||||
sample.setFloat64("2", 42);
|
||||
assert.sameValue(sample.getFloat64(2), 42, "string '2'");
|
||||
|
||||
sample.setFloat64(1, 0);
|
||||
sample.setFloat64(true, 42);
|
||||
assert.sameValue(sample.getFloat64(1), 42, "true");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(false, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "false");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(NaN, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "NaN");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(null, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "null");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(0.1, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "0.1");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(0.9, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "0.9");
|
||||
|
||||
sample.setFloat64(1, 0);
|
||||
sample.setFloat64(1.1, 42);
|
||||
assert.sameValue(sample.getFloat64(1), 42, "1.1");
|
||||
|
||||
sample.setFloat64(1, 0);
|
||||
sample.setFloat64(1.9, 42);
|
||||
assert.sameValue(sample.getFloat64(1), 42, "1.9");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(-0.1, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "-0.1");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(-0.99999, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "-0.99999");
|
||||
|
||||
sample.setFloat64(0, 0);
|
||||
sample.setFloat64(undefined, 42);
|
||||
assert.sameValue(sample.getFloat64(0), 42, "undefined");
|
||||
|
||||
sample.setFloat64(0, 7);
|
||||
sample.setFloat64();
|
||||
assert.sameValue(sample.getFloat64(0), 0, "no arg");
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setint16
|
||||
es6id: 24.2.4.16
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.16 DataView.prototype.setInt16 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Int16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [DataView.prototype.getInt16]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16();
|
||||
}, "no args");
|
||||
assert.sameValue(sample.getInt16(0), 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(sample.getInt16(0), 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(sample.getInt16(0), 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(sample.getInt16(0), 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(sample.getInt16(0), 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(sample.getInt16(0), 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(sample.getInt16(0), 0, "-1.1 - no value was set");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(12);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt16(-1, 0);
|
||||
|
|
|
@ -11,11 +11,9 @@ info: >
|
|||
3. Return SetViewValue(v, byteOffset, littleEndian, "Int16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ? ToInteger(numberIndex).
|
||||
5. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
6. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -27,14 +25,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(NaN, poisoned);
|
||||
}, "setInt16(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(1.5, poisoned);
|
||||
}, "setInt16(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(-1.5, poisoned);
|
||||
}, "setInt16(-1.5, poisoned)");
|
||||
|
@ -46,40 +36,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(-Infinity, poisoned);
|
||||
}, "setInt16(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(undefined, poisoned);
|
||||
}, "setInt16(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16('invalid', poisoned);
|
||||
}, "setInt16('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16('NaN', poisoned);
|
||||
}, "setInt16('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16('1.5', poisoned);
|
||||
}, "setInt16('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16('-1.5', poisoned);
|
||||
}, "setInt16('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16('-1', poisoned);
|
||||
}, "setInt16('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16('-Infinity', poisoned);
|
||||
}, "setInt16('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(obj, poisoned);
|
||||
}, "setInt16(obj, poisoned)");
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.4.16
|
||||
description: >
|
||||
The requested index is converted with ToInteger.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Int16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ToInteger(numberIndex).
|
||||
5. ReturnIfAbrupt(getIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||
|
||||
dataView.setInt16(+0, 1);
|
||||
assert.sameValue(dataView.getInt16(0), 1, "setInt16(+0, 1)");
|
||||
|
||||
dataView.setInt16(-0, 2);
|
||||
assert.sameValue(dataView.getInt16(0), 2, "setInt16(-0, 2)");
|
||||
|
||||
dataView.setInt16(1, 3);
|
||||
assert.sameValue(dataView.getInt16(1), 3, "setInt16(1, 3)");
|
||||
|
||||
dataView.setInt16(null, 4);
|
||||
assert.sameValue(dataView.getInt16(0), 4, "setInt16(null, 4)");
|
||||
|
||||
dataView.setInt16(false, 5);
|
||||
assert.sameValue(dataView.getInt16(0), 5, "setInt16(false, 5)");
|
||||
|
||||
dataView.setInt16(true, 6);
|
||||
assert.sameValue(dataView.getInt16(1), 6, "setInt16(true, 6)");
|
||||
|
||||
dataView.setInt16("", 7);
|
||||
assert.sameValue(dataView.getInt16(0), 7, "setInt16('', 7)");
|
||||
|
||||
// Math.pow(2, 31) = 2147483648
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(2147483648, 8);
|
||||
}, "setInt16(2147483648, 8)");
|
||||
|
||||
// Math.pow(2, 32) = 4294967296
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt16(4294967296, 9);
|
||||
}, "setInt16(4294967296, 9)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
dataView.setInt16(obj, 10);
|
||||
assert.sameValue(dataView.getInt16(1), 10, "setInt16(obj, 10)");
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getInt16]
|
||||
---*/
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setint16
|
||||
es6id: 24.2.4.16
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.16 DataView.prototype.setInt16 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Int16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getInt16]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(-0, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "-0");
|
||||
|
||||
sample.setInt16(3, 0);
|
||||
sample.setInt16(obj1, 42);
|
||||
assert.sameValue(sample.getInt16(3), 42, "object's valueOf");
|
||||
|
||||
sample.setInt16(4, 0);
|
||||
sample.setInt16(obj2, 42);
|
||||
assert.sameValue(sample.getInt16(4), 42, "object's toString");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16("", 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "the Empty string");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16("0", 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "string '0'");
|
||||
|
||||
sample.setInt16(2, 0);
|
||||
sample.setInt16("2", 42);
|
||||
assert.sameValue(sample.getInt16(2), 42, "string '2'");
|
||||
|
||||
sample.setInt16(1, 0);
|
||||
sample.setInt16(true, 42);
|
||||
assert.sameValue(sample.getInt16(1), 42, "true");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(false, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "false");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(NaN, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "NaN");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(null, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "null");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(0.1, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "0.1");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(0.9, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "0.9");
|
||||
|
||||
sample.setInt16(1, 0);
|
||||
sample.setInt16(1.1, 42);
|
||||
assert.sameValue(sample.getInt16(1), 42, "1.1");
|
||||
|
||||
sample.setInt16(1, 0);
|
||||
sample.setInt16(1.9, 42);
|
||||
assert.sameValue(sample.getInt16(1), 42, "1.9");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(-0.1, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "-0.1");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(-0.99999, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "-0.99999");
|
||||
|
||||
sample.setInt16(0, 0);
|
||||
sample.setInt16(undefined, 42);
|
||||
assert.sameValue(sample.getInt16(0), 42, "undefined");
|
||||
|
||||
sample.setInt16(0, 7);
|
||||
sample.setInt16();
|
||||
assert.sameValue(sample.getInt16(0), 0, "no arg");
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setint32
|
||||
es6id: 24.2.4.17
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.17 DataView.prototype.setInt32 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Int32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [DataView.prototype.getInt32]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32();
|
||||
}, "no args");
|
||||
assert.sameValue(sample.getInt32(0), 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(sample.getInt32(0), 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(sample.getInt32(0), 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(sample.getInt32(0), 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(sample.getInt32(0), 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(sample.getInt32(0), 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(sample.getInt32(0), 0, "-1.1 - no value was set");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(12);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt32(-1, 0);
|
||||
|
|
|
@ -13,10 +13,7 @@ info: >
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ToNumber(requestIndex).
|
||||
5. Let getIndex be ? ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
7. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -28,14 +25,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(NaN, poisoned);
|
||||
}, "setInt32(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(1.5, poisoned);
|
||||
}, "setInt32(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(-1.5, poisoned);
|
||||
}, "setInt32(-1.5, poisoned)");
|
||||
|
@ -47,40 +36,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(-Infinity, poisoned);
|
||||
}, "setInt32(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(undefined, poisoned);
|
||||
}, "setInt32(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32('invalid', poisoned);
|
||||
}, "setInt32('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32('NaN', poisoned);
|
||||
}, "setInt32('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32('1.5', poisoned);
|
||||
}, "setInt32('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32('-1.5', poisoned);
|
||||
}, "setInt32('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32('-1', poisoned);
|
||||
}, "setInt32('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32('-Infinity', poisoned);
|
||||
}, "setInt32('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(obj, poisoned);
|
||||
}, "setInt32(obj, poisoned)");
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.4.17
|
||||
description: >
|
||||
The requested index is converted with ToInteger.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Int32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ToInteger(numberIndex).
|
||||
5. ReturnIfAbrupt(getIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||
|
||||
dataView.setInt32(+0, 1);
|
||||
assert.sameValue(dataView.getInt32(0), 1, "setInt32(+0, 1)");
|
||||
|
||||
dataView.setInt32(-0, 2);
|
||||
assert.sameValue(dataView.getInt32(0), 2, "setInt32(-0, 2)");
|
||||
|
||||
dataView.setInt32(1, 3);
|
||||
assert.sameValue(dataView.getInt32(1), 3, "setInt32(1, 3)");
|
||||
|
||||
dataView.setInt32(null, 4);
|
||||
assert.sameValue(dataView.getInt32(0), 4, "setInt32(null, 4)");
|
||||
|
||||
dataView.setInt32(false, 5);
|
||||
assert.sameValue(dataView.getInt32(0), 5, "setInt32(false, 5)");
|
||||
|
||||
dataView.setInt32(true, 6);
|
||||
assert.sameValue(dataView.getInt32(1), 6, "setInt32(true, 6)");
|
||||
|
||||
dataView.setInt32("", 7);
|
||||
assert.sameValue(dataView.getInt32(0), 7, "setInt32('', 7)");
|
||||
|
||||
// Math.pow(2, 31) = 2147483648
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(2147483648, 8);
|
||||
}, "setInt32(2147483648, 8)");
|
||||
|
||||
// Math.pow(2, 32) = 4294967296
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt32(4294967296, 9);
|
||||
}, "setInt32(4294967296, 9)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
dataView.setInt32(obj, 10);
|
||||
assert.sameValue(dataView.getInt32(1), 10, "setInt32(obj, 10)");
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getInt32]
|
||||
---*/
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setint32
|
||||
es6id: 24.2.4.17
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.17 DataView.prototype.setInt32 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Int32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getInt32]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(-0, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "-0");
|
||||
|
||||
sample.setInt32(3, 0);
|
||||
sample.setInt32(obj1, 42);
|
||||
assert.sameValue(sample.getInt32(3), 42, "object's valueOf");
|
||||
|
||||
sample.setInt32(4, 0);
|
||||
sample.setInt32(obj2, 42);
|
||||
assert.sameValue(sample.getInt32(4), 42, "object's toString");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32("", 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "the Empty string");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32("0", 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "string '0'");
|
||||
|
||||
sample.setInt32(2, 0);
|
||||
sample.setInt32("2", 42);
|
||||
assert.sameValue(sample.getInt32(2), 42, "string '2'");
|
||||
|
||||
sample.setInt32(1, 0);
|
||||
sample.setInt32(true, 42);
|
||||
assert.sameValue(sample.getInt32(1), 42, "true");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(false, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "false");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(NaN, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "NaN");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(null, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "null");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(0.1, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "0.1");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(0.9, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "0.9");
|
||||
|
||||
sample.setInt32(1, 0);
|
||||
sample.setInt32(1.1, 42);
|
||||
assert.sameValue(sample.getInt32(1), 42, "1.1");
|
||||
|
||||
sample.setInt32(1, 0);
|
||||
sample.setInt32(1.9, 42);
|
||||
assert.sameValue(sample.getInt32(1), 42, "1.9");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(-0.1, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "-0.1");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(-0.99999, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "-0.99999");
|
||||
|
||||
sample.setInt32(0, 0);
|
||||
sample.setInt32(undefined, 42);
|
||||
assert.sameValue(sample.getInt32(0), 42, "undefined");
|
||||
|
||||
sample.setInt32(0, 7);
|
||||
sample.setInt32();
|
||||
assert.sameValue(sample.getInt32(0), 0, "no arg");
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setint8
|
||||
es6id: 24.2.4.15
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [DataView.prototype.getInt8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8();
|
||||
}, "no args");
|
||||
assert.sameValue(sample.getInt8(0), 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(sample.getInt8(0), 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(sample.getInt8(0), 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(sample.getInt8(0), 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(sample.getInt8(0), 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(sample.getInt8(0), 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(sample.getInt8(0), 0, "-1.1 - no value was set");
|
|
@ -16,10 +16,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -28,9 +28,6 @@ var buffer = new ArrayBuffer(12);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setInt8(-1, 0);
|
||||
|
|
|
@ -11,11 +11,9 @@ info: >
|
|||
3. Return SetViewValue(v, byteOffset, littleEndian, "Int8", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ? ToInteger(numberIndex).
|
||||
5. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
6. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -27,14 +25,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(NaN, poisoned);
|
||||
}, "setInt8(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(1.5, poisoned);
|
||||
}, "setInt8(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(-1.5, poisoned);
|
||||
}, "setInt8(-1.5, poisoned)");
|
||||
|
@ -46,40 +36,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(-Infinity, poisoned);
|
||||
}, "setInt8(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(undefined, poisoned);
|
||||
}, "setInt8(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8('invalid', poisoned);
|
||||
}, "setInt8('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8('NaN', poisoned);
|
||||
}, "setInt8('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8('1.5', poisoned);
|
||||
}, "setInt8('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8('-1.5', poisoned);
|
||||
}, "setInt8('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8('-1', poisoned);
|
||||
}, "setInt8('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8('-Infinity', poisoned);
|
||||
}, "setInt8('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(obj, poisoned);
|
||||
}, "setInt8(obj, poisoned)");
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.4.15
|
||||
description: >
|
||||
The requested index is converted with ToInteger.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Int8", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ToInteger(numberIndex).
|
||||
5. ReturnIfAbrupt(getIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||
|
||||
dataView.setInt8(+0, 1);
|
||||
assert.sameValue(dataView.getInt8(0), 1, "setInt8(+0, 1)");
|
||||
|
||||
dataView.setInt8(-0, 2);
|
||||
assert.sameValue(dataView.getInt8(0), 2, "setInt8(-0, 2)");
|
||||
|
||||
dataView.setInt8(1, 3);
|
||||
assert.sameValue(dataView.getInt8(1), 3, "setInt8(1, 3)");
|
||||
|
||||
dataView.setInt8(null, 4);
|
||||
assert.sameValue(dataView.getInt8(0), 4, "setInt8(null, 4)");
|
||||
|
||||
dataView.setInt8(false, 5);
|
||||
assert.sameValue(dataView.getInt8(0), 5, "setInt8(false, 5)");
|
||||
|
||||
dataView.setInt8(true, 6);
|
||||
assert.sameValue(dataView.getInt8(1), 6, "setInt8(true, 6)");
|
||||
|
||||
dataView.setInt8("", 7);
|
||||
assert.sameValue(dataView.getInt8(0), 7, "setInt8('', 7)");
|
||||
|
||||
// Math.pow(2, 31) = 2147483648
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(2147483648, 8);
|
||||
}, "setInt8(2147483648, 8)");
|
||||
|
||||
// Math.pow(2, 32) = 4294967296
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setInt8(4294967296, 9);
|
||||
}, "setInt8(4294967296, 9)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
dataView.setInt8(obj, 10);
|
||||
assert.sameValue(dataView.getInt8(1), 10, "setInt8(obj, 10)");
|
|
@ -15,9 +15,7 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getInt8]
|
||||
---*/
|
|
@ -0,0 +1,108 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setint8
|
||||
es6id: 24.2.4.15
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? SetViewValue(v, byteOffset, true, "Int8", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getInt8]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(-0, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "-0");
|
||||
|
||||
sample.setInt8(3, 0);
|
||||
sample.setInt8(obj1, 42);
|
||||
assert.sameValue(sample.getInt8(3), 42, "object's valueOf");
|
||||
|
||||
sample.setInt8(4, 0);
|
||||
sample.setInt8(obj2, 42);
|
||||
assert.sameValue(sample.getInt8(4), 42, "object's toString");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8("", 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "the Empty string");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8("0", 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "string '0'");
|
||||
|
||||
sample.setInt8(2, 0);
|
||||
sample.setInt8("2", 42);
|
||||
assert.sameValue(sample.getInt8(2), 42, "string '2'");
|
||||
|
||||
sample.setInt8(1, 0);
|
||||
sample.setInt8(true, 42);
|
||||
assert.sameValue(sample.getInt8(1), 42, "true");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(false, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "false");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(NaN, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "NaN");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(null, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "null");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(0.1, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "0.1");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(0.9, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "0.9");
|
||||
|
||||
sample.setInt8(1, 0);
|
||||
sample.setInt8(1.1, 42);
|
||||
assert.sameValue(sample.getInt8(1), 42, "1.1");
|
||||
|
||||
sample.setInt8(1, 0);
|
||||
sample.setInt8(1.9, 42);
|
||||
assert.sameValue(sample.getInt8(1), 42, "1.9");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(-0.1, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "-0.1");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(-0.99999, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "-0.99999");
|
||||
|
||||
sample.setInt8(0, 0);
|
||||
sample.setInt8(undefined, 42);
|
||||
assert.sameValue(sample.getInt8(0), 42, "undefined");
|
||||
|
||||
sample.setInt8(0, 7);
|
||||
sample.setInt8();
|
||||
assert.sameValue(sample.getInt8(0), 0, "no arg");
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setuint16
|
||||
es6id: 24.2.4.19
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.19 DataView.prototype.setUint16 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Uint16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [DataView.prototype.getUint16]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16();
|
||||
}, "no args");
|
||||
assert.sameValue(sample.getUint16(0), 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(sample.getUint16(0), 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(sample.getUint16(0), 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(sample.getUint16(0), 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(sample.getUint16(0), 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(sample.getUint16(0), 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(sample.getUint16(0), 0, "-1.1 - no value was set");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(12);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint16(-1, 0);
|
||||
|
|
|
@ -11,11 +11,9 @@ info: >
|
|||
3. Return SetViewValue(v, byteOffset, littleEndian, "Uint16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ? ToInteger(numberIndex).
|
||||
5. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
6. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -27,14 +25,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(NaN, poisoned);
|
||||
}, "setUint16(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(1.5, poisoned);
|
||||
}, "setUint16(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(-1.5, poisoned);
|
||||
}, "setUint16(-1.5, poisoned)");
|
||||
|
@ -46,40 +36,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(-Infinity, poisoned);
|
||||
}, "setUint16(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(undefined, poisoned);
|
||||
}, "setUint16(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16('invalid', poisoned);
|
||||
}, "setUint16('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16('NaN', poisoned);
|
||||
}, "setUint16('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16('1.5', poisoned);
|
||||
}, "setUint16('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16('-1.5', poisoned);
|
||||
}, "setUint16('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16('-1', poisoned);
|
||||
}, "setUint16('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16('-Infinity', poisoned);
|
||||
}, "setUint16('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(obj, poisoned);
|
||||
}, "setUint16(obj, poisoned)");
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.4.19
|
||||
description: >
|
||||
The requested index is converted with ToInteger.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Uint16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ToInteger(numberIndex).
|
||||
5. ReturnIfAbrupt(getIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||
|
||||
dataView.setUint16(+0, 1);
|
||||
assert.sameValue(dataView.getUint16(0), 1, "setUint16(+0, 1)");
|
||||
|
||||
dataView.setUint16(-0, 2);
|
||||
assert.sameValue(dataView.getUint16(0), 2, "setUint16(-0, 2)");
|
||||
|
||||
dataView.setUint16(1, 3);
|
||||
assert.sameValue(dataView.getUint16(1), 3, "setUint16(1, 3)");
|
||||
|
||||
dataView.setUint16(null, 4);
|
||||
assert.sameValue(dataView.getUint16(0), 4, "setUint16(null, 4)");
|
||||
|
||||
dataView.setUint16(false, 5);
|
||||
assert.sameValue(dataView.getUint16(0), 5, "setUint16(false, 5)");
|
||||
|
||||
dataView.setUint16(true, 6);
|
||||
assert.sameValue(dataView.getUint16(1), 6, "setUint16(true, 6)");
|
||||
|
||||
dataView.setUint16("", 7);
|
||||
assert.sameValue(dataView.getUint16(0), 7, "setUint16('', 7)");
|
||||
|
||||
// Math.pow(2, 31) = 2147483648
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(2147483648, 8);
|
||||
}, "setUint16(2147483648, 8)");
|
||||
|
||||
// Math.pow(2, 32) = 4294967296
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint16(4294967296, 9);
|
||||
}, "setUint16(4294967296, 9)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
dataView.setUint16(obj, 10);
|
||||
assert.sameValue(dataView.getUint16(1), 10, "setUint16(obj, 10)");
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getUint16]
|
||||
---*/
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setuint16
|
||||
es6id: 24.2.4.19
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.19 DataView.prototype.setUint16 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Uint16", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getUint16]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(-0, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "-0");
|
||||
|
||||
sample.setUint16(3, 0);
|
||||
sample.setUint16(obj1, 42);
|
||||
assert.sameValue(sample.getUint16(3), 42, "object's valueOf");
|
||||
|
||||
sample.setUint16(4, 0);
|
||||
sample.setUint16(obj2, 42);
|
||||
assert.sameValue(sample.getUint16(4), 42, "object's toString");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16("", 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "the Empty string");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16("0", 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "string '0'");
|
||||
|
||||
sample.setUint16(2, 0);
|
||||
sample.setUint16("2", 42);
|
||||
assert.sameValue(sample.getUint16(2), 42, "string '2'");
|
||||
|
||||
sample.setUint16(1, 0);
|
||||
sample.setUint16(true, 42);
|
||||
assert.sameValue(sample.getUint16(1), 42, "true");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(false, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "false");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(NaN, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "NaN");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(null, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "null");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(0.1, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "0.1");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(0.9, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "0.9");
|
||||
|
||||
sample.setUint16(1, 0);
|
||||
sample.setUint16(1.1, 42);
|
||||
assert.sameValue(sample.getUint16(1), 42, "1.1");
|
||||
|
||||
sample.setUint16(1, 0);
|
||||
sample.setUint16(1.9, 42);
|
||||
assert.sameValue(sample.getUint16(1), 42, "1.9");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(-0.1, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "-0.1");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(-0.99999, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "-0.99999");
|
||||
|
||||
sample.setUint16(0, 0);
|
||||
sample.setUint16(undefined, 42);
|
||||
assert.sameValue(sample.getUint16(0), 42, "undefined");
|
||||
|
||||
sample.setUint16(0, 7);
|
||||
sample.setUint16();
|
||||
assert.sameValue(sample.getUint16(0), 0, "no arg");
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setuint32
|
||||
es6id: 24.2.4.20
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.20 DataView.prototype.setUint32 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Uint32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [DataView.prototype.getUint32]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32();
|
||||
}, "no args");
|
||||
assert.sameValue(sample.getUint32(0), 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(sample.getUint32(0), 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(sample.getUint32(0), 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(sample.getUint32(0), 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(sample.getUint32(0), 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(sample.getUint32(0), 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(sample.getUint32(0), 0, "-1.1 - no value was set");
|
|
@ -17,10 +17,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -29,9 +29,6 @@ var buffer = new ArrayBuffer(12);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint32(-1, 0);
|
||||
|
|
|
@ -11,11 +11,9 @@ info: >
|
|||
3. Return SetViewValue(v, byteOffset, littleEndian, "Uint32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ? ToInteger(numberIndex).
|
||||
5. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
6. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -27,14 +25,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(NaN, poisoned);
|
||||
}, "setUint32(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(1.5, poisoned);
|
||||
}, "setUint32(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(-1.5, poisoned);
|
||||
}, "setUint32(-1.5, poisoned)");
|
||||
|
@ -46,40 +36,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(-Infinity, poisoned);
|
||||
}, "setUint32(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(undefined, poisoned);
|
||||
}, "setUint32(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32('invalid', poisoned);
|
||||
}, "setUint32('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32('NaN', poisoned);
|
||||
}, "setUint32('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32('1.5', poisoned);
|
||||
}, "setUint32('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32('-1.5', poisoned);
|
||||
}, "setUint32('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32('-1', poisoned);
|
||||
}, "setUint32('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32('-Infinity', poisoned);
|
||||
}, "setUint32('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(obj, poisoned);
|
||||
}, "setUint32(obj, poisoned)");
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 24.2.4.20
|
||||
description: >
|
||||
The requested index is converted with ToInteger.
|
||||
info: >
|
||||
...
|
||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Uint32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ToInteger(numberIndex).
|
||||
5. ReturnIfAbrupt(getIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||
|
||||
dataView.setUint32(+0, 1);
|
||||
assert.sameValue(dataView.getUint32(0), 1, "setUint32(+0, 1)");
|
||||
|
||||
dataView.setUint32(-0, 2);
|
||||
assert.sameValue(dataView.getUint32(0), 2, "setUint32(-0, 2)");
|
||||
|
||||
dataView.setUint32(1, 3);
|
||||
assert.sameValue(dataView.getUint32(1), 3, "setUint32(1, 3)");
|
||||
|
||||
dataView.setUint32(null, 4);
|
||||
assert.sameValue(dataView.getUint32(0), 4, "setUint32(null, 4)");
|
||||
|
||||
dataView.setUint32(false, 5);
|
||||
assert.sameValue(dataView.getUint32(0), 5, "setUint32(false, 5)");
|
||||
|
||||
dataView.setUint32(true, 6);
|
||||
assert.sameValue(dataView.getUint32(1), 6, "setUint32(true, 6)");
|
||||
|
||||
dataView.setUint32("", 7);
|
||||
assert.sameValue(dataView.getUint32(0), 7, "setUint32('', 7)");
|
||||
|
||||
// Math.pow(2, 31) = 2147483648
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(2147483648, 8);
|
||||
}, "setUint32(2147483648, 8)");
|
||||
|
||||
// Math.pow(2, 32) = 4294967296
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint32(4294967296, 9);
|
||||
}, "setUint32(4294967296, 9)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
dataView.setUint32(obj, 10);
|
||||
assert.sameValue(dataView.getUint32(1), 10, "setUint32(obj, 10)");
|
|
@ -16,9 +16,7 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getUint32]
|
||||
---*/
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setuint32
|
||||
es6id: 24.2.4.20
|
||||
description: >
|
||||
ToIndex conversions on byteOffset
|
||||
info: |
|
||||
24.2.4.20 DataView.prototype.setUint32 ( byteOffset, value [ , littleEndian ] )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. If littleEndian is not present, let littleEndian be false.
|
||||
3. Return ? SetViewValue(v, byteOffset, littleEndian, "Uint32", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
features: [DataView.prototype.getUint32]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
|
||||
var obj1 = {
|
||||
valueOf: function() {
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
var obj2 = {
|
||||
toString: function() {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(-0, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "-0");
|
||||
|
||||
sample.setUint32(3, 0);
|
||||
sample.setUint32(obj1, 42);
|
||||
assert.sameValue(sample.getUint32(3), 42, "object's valueOf");
|
||||
|
||||
sample.setUint32(4, 0);
|
||||
sample.setUint32(obj2, 42);
|
||||
assert.sameValue(sample.getUint32(4), 42, "object's toString");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32("", 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "the Empty string");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32("0", 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "string '0'");
|
||||
|
||||
sample.setUint32(2, 0);
|
||||
sample.setUint32("2", 42);
|
||||
assert.sameValue(sample.getUint32(2), 42, "string '2'");
|
||||
|
||||
sample.setUint32(1, 0);
|
||||
sample.setUint32(true, 42);
|
||||
assert.sameValue(sample.getUint32(1), 42, "true");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(false, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "false");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(NaN, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "NaN");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(null, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "null");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(0.1, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "0.1");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(0.9, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "0.9");
|
||||
|
||||
sample.setUint32(1, 0);
|
||||
sample.setUint32(1.1, 42);
|
||||
assert.sameValue(sample.getUint32(1), 42, "1.1");
|
||||
|
||||
sample.setUint32(1, 0);
|
||||
sample.setUint32(1.9, 42);
|
||||
assert.sameValue(sample.getUint32(1), 42, "1.9");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(-0.1, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "-0.1");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(-0.99999, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "-0.99999");
|
||||
|
||||
sample.setUint32(0, 0);
|
||||
sample.setUint32(undefined, 42);
|
||||
assert.sameValue(sample.getUint32(0), 42, "undefined");
|
||||
|
||||
sample.setUint32(0, 7);
|
||||
sample.setUint32();
|
||||
assert.sameValue(sample.getUint32(0), 0, "no arg");
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-dataview.prototype.setuint8
|
||||
es6id: 24.2.4.18
|
||||
description: >
|
||||
Throws a RangeError if numberIndex ≠ getIndex
|
||||
info: |
|
||||
24.2.4.18 DataView.prototype.setUint8 ( byteOffset, value )
|
||||
|
||||
1. Let v be the this value.
|
||||
2. Return ? SetViewValue(v, byteOffset, true, "Uint8", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
4. Let numberIndex be ? ToNumber(requestIndex).
|
||||
5. Let getIndex be ToInteger(numberIndex).
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
...
|
||||
features: [Uint8Array]
|
||||
---*/
|
||||
|
||||
var buffer = new ArrayBuffer(12);
|
||||
var sample = new DataView(buffer, 0);
|
||||
var typedArray = new Uint8Array(buffer, 0);
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8();
|
||||
}, "no args");
|
||||
assert.sameValue(typedArray[0], 0, "no args - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(undefined, 39);
|
||||
}, "undefined");
|
||||
assert.sameValue(typedArray[0], 0, "undefined - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(1.1, 39);
|
||||
}, "floating number");
|
||||
assert.sameValue(typedArray[0], 0, "floating number - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(0.1, 39);
|
||||
}, "0.1");
|
||||
assert.sameValue(typedArray[0], 0, "0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(NaN, 39);
|
||||
}, "NaN");
|
||||
assert.sameValue(typedArray[0], 0, "NaN - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(-0.1, 39);
|
||||
}, "-0.1");
|
||||
assert.sameValue(typedArray[0], 0, "-0.1 - no value was set");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(-1.1, 39);
|
||||
}, "-1.1");
|
||||
assert.sameValue(typedArray[0], 0, "-1.1 - no value was set");
|
|
@ -16,10 +16,10 @@ info: |
|
|||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
7. Let buffer be view.[[ViewedArrayBuffer]].
|
||||
8. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
...
|
||||
includes: [detachArrayBuffer.js]
|
||||
---*/
|
||||
|
@ -28,9 +28,6 @@ var buffer = new ArrayBuffer(12);
|
|||
var sample = new DataView(buffer, 0);
|
||||
|
||||
$DETACHBUFFER(buffer);
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(1.1, 0);
|
||||
});
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
sample.setUint8(-1, 0);
|
||||
|
|
|
@ -11,11 +11,9 @@ info: >
|
|||
3. Return SetViewValue(v, byteOffset, littleEndian, "Uint8", value).
|
||||
|
||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||
|
||||
...
|
||||
3. Let numberIndex be ToNumber(requestIndex).
|
||||
4. Let getIndex be ? ToInteger(numberIndex).
|
||||
5. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||
6. Let numberValue be ? ToNumber(value).
|
||||
4. Let getIndex be ? ToIndex(requestIndex).
|
||||
...
|
||||
---*/
|
||||
|
||||
|
@ -27,14 +25,6 @@ var poisoned = {
|
|||
}
|
||||
};
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8(NaN, poisoned);
|
||||
}, "setUint8(NaN, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8(1.5, poisoned);
|
||||
}, "setUint8(1.5, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8(-1.5, poisoned);
|
||||
}, "setUint8(-1.5, poisoned)");
|
||||
|
@ -46,40 +36,3 @@ assert.throws(RangeError, function() {
|
|||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8(-Infinity, poisoned);
|
||||
}, "setUint8(-Infinity, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8(undefined, poisoned);
|
||||
}, "setUint8(undefined, poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8('invalid', poisoned);
|
||||
}, "setUint8('invalid', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8('NaN', poisoned);
|
||||
}, "setUint8('NaN', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8('1.5', poisoned);
|
||||
}, "setUint8('1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8('-1.5', poisoned);
|
||||
}, "setUint8('-1.5', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8('-1', poisoned);
|
||||
}, "setUint8('-1', poisoned)");
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8('-Infinity', poisoned);
|
||||
}, "setUint8('-Infinity', poisoned)");
|
||||
|
||||
var obj = {
|
||||
valueOf: function() {
|
||||
return 1.41421;
|
||||
}
|
||||
};
|
||||
assert.throws(RangeError, function() {
|
||||
dataView.setUint8(obj, poisoned);
|
||||
}, "setUint8(obj, poisoned)");
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue