diff options
Diffstat (limited to 'testing/web-platform/tests/typedarrays/ArrayBuffer_constructor.html')
-rw-r--r-- | testing/web-platform/tests/typedarrays/ArrayBuffer_constructor.html | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/testing/web-platform/tests/typedarrays/ArrayBuffer_constructor.html b/testing/web-platform/tests/typedarrays/ArrayBuffer_constructor.html new file mode 100644 index 000000000..7a94bc683 --- /dev/null +++ b/testing/web-platform/tests/typedarrays/ArrayBuffer_constructor.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Typed Arrays Test: ArrayBuffer constructor</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://www.khronos.org/registry/typedarray/specs/latest/#5"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> + +var args = [ + /* numbers */ + [NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0], + [-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2], + [1, 1], [-0xF1000000, 0], + /* strings */ + ["1", 1], ["1e2", 100], + /* null, undefined, booleans */ + [undefined, 0], [null, 0], [false, 0], [true, 1] +]; + +args.forEach(function (arg, i) { + test(function () { + var abuffer = new ArrayBuffer(arg[0]); + assert_equals(abuffer.byteLength, arg[1]); + }, "The argument " + format_value(arg[0]) + " should be interpreted as " + + arg[1] + " for ArrayBuffer constructor." + i); +}); + +</script> |