summaryrefslogtreecommitdiff
path: root/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js')
-rw-r--r--test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js
new file mode 100644
index 000000000..07ec82242
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js
@@ -0,0 +1,35 @@
+// 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-%typedarray%.prototype.set
+es6id: 22.2.3.22.2
+description: Preservation of bit-level encoding
+info: |
+ [...]
+ 28. Else,
+ a. NOTE: If srcType and targetType are the same, the transfer must be
+ performed in a manner that preserves the bit-level encoding of the
+ source data.
+ b. Repeat, while targetByteIndex < limit
+ i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8").
+ ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8",
+ value).
+ iii. Set srcByteIndex to srcByteIndex + 1.
+ iv. Set targetByteIndex to targetByteIndex + 1.
+includes: [nans.js, compareArray.js, testBigIntTypedArray.js]
+---*/
+
+function body(FloatArray) {
+ var source = new FloatArray(distinctNaNs);
+ var target = new FloatArray(distinctNaNs.length);
+ var sourceBytes, targetBytes;
+
+ target.set(source);
+
+ sourceBytes = new Uint8Array(source.buffer);
+ targetBytes = new Uint8Array(target.buffer);
+
+ assert(compareArray(sourceBytes, targetBytes))
+}
+
+testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]);