JDK-8030199.js revision 877:cf4d2252d444
1139743Simp/*
243412Snewton * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
343412Snewton * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
443412Snewton *
543412Snewton * This code is free software; you can redistribute it and/or modify it
643412Snewton * under the terms of the GNU General Public License version 2 only, as
743412Snewton * published by the Free Software Foundation.
843412Snewton *
943412Snewton * This code is distributed in the hope that it will be useful, but WITHOUT
1043412Snewton * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1143412Snewton * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1243412Snewton * version 2 for more details (a copy is included in the LICENSE file that
1343412Snewton * accompanied this code).
1443412Snewton *
1543412Snewton * You should have received a copy of the GNU General Public License version
1643412Snewton * 2 along with this work; if not, write to the Free Software Foundation,
1743412Snewton * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1843412Snewton *
1943412Snewton * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2043412Snewton * or visit www.oracle.com if you need additional information or have any
2143412Snewton * questions.
2243412Snewton */
2343412Snewton
2443412Snewton/**
2543412Snewton * JDK-8030199: Nashorn: Uint8ClampedArray - Incorrect ToUint8Clamp implementation
2643412Snewton *
2743412Snewton * @test
2843412Snewton * @run
2943412Snewton */
3043412Snewton
31101709Srwatsonfunction testTypedArray(ArrayType) {
32116174Sobrien    print(ArrayType.BYTES_PER_ELEMENT);
33116174Sobrien    var a = new ArrayType(7);
34116174Sobrien    a[0] = 4294967296;
3543412Snewton    a[1] = -4294967295;
36224778Srwatson    a[2] = 4294967298;
3743412Snewton    a[3] = -4294967298;
3843412Snewton    a[4] = Infinity;
3943412Snewton    a[5] = -Infinity;
4043412Snewton    a[6] = NaN;
4176166Smarkm    print(Array.prototype.join.call(a));
42141486Sjhb}
4343412Snewton
4476166SmarkmtestTypedArray(Uint8ClampedArray);
4576166SmarkmtestTypedArray(Uint8Array);
46164033SrwatsontestTypedArray(Int8Array);
4776166SmarkmtestTypedArray(Uint16Array);
4876166SmarkmtestTypedArray(Int16Array);
49134266SjhbtestTypedArray(Uint32Array);
5076166SmarkmtestTypedArray(Int32Array);
5143412Snewton