# HG changeset patch # User Roland Schatz # Date 1392983992 -3600 # Node ID d4a17336d12185a25c2ddacaa8442ae2da7872df # Parent 79114edb513098ad566b1336d49d80fb0de96274 Unit tests for x2L conversion. diff -r 79114edb5130 -r d4a17336d121 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2b.java --- 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); + } } diff -r 79114edb5130 -r d4a17336d121 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2c.java --- 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); + } } diff -r 79114edb5130 -r d4a17336d121 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_i2s.java --- 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); + } }