ConstantTest.java revision 12651:6ef01bd40ce2
1228072Sbapt/* 2228072Sbapt * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 3228072Sbapt * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4228072Sbapt * 5228072Sbapt * This code is free software; you can redistribute it and/or modify it 6228072Sbapt * under the terms of the GNU General Public License version 2 only, as 7228072Sbapt * published by the Free Software Foundation. 8228072Sbapt * 9228072Sbapt * This code is distributed in the hope that it will be useful, but WITHOUT 10228072Sbapt * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11228072Sbapt * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12228072Sbapt * version 2 for more details (a copy is included in the LICENSE file that 13228072Sbapt * accompanied this code). 14228072Sbapt * 15228072Sbapt * You should have received a copy of the GNU General Public License version 16228072Sbapt * 2 along with this work; if not, write to the Free Software Foundation, 17228072Sbapt * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18228072Sbapt * 19228072Sbapt * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20228072Sbapt * or visit www.oracle.com if you need additional information or have any 21228072Sbapt * questions. 22228072Sbapt */ 23228072Sbapt 24228072Sbapt/** 25228072Sbapt * @test 26228072Sbapt * @requires vm.jvmci 27228072Sbapt * @library ../../../../../ 28228072Sbapt * @modules jdk.internal.vm.ci/jdk.vm.ci.meta 29228072Sbapt * jdk.internal.vm.ci/jdk.vm.ci.runtime 30228072Sbapt * java.base/jdk.internal.misc 31228072Sbapt * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ConstantTest 32228072Sbapt */ 33228072Sbaptpackage jdk.vm.ci.runtime.test; 34228072Sbapt 35228072Sbaptimport jdk.vm.ci.meta.JavaConstant; 36228072Sbaptimport org.junit.Assert; 37228072Sbaptimport org.junit.Test; 38228072Sbapt 39228072Sbaptpublic class ConstantTest extends FieldUniverse { 40228072Sbapt 41228072Sbapt @Test 42228072Sbapt public void testNegativeZero() { 43228072Sbapt Assert.assertTrue("Constant for 0.0f must be different from -0.0f", JavaConstant.FLOAT_0 != JavaConstant.forFloat(-0.0F)); 44228072Sbapt Assert.assertTrue("Constant for 0.0d must be different from -0.0d", JavaConstant.DOUBLE_0 != JavaConstant.forDouble(-0.0d)); 45228072Sbapt } 46228072Sbapt 47228072Sbapt @Test 48228072Sbapt public void testNullIsNull() { 49228072Sbapt Assert.assertTrue(JavaConstant.NULL_POINTER.isNull()); 50228072Sbapt } 51228072Sbapt} 52228072Sbapt