test/script/basic/JDK-8144131.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1720
c09b105e7be5
permissions
-rw-r--r--

Merge

hannesw@1718 1 /*
hannesw@1718 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
hannesw@1718 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1718 4 *
hannesw@1718 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1718 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1718 7 * published by the Free Software Foundation.
hannesw@1718 8 *
hannesw@1718 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1718 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1718 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1718 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1718 13 * accompanied this code).
hannesw@1718 14 *
hannesw@1718 15 * You should have received a copy of the GNU General Public License version
hannesw@1718 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1718 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1718 18 *
hannesw@1718 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1718 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1718 21 * questions.
hannesw@1718 22 */
hannesw@1718 23
hannesw@1718 24 /**
hannesw@1718 25 * JDK-8144131: ArrayData.getInt implementations do not convert to int32
hannesw@1718 26 *
hannesw@1718 27 * @test
hannesw@1718 28 * @run
hannesw@1718 29 */
hannesw@1718 30
hannesw@1718 31 var doubleArray = [97912312397.234, -182374983434.56];
hannesw@1718 32 var doubleArrayResults = [-871935411, -1986357002];
hannesw@1718 33
hannesw@1720 34 // Make sure array uses double array data
hannesw@1718 35 Assert.assertEquals(doubleArray[0].getClass(), java.lang.Double.class);
hannesw@1718 36
hannesw@1718 37 function testBinaryOp(array, index, expected) {
hannesw@1718 38 Assert.assertEquals(array[index] & 0xffffffff, expected);
hannesw@1718 39 }
hannesw@1718 40
hannesw@1718 41 for (var i = 0; i < doubleArray.length; i++) {
hannesw@1718 42 testBinaryOp(doubleArray, i, doubleArrayResults[i]);
hannesw@1718 43 }
hannesw@1718 44

mercurial