summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js')
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js b/js/src/tests/test262/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js
new file mode 100644
index 0000000000..a56f0c442a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js
@@ -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-%typedarray%.prototype.sort
+description: Sort values to numeric ascending order
+info: |
+ 22.2.3.26 %TypedArray%.prototype.sort ( comparefn )
+
+ When the TypedArray SortCompare abstract operation is called with two
+ arguments x and y, the following steps are taken:
+
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample;
+
+ sample = new TA([4n, 3n, 2n, 1n]).sort();
+ assert(compareArray(sample, [1n, 2n, 3n, 4n]), "descending values");
+
+ sample = new TA([3n, 4n, 1n, 2n]).sort();
+ assert(compareArray(sample, [1n, 2n, 3n, 4n]), "mixed numbers");
+
+ sample = new TA([3n, 4n, 3n, 1n, 0n, 1n, 2n]).sort();
+ assert(compareArray(sample, [0n, 1n, 1n, 2n, 3n, 3n, 4n]), "repeating numbers");
+});
+
+var sample = new BigInt64Array([-4n, 3n, 4n, -3n, 2n, -2n, 1n, 0n]).sort();
+assert(compareArray(sample, [-4n, -3n, -2n, 0n, 1n, 2n, 3n, 4n]), "negative values");
+
+reportCompare(0, 0);