changeset 14002:d4a17336d121

Unit tests for x2L conversion.
author Roland Schatz <roland.schatz@oracle.com>
date Fri, 21 Feb 2014 12:59:52 +0100
parents 79114edb5130
children 0c38906450a0
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, 67 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2b.java	Fri Feb 21 12:58:26 2014 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2b.java	Fri Feb 21 12:59:52 2014 +0100
@@ -76,4 +76,28 @@
     public void runI3() throws Throwable {
         runTest("testInt", 128);
     }
+
+    public static long testLong(int a) {
+        return (byte) a;
+    }
+
+    @Test
+    public void runL0() throws Throwable {
+        runTest("testLong", -1);
+    }
+
+    @Test
+    public void runL1() throws Throwable {
+        runTest("testLong", 2);
+    }
+
+    @Test
+    public void runL2() throws Throwable {
+        runTest("testLong", 255);
+    }
+
+    @Test
+    public void runL3() throws Throwable {
+        runTest("testLong", 128);
+    }
 }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2c.java	Fri Feb 21 12:58:26 2014 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2c.java	Fri Feb 21 12:59:52 2014 +0100
@@ -66,4 +66,23 @@
     public void runI2() throws Throwable {
         runTest("testInt", 65535);
     }
+
+    public static long testLong(int a) {
+        return (char) a;
+    }
+
+    @Test
+    public void runL0() throws Throwable {
+        runTest("testLong", -1);
+    }
+
+    @Test
+    public void runL1() throws Throwable {
+        runTest("testLong", 645);
+    }
+
+    @Test
+    public void runL2() throws Throwable {
+        runTest("testLong", 65535);
+    }
 }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2s.java	Fri Feb 21 12:58:26 2014 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2s.java	Fri Feb 21 12:59:52 2014 +0100
@@ -76,4 +76,28 @@
     public void runI3() throws Throwable {
         runTest("testInt", 32768);
     }
+
+    public static long testLong(int a) {
+        return (short) a;
+    }
+
+    @Test
+    public void runL0() throws Throwable {
+        runTest("testLong", -1);
+    }
+
+    @Test
+    public void runL1() throws Throwable {
+        runTest("testLong", 34);
+    }
+
+    @Test
+    public void runL2() throws Throwable {
+        runTest("testLong", 65535);
+    }
+
+    @Test
+    public void runL3() throws Throwable {
+        runTest("testLong", 32768);
+    }
 }