< prev index next >

test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke


  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  * @test
  26  * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  27  * @library ../../../../../
  28  * @modules jdk.vm.ci/jdk.vm.ci.meta
  29  *          jdk.vm.ci/jdk.vm.ci.runtime
  30  *          java.base/jdk.internal.misc
  31  * @build jdk.vm.ci.runtime.test.TestConstantReflectionProvider
  32  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestConstantReflectionProvider
  33  */
  34 
  35 package jdk.vm.ci.runtime.test;
  36 








  37 import static org.junit.Assert.assertEquals;
  38 import static org.junit.Assert.assertFalse;
  39 import static org.junit.Assert.assertNotNull;
  40 import static org.junit.Assert.assertNull;
  41 import static org.junit.Assert.assertTrue;
  42 
  43 import java.lang.reflect.Array;
  44 import java.util.List;
  45 
  46 import jdk.vm.ci.meta.ConstantReflectionProvider;
  47 import jdk.vm.ci.meta.JavaConstant;
  48 import jdk.vm.ci.meta.JavaKind;
  49 
  50 import org.junit.Test;
  51 
  52 /**
  53  * Tests for {@link ConstantReflectionProvider}. It assumes an implementation of the interface that
  54  * actually returns non-null results for access operations that are possible, i.e., the tests will
  55  * fail for an implementation that spuriously returns null (which is allowed by the specification).
  56  */
  57 public class TestConstantReflectionProvider extends TypeUniverse {
  58 
  59     @Test
  60     public void constantEqualsTest() {
  61         for (ConstantValue c1 : constants()) {
  62             for (ConstantValue c2 : constants()) {
  63                 // test symmetry
  64                 assertEquals(constantReflection.constantEquals(c1.value, c2.value), constantReflection.constantEquals(c2.value, c1.value));
  65                 if (c1.value.getJavaKind() != JavaKind.Object && c2.value.getJavaKind() != JavaKind.Object) {
  66                     assertEquals(c1.value.equals(c2.value), constantReflection.constantEquals(c2.value, c1.value));
  67                 }
  68             }
  69         }
  70     }
  71 




  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  * @test
  26  * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  27  * @library ../../../../../
  28  * @modules jdk.vm.ci/jdk.vm.ci.meta
  29  *          jdk.vm.ci/jdk.vm.ci.runtime
  30  *          java.base/jdk.internal.misc
  31  * @build jdk.vm.ci.runtime.test.TestConstantReflectionProvider
  32  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestConstantReflectionProvider
  33  */
  34 
  35 package jdk.vm.ci.runtime.test;
  36 
  37 import jdk.vm.ci.meta.ConstantReflectionProvider;
  38 import jdk.vm.ci.meta.JavaConstant;
  39 import jdk.vm.ci.meta.JavaKind;
  40 import org.junit.Test;
  41 
  42 import java.lang.reflect.Array;
  43 import java.util.List;
  44 
  45 import static org.junit.Assert.assertEquals;
  46 import static org.junit.Assert.assertFalse;
  47 import static org.junit.Assert.assertNotNull;
  48 import static org.junit.Assert.assertNull;
  49 import static org.junit.Assert.assertTrue;
  50 









  51 /**
  52  * Tests for {@link ConstantReflectionProvider}. It assumes an implementation of the interface that
  53  * actually returns non-null results for access operations that are possible, i.e., the tests will
  54  * fail for an implementation that spuriously returns null (which is allowed by the specification).
  55  */
  56 public class TestConstantReflectionProvider extends TypeUniverse {
  57 
  58     @Test
  59     public void constantEqualsTest() {
  60         for (ConstantValue c1 : constants()) {
  61             for (ConstantValue c2 : constants()) {
  62                 // test symmetry
  63                 assertEquals(constantReflection.constantEquals(c1.value, c2.value), constantReflection.constantEquals(c2.value, c1.value));
  64                 if (c1.value.getJavaKind() != JavaKind.Object && c2.value.getJavaKind() != JavaKind.Object) {
  65                     assertEquals(c1.value.equals(c2.value), constantReflection.constantEquals(c2.value, c1.value));
  66                 }
  67             }
  68         }
  69     }
  70 


< prev index next >