test/script/basic/typedarrays.js

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * typedarray test.
  26  *
  27  * @test
  28  * @run
  29  */
  30 











  31 
  32 var typeDefinitions = [
  33 Int8Array,
  34 Uint8Array,
  35 Uint8ClampedArray,
  36 Int16Array,
  37 Uint16Array,
  38 Int32Array,
  39 Uint32Array,
  40 Float32Array,
  41 Float64Array,
  42 ];
  43 
  44 var mem1 = new ArrayBuffer(1024);
  45 mem1.byteLength;
  46 mem1.slice(512);
  47 mem1.slice(512, 748);
  48 
  49 var size = 128;
  50 var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * typedarray test.
  26  *
  27  * @test
  28  * @run
  29  */
  30 
  31 //JDK-8066217, constructor for arraybuffer not behaving as per spec
  32 function checkLength(ab, l) {
  33     if (ab.byteLength != l) {
  34         throw "length error: " + ab.byteLength + " != " + l;
  35     }
  36 }
  37 checkLength(new ArrayBuffer(), 0);
  38 checkLength(new ArrayBuffer(0), 0);
  39 checkLength(new ArrayBuffer(1024), 1024);
  40 checkLength(new ArrayBuffer(1,2,3), 1);
  41 checkLength(new ArrayBuffer([17]), 17);
  42 
  43 var typeDefinitions = [
  44 Int8Array,
  45 Uint8Array,
  46 Uint8ClampedArray,
  47 Int16Array,
  48 Uint16Array,
  49 Int32Array,
  50 Uint32Array,
  51 Float32Array,
  52 Float64Array,
  53 ];
  54 
  55 var mem1 = new ArrayBuffer(1024);
  56 mem1.byteLength;
  57 mem1.slice(512);
  58 mem1.slice(512, 748);
  59 
  60 var size = 128;
  61 var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];