diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-10-23 18:32:13 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-10-23 18:32:13 +0100 |
commit | 8d6ae524ed5d2fed1f9e789d6de9764d374afa43 (patch) | |
tree | 3283f899900f19ecca8540b680755f44d5d70d1c /test/412-new-array | |
parent | 46fdec13b6dcaf932aa9fb1338f32df01aa0d959 (diff) | |
download | art-8d6ae524ed5d2fed1f9e789d6de9764d374afa43.zip art-8d6ae524ed5d2fed1f9e789d6de9764d374afa43.tar.gz art-8d6ae524ed5d2fed1f9e789d6de9764d374afa43.tar.bz2 |
Fix wrong unsigned to signed conversions.
The HIntConstant node takes an int32_t, so we have to keep things signed.
Change-Id: Ib3fa50e87f99118d320cbb381f619d5be9287530
Diffstat (limited to 'test/412-new-array')
-rw-r--r-- | test/412-new-array/src/Main.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/412-new-array/src/Main.java b/test/412-new-array/src/Main.java index 3c74275..168420c 100644 --- a/test/412-new-array/src/Main.java +++ b/test/412-new-array/src/Main.java @@ -24,6 +24,8 @@ public class Main extends TestCase { public static void main(String[] args) throws Exception { $opt$TestAllocations(); $opt$TestWithInitializations(); + $opt$TestNegativeValueNewByteArray(); + $opt$TestNegativeValueNewCharArray(); testSmaliFilledNewArray(); testSmaliFillArrayData(); testSmaliVerifyError(); @@ -109,6 +111,24 @@ public class Main extends TestCase { assertEquals(obj2, i[1]); } + static void $opt$TestNegativeValueNewByteArray() { + // Use an array initializer to hint the use of filled-new-array. + byte[] a = { (byte)0xa0, (byte)0xa1, (byte)0xa2, (byte)0xa3, + (byte)0xa4, (byte)0xa5, (byte)0xa6, (byte)0xa7 }; + for (int i = 0; i < a.length; i++) { + assertEquals((byte)0xa0 + i, a[i]); + } + } + + static void $opt$TestNegativeValueNewCharArray() { + // Use an array initializer to hint the use of filled-new-array. + char[] a = { (char)0xa000, (char)0xa001, (char)0xa002, (char)0xa003, + (char)0xa004, (char)0xa005, (char)0xa006, (char)0xa007 }; + for (int i = 0; i < a.length; i++) { + assertEquals((char)0xa000 + i, a[i]); + } + } + public static void testSmaliFilledNewArray() throws Exception { Class<?> c = Class.forName("FilledNewArray"); |