Signed-off-by: Tomek Grabiec <[email protected]>
---
regression/jvm/ArrayTest.java | 80 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
diff --git a/regression/jvm/ArrayTest.java b/regression/jvm/ArrayTest.java
index 8616b40..44c87d7 100644
--- a/regression/jvm/ArrayTest.java
+++ b/regression/jvm/ArrayTest.java
@@ -30,6 +30,78 @@ public class ArrayTest extends TestCase {
assertEquals(x.b2.length, 1);
}
+ private static void testIntegerElementLoadStore() {
+ int array[] = new int[2];
+
+ array[1] = 2;
+ array[0] = 1;
+
+ assertEquals(1, array[0]);
+ assertEquals(2, array[1]);
+ }
+
+ private static void testByteElementLoadStore() {
+ byte array[] = new byte[2];
+
+ array[1] = 2;
+ array[0] = 1;
+
+ assertEquals(1, array[0]);
+ assertEquals(2, array[1]);
+ }
+
+ private static void testCharElementLoadStore() {
+ char array[] = new char[2];
+
+ array[1] = 'a';
+ array[0] = 'b';
+
+ assertEquals('b', array[0]);
+ assertEquals('a', array[1]);
+ }
+
+ private static void testBooleanElementLoadStore() {
+ boolean array[] = new boolean[2];
+
+ array[1] = true;
+ array[0] = false;
+
+ assertFalse(array[0]);
+ assertTrue(array[1]);
+ }
+
+ private static void testShortElementLoadStore() {
+ short array[] = new short[2];
+
+ array[1] = 2;
+ array[0] = 1;
+
+ assertEquals(1, array[0]);
+ assertEquals(2, array[1]);
+ }
+
+ public static void testLongElementLoadStore() {
+ long array[] = new long[2];
+
+ array[1] = 2L;
+ array[0] = 1L;
+
+ assertEquals(1L, array[0]);
+ assertEquals(2L, array[1]);
+ }
+
+ private static void testReferenceElementLoadStore() {
+ Object array[] = new Object[2];
+ Object a = "a";
+ Object b = "b";
+
+ array[1] = a;
+ array[0] = b;
+
+ assertEquals(b, array[0]);
+ assertEquals(a, array[1]);
+ }
+
public static void main(String args[]) {
testEmptyStaticArrayLength();
testEmptyArrayLength();
@@ -37,6 +109,14 @@ public class ArrayTest extends TestCase {
testStaticArrayLength();
testArrayLength();
+ testIntegerElementLoadStore();
+ testBooleanElementLoadStore();
+ testCharElementLoadStore();
+ testByteElementLoadStore();
+ testShortElementLoadStore();
+ /* FIXME: testLongElementLoadStore(); */
+ testReferenceElementLoadStore();
+
exit();
}
}
--
1.6.0.6
------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel