summaryrefslogtreecommitdiff
path: root/test/built-ins/TypedArrays/Int16Array
diff options
context:
space:
mode:
authorAndré Bargull <andre.bargull@gmail.com>2016-01-15 18:13:08 +0100
committerAndré Bargull <andre.bargull@gmail.com>2016-01-15 18:13:08 +0100
commit1bac79fbf3d7a101c02b5c163bb89cc914e4f9d7 (patch)
treec1c2ace2eee3878a67d100b881d3284fbe23812d /test/built-ins/TypedArrays/Int16Array
parent42edfd6e894809b3945ac730affff3569a303ad4 (diff)
downloadqtdeclarative-testsuites-1bac79fbf3d7a101c02b5c163bb89cc914e4f9d7.tar.gz
Add basic surface tests for TypedArrays
Diffstat (limited to 'test/built-ins/TypedArrays/Int16Array')
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js20
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/constructor.js10
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/length.js29
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/name.js27
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/proto.js13
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/prototype.js19
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js20
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/prototype/constructor.js23
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js16
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/prototype/proto.js14
-rwxr-xr-xtest/built-ins/TypedArrays/Int16Array/undefined-newtarget.js32
11 files changed, 223 insertions, 0 deletions
diff --git a/test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js
new file mode 100755
index 000000000..9968e7e03
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.5.1
+description: >
+ The initial value of Int16Array.BYTES_PER_ELEMENT is 2.
+info: >
+ The value of TypedArray.BYTES_PER_ELEMENT is the Number value of the
+ Element Size value specified in Table 49 for TypedArray.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Int16Array.BYTES_PER_ELEMENT, 2);
+
+verifyNotEnumerable(Int16Array, "BYTES_PER_ELEMENT");
+verifyNotWritable(Int16Array, "BYTES_PER_ELEMENT");
+verifyNotConfigurable(Int16Array, "BYTES_PER_ELEMENT");
diff --git a/test/built-ins/TypedArrays/Int16Array/constructor.js b/test/built-ins/TypedArrays/Int16Array/constructor.js
new file mode 100755
index 000000000..d87ba3823
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/constructor.js
@@ -0,0 +1,10 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.4
+description: >
+ Int16Array is a constructor function.
+---*/
+
+assert.sameValue(typeof Int16Array, 'function', 'typeof Int16Array is "function"');
diff --git a/test/built-ins/TypedArrays/Int16Array/length.js b/test/built-ins/TypedArrays/Int16Array/length.js
new file mode 100755
index 000000000..6d0286c86
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/length.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.5
+description: >
+ Int16Array.length is 3.
+info: >
+ Besides a length property (whose value is 3), [...].
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Int16Array.length, 3);
+
+verifyNotEnumerable(Int16Array, "length");
+verifyNotWritable(Int16Array, "length");
+verifyConfigurable(Int16Array, "length");
diff --git a/test/built-ins/TypedArrays/Int16Array/name.js b/test/built-ins/TypedArrays/Int16Array/name.js
new file mode 100755
index 000000000..a5ff20f99
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.5
+description: >
+ Int16Array.name is "Int16Array".
+info: >
+ Each TypedArray constructor has a name property whose value is the
+ String value of the constructor name specified for it in Table 49.
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Int16Array.name, "Int16Array");
+
+verifyNotEnumerable(Int16Array, "name");
+verifyNotWritable(Int16Array, "name");
+verifyConfigurable(Int16Array, "name");
diff --git a/test/built-ins/TypedArrays/Int16Array/proto.js b/test/built-ins/TypedArrays/Int16Array/proto.js
new file mode 100755
index 000000000..d1fa53bbc
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/proto.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.5
+description: >
+ The prototype of Int16Array is %TypedArray%.
+info: >
+ The value of the [[Prototype]] internal slot of each TypedArray constructor is the %TypedArray% intrinsic object (22.2.1).
+includes: [testTypedArray.js]
+---*/
+
+assert.sameValue(Object.getPrototypeOf(Int16Array), TypedArray);
diff --git a/test/built-ins/TypedArrays/Int16Array/prototype.js b/test/built-ins/TypedArrays/Int16Array/prototype.js
new file mode 100755
index 000000000..0ef409d14
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/prototype.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.5.2
+description: >
+ The initial value of Int16Array.prototype is the Int16Array prototype object.
+info: >
+ The initial value of TypedArray.prototype is the corresponding TypedArray prototype intrinsic object (22.2.6).
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Int16Array.prototype, Object.getPrototypeOf(new Int16Array(0)));
+
+verifyNotEnumerable(Int16Array, "prototype");
+verifyNotWritable(Int16Array, "prototype");
+verifyNotConfigurable(Int16Array, "prototype");
diff --git a/test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js
new file mode 100755
index 000000000..d16dbb254
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.6.1
+description: >
+ The initial value of Int16Array.prototype.BYTES_PER_ELEMENT is 2.
+info: >
+ The value of TypedArray.prototype.BYTES_PER_ELEMENT is the Number value
+ of the Element Size value specified in Table 49 for TypedArray.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Int16Array.prototype.BYTES_PER_ELEMENT, 2);
+
+verifyNotEnumerable(Int16Array.prototype, "BYTES_PER_ELEMENT");
+verifyNotWritable(Int16Array.prototype, "BYTES_PER_ELEMENT");
+verifyNotConfigurable(Int16Array.prototype, "BYTES_PER_ELEMENT");
diff --git a/test/built-ins/TypedArrays/Int16Array/prototype/constructor.js b/test/built-ins/TypedArrays/Int16Array/prototype/constructor.js
new file mode 100755
index 000000000..e1a40604c
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/prototype/constructor.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.6.2
+description: >
+ The initial value of Int16Array.prototype.constructor is the Int16Array object.
+info: >
+ The initial value of Int16Array.prototype.constructor is the intrinsic
+ object %Int16Array%.
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every other data property described in clauses 18 through 26 and in Annex B.2 has
+ the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
+ unless otherwise specified.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Int16Array.prototype.constructor, Int16Array);
+
+verifyNotEnumerable(Int16Array.prototype, "constructor");
+verifyWritable(Int16Array.prototype, "constructor");
+verifyConfigurable(Int16Array.prototype, "constructor");
diff --git a/test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js
new file mode 100755
index 000000000..b277f1a3a
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.6
+description: >
+ Int16Array.prototype is not a TypedArray instance object.
+info: >
+ A TypedArray prototype object is an ordinary object. It does not have
+ a [[ViewedArrayBuffer]] or any other of the internal slots that are
+ specific to TypedArray instance objects.
+---*/
+
+assert.throws(TypeError, function() {
+ Int16Array.prototype.buffer;
+});
diff --git a/test/built-ins/TypedArrays/Int16Array/prototype/proto.js b/test/built-ins/TypedArrays/Int16Array/prototype/proto.js
new file mode 100755
index 000000000..6062dc8a5
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/prototype/proto.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 22.2.6
+description: >
+ The prototype of Int16Array.prototype is %TypedArrayPrototype%.
+info: >
+ The value of the [[Prototype]] internal slot of a TypedArray prototype
+ object is the intrinsic object %TypedArrayPrototype% (22.2.3).
+includes: [testTypedArray.js]
+---*/
+
+assert.sameValue(Object.getPrototypeOf(Int16Array.prototype), TypedArray.prototype);
diff --git a/test/built-ins/TypedArrays/Int16Array/undefined-newtarget.js b/test/built-ins/TypedArrays/Int16Array/undefined-newtarget.js
new file mode 100755
index 000000000..664fc5ba0
--- /dev/null
+++ b/test/built-ins/TypedArrays/Int16Array/undefined-newtarget.js
@@ -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: 22.2.4.1
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: >
+ TypedArray( ... argumentsList)
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+---*/
+
+assert.throws(TypeError, function() {
+ Int16Array();
+}, "Int16Array()");
+
+assert.throws(TypeError, function() {
+ Int16Array(0);
+}, "Int16Array(0)");
+
+assert.throws(TypeError, function() {
+ Int16Array(new Int16Array(1));
+}, "Int16Array(int16Array)");
+
+assert.throws(TypeError, function() {
+ Int16Array([]);
+}, "Int16Array(array)");
+
+assert.throws(TypeError, function() {
+ Int16Array(new ArrayBuffer(8));
+}, "Int16Array(arrayBuffer)");