test/script/basic/JDK-8163945.js

Sun, 24 Jun 2018 23:15:05 +0100

author
alitvinov
date
Sun, 24 Jun 2018 23:15:05 +0100
changeset 2351
41ac91662b75
parent 1962
9e615ea961fe
permissions
-rw-r--r--

Merge

hannesw@1962 1 /*
hannesw@1962 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
hannesw@1962 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1962 4 *
hannesw@1962 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1962 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1962 7 * published by the Free Software Foundation.
hannesw@1962 8 *
hannesw@1962 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1962 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1962 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1962 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1962 13 * accompanied this code).
hannesw@1962 14 *
hannesw@1962 15 * You should have received a copy of the GNU General Public License version
hannesw@1962 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1962 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1962 18 *
hannesw@1962 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1962 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1962 21 * questions.
hannesw@1962 22 */
hannesw@1962 23
hannesw@1962 24 /**
hannesw@1962 25 * JDK-8163945: Honor Number type hint in toPrimitive on Numbers
hannesw@1962 26 *
hannesw@1962 27 * @test
hannesw@1962 28 * @run
hannesw@1962 29 */
hannesw@1962 30
hannesw@1962 31 function assertLessThan(a, b) {
hannesw@1962 32 Assert.assertTrue(a < b);
hannesw@1962 33 Assert.assertTrue(a <= b);
hannesw@1962 34 Assert.assertFalse(a >= b);
hannesw@1962 35 Assert.assertFalse(a > b);
hannesw@1962 36 }
hannesw@1962 37
hannesw@1962 38 assertLessThan(new java.lang.Long(2), new java.lang.Long(10));
hannesw@1962 39 assertLessThan(new java.lang.Long(2), 10);
hannesw@1962 40 assertLessThan(2, new java.lang.Long(10));
hannesw@1962 41
hannesw@1962 42 assertLessThan(new java.math.BigInteger(2), new java.math.BigInteger(10));
hannesw@1962 43 assertLessThan(new java.math.BigInteger(2), 10);
hannesw@1962 44 assertLessThan(2, new java.math.BigInteger(10));
hannesw@1962 45
hannesw@1962 46 assertLessThan(new java.util.concurrent.atomic.AtomicInteger(2), new java.util.concurrent.atomic.AtomicInteger(10));
hannesw@1962 47 assertLessThan(new java.util.concurrent.atomic.AtomicInteger(2), 10);
hannesw@1962 48 assertLessThan(2, new java.util.concurrent.atomic.AtomicInteger(10));

mercurial