core: fix type in fill-array instruction

This commit is contained in:
Skylot
2013-09-29 19:36:56 +04:00
parent c59b65e71c
commit d60698206e
7 changed files with 79 additions and 19 deletions
@@ -4,7 +4,7 @@ public class TestArrays extends AbstractTest {
public int test1(int i) {
// fill-array-data
int[] a = new int[] { 1, 2, 3, 5 };
int[] a = new int[]{1, 2, 3, 5};
return a[i];
}
@@ -20,11 +20,27 @@ public class TestArrays extends AbstractTest {
return a.length;
}
private static Object test4(int type) {
if (type == 1) {
return new int[]{1, 2};
} else if (type == 2) {
return new float[]{1, 2};
} else if (type == 3) {
return new short[]{1, 2};
} else if (type == 4) {
return new byte[]{1, 2};
} else {
return null;
}
}
@Override
public boolean testRun() throws Exception {
assertEquals(test1(2), 3);
assertEquals(test2(2), 2);
assertEquals(test3(2), 2);
assertTrue(test4(4) instanceof byte[]);
return true;
}