mirror of https://github.com/tc39/test262.git
Add tests for DataView.prototype.setFloat32
This commit is contained in:
parent
bc42c6ab5c
commit
da67e6b305
62
test/built-ins/DataView/prototype/setFloat32/byteoffset-is-different-integer-throws.js
vendored
Normal file
62
test/built-ins/DataView/prototype/setFloat32/byteoffset-is-different-integer-throws.js
vendored
Normal file
|
@ -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.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");
|
37
test/built-ins/DataView/prototype/setFloat32/byteoffset-is-negative-throws.js
vendored
Normal file
37
test/built-ins/DataView/prototype/setFloat32/byteoffset-is-negative-throws.js
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
// 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 getIndex < 0
|
||||||
|
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(-1, 39);
|
||||||
|
}, "-1");
|
||||||
|
assert.sameValue(sample.getFloat32(0), 0, "-1 - no value was set");
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(-Infinity, 39);
|
||||||
|
}, "-Infinity");
|
||||||
|
assert.sameValue(sample.getFloat32(0), 0, "-Infinity - no value was set");
|
38
test/built-ins/DataView/prototype/setFloat32/detached-buffer-after-integer-byteoffset.js
vendored
Normal file
38
test/built-ins/DataView/prototype/setFloat32/detached-buffer-after-integer-byteoffset.js
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// 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: >
|
||||||
|
Detached buffer is checked after checking If numberIndex ≠ getIndex or
|
||||||
|
getIndex < 0
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||||
|
...
|
||||||
|
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
includes: [detachArrayBuffer.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
39
test/built-ins/DataView/prototype/setFloat32/detached-buffer-after-number-value.js
vendored
Normal file
39
test/built-ins/DataView/prototype/setFloat32/detached-buffer-after-number-value.js
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// 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: >
|
||||||
|
Detached buffer is checked after ToNumber(value)
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
7. Let numberValue be ? ToNumber(value).
|
||||||
|
...
|
||||||
|
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
includes: [detachArrayBuffer.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(8);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
var v = {
|
||||||
|
valueOf: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$DETACHBUFFER(buffer);
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
sample.setFloat32(0, v);
|
||||||
|
});
|
40
test/built-ins/DataView/prototype/setFloat32/detached-buffer-before-outofrange-byteoffset.js
vendored
Normal file
40
test/built-ins/DataView/prototype/setFloat32/detached-buffer-before-outofrange-byteoffset.js
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// 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: >
|
||||||
|
Detached buffer is checked before out of range byteOffset's value
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
14. If getIndex + elementSize > viewSize, throw a RangeError exception.
|
||||||
|
...
|
||||||
|
includes: [detachArrayBuffer.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var sample;
|
||||||
|
var buffer = new ArrayBuffer(12);
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
$DETACHBUFFER(buffer);
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sample.setFloat32(Infinity, 0);
|
||||||
|
}, "Infinity");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sample.setFloat32(13, 0);
|
||||||
|
}, "13");
|
|
@ -0,0 +1,31 @@
|
||||||
|
// 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 TypeError if buffer is detached
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
9. Let buffer be the value of view's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
includes: [detachArrayBuffer.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(1);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
$DETACHBUFFER(buffer);
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sample.setFloat32(0, 0);
|
||||||
|
});
|
|
@ -4,25 +4,27 @@
|
||||||
/*---
|
/*---
|
||||||
esid: sec-dataview.prototype.setfloat32
|
esid: sec-dataview.prototype.setfloat32
|
||||||
description: >
|
description: >
|
||||||
Throws a RangeError if the index is negative or non-integral number.
|
RangeError exception for negative or non-integral index is thrown before
|
||||||
|
the value conversion.
|
||||||
info: >
|
info: >
|
||||||
...
|
...
|
||||||
3. Return SetViewValue(v, byteOffset, littleEndian, "Float32", value).
|
3. Return SetViewValue(v, byteOffset, littleEndian, "Float32", value).
|
||||||
|
|
||||||
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value )
|
||||||
...
|
|
||||||
3. Let numberIndex be ToNumber(requestIndex).
|
...
|
||||||
4. Let getIndex be ? ToInteger(numberIndex).
|
4. Let numberIndex be ToNumber(requestIndex).
|
||||||
5. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
5. Let getIndex be ? ToInteger(numberIndex).
|
||||||
6. Let numberValue be ? ToNumber(value).
|
6. If numberIndex ≠ getIndex or getIndex < 0, throw a RangeError exception.
|
||||||
...
|
7. Let numberValue be ? ToNumber(value).
|
||||||
|
...
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var dataView = new DataView(new ArrayBuffer(8));
|
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||||
|
|
||||||
var poisoned = {
|
var poisoned = {
|
||||||
valueOf: function() {
|
valueOf: function() {
|
||||||
$ERROR("valueOf called");
|
throw new Test262Error("valueOf called");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
// 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 getIndex + elementSize > viewSize
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
11. Let viewOffset be the value of view's [[ByteOffset]] internal slot.
|
||||||
|
12. Let viewSize be the value of view's [[ByteLength]] internal slot.
|
||||||
|
13. Let elementSize be the Number value of the Element Size value specified in
|
||||||
|
Table 50 for Element Type type.
|
||||||
|
14. If getIndex + elementSize > viewSize, throw a RangeError exception.
|
||||||
|
...
|
||||||
|
features: [DataView.prototype.getFloat32]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var sample;
|
||||||
|
var buffer = new ArrayBuffer(12);
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(Infinity, 39);
|
||||||
|
}, "getIndex == Infinity");
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(13, 39);
|
||||||
|
}, "13 + 4 > 12");
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(12, 39);
|
||||||
|
}, "12 + 4 > 12");
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(11, 39);
|
||||||
|
}, "11 + 4 > 12");
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(10, 39);
|
||||||
|
}, "10 + 4 > 12");
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(9, 39);
|
||||||
|
}, "9 + 4 > 12");
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 8);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(1, 39);
|
||||||
|
}, "1 + 4 > 4 (offset)");
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 9);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(0, 39);
|
||||||
|
}, "0 + 4 > 3 (offset)");
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 0, 4);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(1, 39);
|
||||||
|
}, "1 + 4 > 4 (length)");
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 0, 3);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(0, 39);
|
||||||
|
}, "0 + 4 > 3 (length)");
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 4, 4);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(1, 39);
|
||||||
|
}, "1 + 4 > 4 (offset+length)");
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 4, 3);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
sample.setFloat32(0, 39);
|
||||||
|
}, "0 + 4 > 3 (offset+length)");
|
||||||
|
|
||||||
|
sample = new DataView(buffer, 0);
|
||||||
|
assert.sameValue(sample.getFloat32(0), 0, "[0] no value was set");
|
||||||
|
assert.sameValue(sample.getFloat32(4), 0, "[1] no value was set");
|
||||||
|
assert.sameValue(sample.getFloat32(8), 0, "[2] no value was set");
|
|
@ -17,7 +17,7 @@ info: >
|
||||||
...
|
...
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var dataView = new DataView(new ArrayBuffer(8));
|
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||||
|
|
||||||
dataView.setFloat32(+0, 1);
|
dataView.setFloat32(+0, 1);
|
||||||
assert.sameValue(dataView.getFloat32(0), 1, "setFloat32(+0, 1)");
|
assert.sameValue(dataView.getFloat32(0), 1, "setFloat32(+0, 1)");
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
// 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: >
|
||||||
|
Set value as undefined (cast to NaN) when value argument is not present
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
15. Let bufferIndex be getIndex + viewOffset.
|
||||||
|
16. Return SetValueInBuffer(buffer, bufferIndex, type, numberValue, isLittleEndian).
|
||||||
|
|
||||||
|
24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] )
|
||||||
|
|
||||||
|
...
|
||||||
|
8. If type is "Float32", then
|
||||||
|
a. Set rawBytes to a List containing the 4 bytes that are the result of
|
||||||
|
converting value to IEEE 754-2008 binary32 format using “Round to nearest,
|
||||||
|
ties to even” rounding mode. If isLittleEndian is false, the bytes are
|
||||||
|
arranged in big endian order. Otherwise, the bytes are arranged in little
|
||||||
|
endian order. If value is NaN, rawValue may be set to any implementation
|
||||||
|
chosen IEEE 754-2008 binary32 format Not-a-Number encoding. An
|
||||||
|
implementation must always choose the same encoding for each implementation
|
||||||
|
distinguishable NaN value.
|
||||||
|
...
|
||||||
|
11. Store the individual bytes of rawBytes into block, in order, starting at
|
||||||
|
block[byteIndex].
|
||||||
|
12. Return NormalCompletion(undefined).
|
||||||
|
features: [DataView.prototype.getFloat32]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(8);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
var result = sample.setFloat32(0);
|
||||||
|
|
||||||
|
assert.sameValue(sample.getFloat32(0), NaN);
|
||||||
|
assert.sameValue(result, undefined);
|
|
@ -22,28 +22,26 @@ info: >
|
||||||
...
|
...
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var dataView = new DataView(new ArrayBuffer(8));
|
var dataView = new DataView(new ArrayBuffer(8), 0);
|
||||||
|
|
||||||
function DummyError() { }
|
|
||||||
|
|
||||||
var poisoned = {
|
var poisoned = {
|
||||||
valueOf: function() {
|
valueOf: function() {
|
||||||
throw new DummyError();
|
throw new Test262Error();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
assert.throws(DummyError, function() {
|
assert.throws(Test262Error, function() {
|
||||||
dataView.setFloat32(Infinity, poisoned);
|
dataView.setFloat32(Infinity, poisoned);
|
||||||
}, "setFloat32(Infinity, poisoned)");
|
}, "setFloat32(Infinity, poisoned)");
|
||||||
|
|
||||||
assert.throws(DummyError, function() {
|
assert.throws(Test262Error, function() {
|
||||||
dataView.setFloat32(100, poisoned);
|
dataView.setFloat32(100, poisoned);
|
||||||
}, "setFloat32(100, poisoned)");
|
}, "setFloat32(100, poisoned)");
|
||||||
|
|
||||||
assert.throws(DummyError, function() {
|
assert.throws(Test262Error, function() {
|
||||||
dataView.setFloat32('Infinity', poisoned);
|
dataView.setFloat32('Infinity', poisoned);
|
||||||
}, "setFloat32('Infinity', poisoned)");
|
}, "setFloat32('Infinity', poisoned)");
|
||||||
|
|
||||||
assert.throws(DummyError, function() {
|
assert.throws(Test262Error, function() {
|
||||||
dataView.setFloat32('100', poisoned);
|
dataView.setFloat32('100', poisoned);
|
||||||
}, "setFloat32('100', poisoned)");
|
}, "setFloat32('100', poisoned)");
|
||||||
|
|
31
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-byteoffset-symbol.js
vendored
Normal file
31
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-byteoffset-symbol.js
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// 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: >
|
||||||
|
Return abrupt from ToNumber(symbol 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 numberIndex be ? ToNumber(requestIndex).
|
||||||
|
...
|
||||||
|
features: [Symbol]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(1);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
var s = Symbol("1");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sample.setFloat32(s);
|
||||||
|
});
|
44
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-byteoffset.js
vendored
Normal file
44
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-byteoffset.js
vendored
Normal file
|
@ -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.prototype.setfloat32
|
||||||
|
es6id: 24.2.4.13
|
||||||
|
description: >
|
||||||
|
Return abrupt from ToNumber(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 numberIndex be ? ToNumber(requestIndex).
|
||||||
|
...
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(1);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
var bo1 = {
|
||||||
|
valueOf: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var bo2 = {
|
||||||
|
toString: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
sample.setFloat32(bo1, 1);
|
||||||
|
}, "valueOf");
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
sample.setFloat32(bo2, 1);
|
||||||
|
}, "toString");
|
31
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-value-symbol.js
vendored
Normal file
31
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-value-symbol.js
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// 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: >
|
||||||
|
Return abrupt from ToNumber(symbol value)
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
7. Let numberValue be ? ToNumber(value).
|
||||||
|
...
|
||||||
|
features: [Symbol]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(4);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
var s = Symbol("1");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sample.setFloat32(0, s);
|
||||||
|
});
|
44
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-value.js
vendored
Normal file
44
test/built-ins/DataView/prototype/setFloat32/return-abrupt-from-tonumber-value.js
vendored
Normal file
|
@ -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.prototype.setfloat32
|
||||||
|
es6id: 24.2.4.13
|
||||||
|
description: >
|
||||||
|
Return abrupt from ToNumber(value)
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
7. Let numberValue be ? ToNumber(value).
|
||||||
|
...
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(4);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
var bo1 = {
|
||||||
|
valueOf: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var bo2 = {
|
||||||
|
toString: function() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
sample.setFloat32(0, bo1);
|
||||||
|
}, "valueOf");
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
sample.setFloat32(0, bo2);
|
||||||
|
}, "toString");
|
52
test/built-ins/DataView/prototype/setFloat32/set-values-little-endian-order.js
vendored
Normal file
52
test/built-ins/DataView/prototype/setFloat32/set-values-little-endian-order.js
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
// 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: >
|
||||||
|
Set values with little endian order.
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
15. Let bufferIndex be getIndex + viewOffset.
|
||||||
|
16. Return SetValueInBuffer(buffer, bufferIndex, type, numberValue, isLittleEndian).
|
||||||
|
|
||||||
|
24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] )
|
||||||
|
|
||||||
|
...
|
||||||
|
8. If type is "Float32", then
|
||||||
|
a. Set rawBytes to a List containing the 4 bytes that are the result of
|
||||||
|
converting value to IEEE 754-2008 binary32 format using “Round to nearest,
|
||||||
|
ties to even” rounding mode. If isLittleEndian is false, the bytes are
|
||||||
|
arranged in big endian order. Otherwise, the bytes are arranged in little
|
||||||
|
endian order. If value is NaN, rawValue may be set to any implementation
|
||||||
|
chosen IEEE 754-2008 binary32 format Not-a-Number encoding. An
|
||||||
|
implementation must always choose the same encoding for each implementation
|
||||||
|
distinguishable NaN value.
|
||||||
|
...
|
||||||
|
11. Store the individual bytes of rawBytes into block, in order, starting at
|
||||||
|
block[byteIndex].
|
||||||
|
12. Return NormalCompletion(undefined).
|
||||||
|
features: [DataView.prototype.getFloat32]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(4);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
var result;
|
||||||
|
|
||||||
|
result = sample.setFloat32(0, 42, true);
|
||||||
|
assert.sameValue(result, undefined, "returns undefined #1");
|
||||||
|
assert.sameValue(sample.getFloat32(0), 1.4441781973331565e-41);
|
||||||
|
|
||||||
|
result = sample.setFloat32(0, 1.4441781973331565e-41, true);
|
||||||
|
assert.sameValue(result, undefined, "returns undefined #2");
|
||||||
|
assert.sameValue(sample.getFloat32(0), 42);
|
|
@ -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.setfloat32
|
||||||
|
es6id: 24.2.4.13
|
||||||
|
description: >
|
||||||
|
Set values and return undefined
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
15. Let bufferIndex be getIndex + viewOffset.
|
||||||
|
16. Return SetValueInBuffer(buffer, bufferIndex, type, numberValue, isLittleEndian).
|
||||||
|
|
||||||
|
24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] )
|
||||||
|
|
||||||
|
...
|
||||||
|
8. If type is "Float32", then
|
||||||
|
a. Set rawBytes to a List containing the 4 bytes that are the result of
|
||||||
|
converting value to IEEE 754-2008 binary32 format using “Round to nearest,
|
||||||
|
ties to even” rounding mode. If isLittleEndian is false, the bytes are
|
||||||
|
arranged in big endian order. Otherwise, the bytes are arranged in little
|
||||||
|
endian order. If value is NaN, rawValue may be set to any implementation
|
||||||
|
chosen IEEE 754-2008 binary32 format Not-a-Number encoding. An
|
||||||
|
implementation must always choose the same encoding for each implementation
|
||||||
|
distinguishable NaN value.
|
||||||
|
...
|
||||||
|
11. Store the individual bytes of rawBytes into block, in order, starting at
|
||||||
|
block[byteIndex].
|
||||||
|
12. Return NormalCompletion(undefined).
|
||||||
|
features: [DataView.prototype.getFloat32]
|
||||||
|
includes: [byteConversionValues.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(4);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
var values = byteConversionValues.values;
|
||||||
|
var expectedValues = byteConversionValues.expected.Float32;
|
||||||
|
|
||||||
|
values.forEach(function(value, i) {
|
||||||
|
var result;
|
||||||
|
var expected = expectedValues[i];
|
||||||
|
|
||||||
|
result = sample.setFloat32(0, value, false);
|
||||||
|
|
||||||
|
assert.sameValue(
|
||||||
|
sample.getFloat32(0),
|
||||||
|
expected,
|
||||||
|
"value: " + value
|
||||||
|
);
|
||||||
|
assert.sameValue(
|
||||||
|
result,
|
||||||
|
undefined,
|
||||||
|
"return is undefined, value: " + value
|
||||||
|
);
|
||||||
|
});
|
43
test/built-ins/DataView/prototype/setFloat32/this-has-no-dataview-internal.js
vendored
Normal file
43
test/built-ins/DataView/prototype/setFloat32/this-has-no-dataview-internal.js
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// 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 TypeError if this does not have a [[DataView]] internal slot
|
||||||
|
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 )
|
||||||
|
|
||||||
|
1. If Type(view) is not Object, throw a TypeError exception.
|
||||||
|
2. If view does not have a [[DataView]] internal slot, throw a TypeError
|
||||||
|
exception.
|
||||||
|
...
|
||||||
|
features: [Int8Array]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var setFloat32 = DataView.prototype.setFloat32;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call({});
|
||||||
|
}, "{}");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call([]);
|
||||||
|
}, "[]");
|
||||||
|
|
||||||
|
var ab = new ArrayBuffer(1);
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(ab);
|
||||||
|
}, "ArrayBuffer");
|
||||||
|
|
||||||
|
var ta = new Int8Array();
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(ta);
|
||||||
|
}, "TypedArray");
|
|
@ -0,0 +1,51 @@
|
||||||
|
// 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 TypeError if this is not Object
|
||||||
|
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 )
|
||||||
|
|
||||||
|
1. If Type(view) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
features: [Symbol]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var setFloat32 = DataView.prototype.setFloat32;
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(undefined);
|
||||||
|
}, "undefined");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(null);
|
||||||
|
}, "null");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(1);
|
||||||
|
}, "1");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call("string");
|
||||||
|
}, "string");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(true);
|
||||||
|
}, "true");
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(false);
|
||||||
|
}, "false");
|
||||||
|
|
||||||
|
var s = Symbol("1");
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
setFloat32.call(s);
|
||||||
|
}, "symbol");
|
|
@ -0,0 +1,58 @@
|
||||||
|
// 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: >
|
||||||
|
Boolean littleEndian argument coerced in ToBoolean
|
||||||
|
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 )
|
||||||
|
|
||||||
|
...
|
||||||
|
15. Let bufferIndex be getIndex + viewOffset.
|
||||||
|
16. Return SetValueInBuffer(buffer, bufferIndex, type, numberValue, isLittleEndian).
|
||||||
|
|
||||||
|
24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] )
|
||||||
|
|
||||||
|
...
|
||||||
|
8. If type is "Float32", then
|
||||||
|
a. Set rawBytes to a List containing the 4 bytes that are the result of
|
||||||
|
converting value to IEEE 754-2008 binary32 format using “Round to nearest,
|
||||||
|
ties to even” rounding mode. If isLittleEndian is false, the bytes are
|
||||||
|
arranged in big endian order. Otherwise, the bytes are arranged in little
|
||||||
|
endian order. [...]
|
||||||
|
...
|
||||||
|
features: [DataView.prototype.getFloat32, Symbol]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var buffer = new ArrayBuffer(4);
|
||||||
|
var sample = new DataView(buffer, 0);
|
||||||
|
|
||||||
|
// False
|
||||||
|
sample.setFloat32(0, 1);
|
||||||
|
assert.sameValue(sample.getFloat32(0), 1, "no arg");
|
||||||
|
sample.setFloat32(0, 2, undefined);
|
||||||
|
assert.sameValue(sample.getFloat32(0), 2, "undefined");
|
||||||
|
sample.setFloat32(0, 3, null);
|
||||||
|
assert.sameValue(sample.getFloat32(0), 3, "null");
|
||||||
|
sample.setFloat32(0, 4, 0);
|
||||||
|
assert.sameValue(sample.getFloat32(0), 4, "0");
|
||||||
|
sample.setFloat32(0, 5, "");
|
||||||
|
assert.sameValue(sample.getFloat32(0), 5, "the empty string");
|
||||||
|
|
||||||
|
// True
|
||||||
|
sample.setFloat32(0, 6, {});
|
||||||
|
assert.sameValue(sample.getFloat32(0), 6.89663052202102e-41, "{}");
|
||||||
|
sample.setFloat32(0, 7, Symbol("1"));
|
||||||
|
assert.sameValue(sample.getFloat32(0), 8.04457422399591e-41, "symbol");
|
||||||
|
sample.setFloat32(0, 8, 1);
|
||||||
|
assert.sameValue(sample.getFloat32(0), 9.10844001811131e-44, "1");
|
||||||
|
sample.setFloat32(0, 9, "string");
|
||||||
|
assert.sameValue(sample.getFloat32(0), 5.830802910055564e-42, "string");
|
Loading…
Reference in New Issue