changeset 13947:1ea1566100bf

New unit tests for I2x bytecodes.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 13 Feb 2014 14:43:07 +0100
parents 28b59501c7b2
children 69928d77bc0a
files graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2b.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2c.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2s.java
diffstat 3 files changed, 64 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2b.java	Thu Feb 13 11:18:11 2014 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2b.java	Thu Feb 13 14:43:07 2014 +0100
@@ -53,4 +53,27 @@
         runTest("test", 128);
     }
 
+    public static int testInt(int a) {
+        return (byte) a;
+    }
+
+    @Test
+    public void runI0() throws Throwable {
+        runTest("testInt", -1);
+    }
+
+    @Test
+    public void runI1() throws Throwable {
+        runTest("testInt", 2);
+    }
+
+    @Test
+    public void runI2() throws Throwable {
+        runTest("testInt", 255);
+    }
+
+    @Test
+    public void runI3() throws Throwable {
+        runTest("testInt", 128);
+    }
 }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2c.java	Thu Feb 13 11:18:11 2014 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2c.java	Thu Feb 13 14:43:07 2014 +0100
@@ -48,4 +48,22 @@
         runTest("test", 65535);
     }
 
+    public static int testInt(int a) {
+        return (char) a;
+    }
+
+    @Test
+    public void runI0() throws Throwable {
+        runTest("testInt", -1);
+    }
+
+    @Test
+    public void runI1() throws Throwable {
+        runTest("testInt", 645);
+    }
+
+    @Test
+    public void runI2() throws Throwable {
+        runTest("testInt", 65535);
+    }
 }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2s.java	Thu Feb 13 11:18:11 2014 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2s.java	Thu Feb 13 14:43:07 2014 +0100
@@ -53,4 +53,27 @@
         runTest("test", 32768);
     }
 
+    public static int testInt(int a) {
+        return (short) a;
+    }
+
+    @Test
+    public void runI0() throws Throwable {
+        runTest("testInt", -1);
+    }
+
+    @Test
+    public void runI1() throws Throwable {
+        runTest("testInt", 34);
+    }
+
+    @Test
+    public void runI2() throws Throwable {
+        runTest("testInt", 65535);
+    }
+
+    @Test
+    public void runI3() throws Throwable {
+        runTest("testInt", 32768);
+    }
 }