test/script/basic/JDK-8181191.js

Wed, 05 Sep 2018 01:21:35 -0700

author
diazhou
date
Wed, 05 Sep 2018 01:21:35 -0700
changeset 2374
037913b52507
parent 2090
261b6629403e
permissions
-rw-r--r--

Added tag jdk8u192-b09 for changeset 456c0d45c43b

hannesw@2090 1 /*
hannesw@2090 2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
hannesw@2090 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@2090 4 *
hannesw@2090 5 * This code is free software; you can redistribute it and/or modify it
hannesw@2090 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@2090 7 * published by the Free Software Foundation.
hannesw@2090 8 *
hannesw@2090 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@2090 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@2090 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@2090 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@2090 13 * accompanied this code).
hannesw@2090 14 *
hannesw@2090 15 * You should have received a copy of the GNU General Public License version
hannesw@2090 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@2090 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@2090 18 *
hannesw@2090 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@2090 20 * or visit www.oracle.com if you need additional information or have any
hannesw@2090 21 * questions.
hannesw@2090 22 */
hannesw@2090 23
hannesw@2090 24 /**
hannesw@2090 25 * JDK-8181191: getUint32 returning Long
hannesw@2090 26 *
hannesw@2090 27 * @test
hannesw@2090 28 * @run
hannesw@2090 29 */
hannesw@2090 30
hannesw@2090 31
hannesw@2090 32 function uint32(x) {
hannesw@2090 33 var buffer = new ArrayBuffer(16);
hannesw@2090 34 var dataview = new DataView(buffer);
hannesw@2090 35 dataview.setUint32(0, x);
hannesw@2090 36 return dataview.getUint32(0);
hannesw@2090 37 }
hannesw@2090 38
hannesw@2090 39 Assert.assertTrue(typeof uint32(0x7f) === 'number');
hannesw@2090 40 Assert.assertTrue(typeof uint32(0x80) === 'number');
hannesw@2090 41 Assert.assertTrue(typeof uint32(0xffffffff) === 'number');
hannesw@2090 42 Assert.assertTrue(typeof uint32(0x100000000) === 'number');
hannesw@2090 43
hannesw@2090 44 Assert.assertTrue(uint32(0x7f) === 0x7f);
hannesw@2090 45 Assert.assertTrue(uint32(0x80) === 0x80);
hannesw@2090 46 Assert.assertTrue(uint32(0xffffffff) === 0xffffffff);
hannesw@2090 47 Assert.assertTrue(uint32(0x100000000) === 0x0);
hannesw@2090 48
hannesw@2090 49 Assert.assertTrue(uint32(0x7f) === uint32(0x7f));
hannesw@2090 50 Assert.assertTrue(uint32(0x80) === uint32(0x80));
hannesw@2090 51 Assert.assertTrue(uint32(0xffffffff) === uint32(0xffffffff));
hannesw@2090 52 Assert.assertTrue(uint32(0x100000000) === uint32(0x100000000));

mercurial