* tests/regression/base/TestArrayClasses.java: Adapted this testcase to JUnit.
authorMichael Starzinger <michi@complang.tuwien.ac.at>
Sat, 27 Dec 2008 14:26:55 +0000 (15:26 +0100)
committerMichael Starzinger <michi@complang.tuwien.ac.at>
Sat, 27 Dec 2008 14:26:55 +0000 (15:26 +0100)
* tests/regression/base/All.java: Added above test to our base suite.
* tests/TestArrayClasses.java: Removed.
* tests/TestArrayClasses.output: Likewise.
* tests/TestBase.java: Likewise.

tests/TestArrayClasses.java [deleted file]
tests/TestArrayClasses.output [deleted file]
tests/TestBase.java [deleted file]
tests/regression/base/All.java
tests/regression/base/TestArrayClasses.java [new file with mode: 0644]

diff --git a/tests/TestArrayClasses.java b/tests/TestArrayClasses.java
deleted file mode 100644 (file)
index a3d6914..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-import java.io.Serializable;
-
-public class TestArrayClasses extends TestBase {
-  public static class Foo {
-  }
-
-  public static class FooChild extends Foo {
-  }
-  
-  public static void test_store(Object[] array,Object obj,boolean oktostore,String msg) {
-    try {
-      array[0] = obj;
-      ok(oktostore,msg);
-    }
-    catch (ArrayStoreException x) {
-      System.out.println("    ArrayStoreException");
-      ok(!oktostore,msg);
-    }
-  }
-
-  public static void test_clone() {
-    int[] ia1 = new int[100];
-    Integer[] Ia1 = new Integer[ia1.length];
-    int i;
-    
-    for (i=0; i<ia1.length; ++i) {
-      ia1[i] = i*i;
-      Ia1[i] = new Integer(ia1[i]);
-    }
-
-    int[] ia2 = (int[]) ia1.clone();
-
-    is(ia2.length,ia1.length,"cloned int array length");
-
-    boolean eq = true;
-    for (i=0; i<ia1.length; ++i) {
-      if (ia2[i] != ia1[i])
-        eq = false;
-      //      System.out.println(ia2[i]);
-    }
-    ok(eq,"cloned int array data");
-
-    Integer[] Ia2 = (Integer[]) Ia1.clone();
-    
-    is(Ia2.length,Ia1.length,"cloned Integer array length");
-    
-    eq = true;
-    for (i=0; i<ia1.length; ++i) {
-      if (Ia2[i].intValue() != ia1[i])
-        eq = false;
-      //      System.out.println(ia2[i]);
-    }
-    ok(eq,"cloned Integer array data");
-  }
-
-  public static void test_arraycopy() {
-    int len;
-    int i;
-
-    long[] la1 = new long[1024];
-    long[] la2 = (long[]) la1.clone();
-    int size = la1.length;
-    Long[] La1 = new Long[size];
-    Long[] La2 = (Long[]) La1.clone();
-    Number[] Na2 = new Number[size];
-
-    for (i=0; i<la1.length; ++i) {
-      la1[i] = i*i;
-      La1[i] = new Long(la1[i]);
-    }
-
-    i = size;
-    while (i>1) {
-      if ((i & 1) != 0)
-        System.err.println("ERROR: arracopy test only works for powers of two");
-      i >>= 1;
-    }
-    
-    // reverse array
-    len = size / 2;
-    while (len>0) {
-      for (int j=0;j<(size/2)/len;++j) {
-        //        System.err.println(len);
-        //        System.err.println(j);
-        System.arraycopy(la1,(2*j+1)*len,la2,2*j*len,len);
-        System.arraycopy(la1,2*j*len,la1,(2*j+1)*len,len);
-        System.arraycopy(la2,2*j*len,la1,2*j*len,len);
-      }
-      len /= 2;
-    }
-
-    boolean eq = true;
-    for (i=0; i<size; ++i) {
-      if (la1[i] != (size-i-1)*(size-i-1))
-        eq = false;
-      //      System.out.println(la1[i]);
-    }
-    ok(eq,"arraycopy primitive");
-    
-    // reverse array
-    len = size / 2;
-    while (len>0) {
-      for (int j=0;j<(size/2)/len;++j) {
-        //        System.err.println(len);
-        //        System.err.println(j);
-        System.arraycopy(La1,(2*j+1)*len,La2,2*j*len,len);
-        System.arraycopy(La1,2*j*len,La1,(2*j+1)*len,len);
-        System.arraycopy(La2,2*j*len,La1,2*j*len,len);
-      }
-      len /= 2;
-    }
-
-    eq = true;
-    for (i=0; i<size; ++i) {
-      if (La1[i].intValue() != (size-i-1)*(size-i-1))
-        eq = false;
-    }
-    ok(eq,"arraycopy ref");
-    
-    // reverse array
-    len = size / 2;
-    while (len>0) {
-      for (int j=0;j<(size/2)/len;++j) {
-        //        System.err.println(len);
-        //        System.err.println(j);
-        System.arraycopy(La1,(2*j+1)*len,Na2,2*j*len,len);
-        System.arraycopy(La1,2*j*len,La1,(2*j+1)*len,len);
-        System.arraycopy(Na2,2*j*len,La1,2*j*len,len);
-      }
-      len /= 2;
-    }
-
-    eq = true;
-    for (i=0; i<size; ++i) {
-      if (La1[i].intValue() != i*i)
-        eq = false;
-    }
-    ok(eq,"arraycopy ref different classes");
-
-    Integer[] Ia = new Integer[size];
-
-    try {
-      System.arraycopy(Ia,0,Na2,0,1);
-      ok(true,"arraycopy Integer to Number");
-    }
-    catch (ArrayStoreException x) {
-      System.out.println("    ArrayStoreException");
-      ok(false,"arraycopy Integer to Number");
-    }
-
-    try {
-      System.arraycopy(Na2,1,Ia,1,1);
-      ok(false,"!arraycopy Number to Integer");
-    }
-    catch (ArrayStoreException x) {
-      System.out.println("    ArrayStoreException");
-      ok(true,"!arraycopy Number to Integer");
-    }
-  }
-  
-  public static void main(String[] args) {
-    int[] ia = new int[5];
-    Object[] oa = new Object[2];
-    Object[][] oaa = new Object[1][1];
-    String[] sa = new String[3];
-    String[][] saa = new String[1][1];
-    String[][] saa2 = new String[2][];
-    String[][][] saaa = new String[1][2][3];
-    Object o = new Object();
-    java.io.Serializable[] sera = new java.io.Serializable[1];
-    Cloneable[] cloa = new Cloneable[1];
-    StringBuffer[][] sbaa = new StringBuffer[1][1];
-    Foo[] fooa = new Foo[1];
-    FooChild[] fooca = new FooChild[1];
-
-    Class[] ifs = String[].class.getInterfaces();
-    is(ifs.length,2,"String[] implements 2 interfaces");
-    ok(ifs[0] == java.lang.Cloneable.class || ifs[1] == java.lang.Cloneable.class,"String[] implements Cloneable");
-    ok(ifs[0] == java.io.Serializable.class || ifs[1] == java.io.Serializable.class,"String[] implements Serializable");
-
-    is(String[].class.getModifiers(),1041,"String[] is public final abstract");
-
-    is(oa.getClass().getName(),"[Ljava.lang.Object;","classname ref");
-    is(ia.getClass().getName(),"[I","classname primitive");
-    is(ia.length,5,"arraylength primitive");
-    is(oa.length,2,"arraylength ref");
-
-    is(saa2.length,2,"arraylength of saa2");
-    saa2[1] = new String[4];
-    is(saa2[1].length,4,"arraylength of saa2[1]");
-
-    is(saaa.length,1,"arraylength of saaa");
-    is(saaa[0].length,2,"arraylength of saaa[0]");
-    is(saaa[0][1].length,3,"arraylength of saaa[0][1]");
-
-    ok(oa.getClass().isArray(),"Object[].isArray");
-    ok(ia.getClass().isArray(),"int[].isArray");
-    ok(!o.getClass().isArray(),"!Object.isArray");
-    ok(!o.getClass().isPrimitive(),"!Object.isPrimitive");
-
-    is(oa.getClass().getComponentType().getName(),"java.lang.Object","component ref");
-    ok(!oa.getClass().getComponentType().isPrimitive(),"component ref !isPrimitive");
-    is(ia.getClass().getComponentType().getName(),"int","component primitive");
-    ok(ia.getClass().getComponentType().isPrimitive(),"component primitive isPrimitive");
-
-    ok(saa.getClass().getComponentType().equals(sa.getClass()),"component of String[][] equals String[]");
-    ok(!saa.getClass().getComponentType().equals(oa.getClass()),"component of String[][] !equals Object[]");
-
-    ok(saa[0].getClass().equals(saa.getClass().getComponentType()),"saa[0].getClass equals component of String[][]");
-
-    test_store(sa,new Object(),false,"!store Object in String[]");
-    test_store(sa,new String("test"),true,"store String in String[]");
-    test_store(oa,new Object(),true,"store Object in Object[]");
-    test_store(oa,new String("test"),true,"store String in Object[]");
-
-    test_store(oaa,sa,true,"store String[] in Object[][]");
-    test_store(saa,oa,false,"!store Object[] in String[][]");
-
-    test_store(sera,sa,true,"store String[] in java.io.Serializable[]");
-    test_store(cloa,sa,true,"store String[] in Cloneable[]");
-    
-    test_store(sbaa,sa,false,"!store String[] in StringBuffer[][]");
-
-    test_store(fooa,new Foo(),true,"store Foo in Foo[]");
-    test_store(fooa,new FooChild(),true,"store FooChild in Foo[]");
-    test_store(fooca,new Foo(),false,"!store Foo in FooChild[]");
-    test_store(fooca,new FooChild(),true,"store FooChild in FooChild[]");
-    
-    try {
-      Object[] oa2 = (Object[]) sa;
-      ok(true,"cast String[] to Object[]");
-    }
-    catch (ClassCastException x) {
-      System.out.println("    ClassCastException");
-      ok(false,"cast String[] to Object[]");
-    }
-
-    try {
-      String[] sa2 = (String[]) oa;
-      ok(false,"!cast Object[] to String[]");
-    }
-    catch (ClassCastException x) {
-      System.out.println("    ClassCastException");
-      ok(true,"!cast Object[] to String[]");
-    }
-
-    ok(sa instanceof String[],"String[] instanceof String[]");
-    ok(sa instanceof Object[],"String[] instanceof Object[]");
-    ok(!(oa instanceof String[]),"Object[] !instanceof String[]");
-    ok(oa instanceof Object[],"Object[] instanceof Object[]");
-
-    ok(oaa instanceof Object[],"Object[][] instanceof Object[]");
-    ok(saa instanceof Object[],"String[][] instanceof Object[]");
-
-    ok(sa instanceof java.io.Serializable,"String[] instanceof java.io.Serializable");
-    ok(sa instanceof java.lang.Cloneable,"String[] instanceof java.lang.Cloneable");
-    ok(sa instanceof java.lang.Object,"String[] instanceof java.lang.Object");
-    ok(saa[0] instanceof java.io.Serializable,"saa[0] instanceof java.io.Serializable");
-    ok(saa[0] instanceof java.lang.Cloneable,"saa[0] instanceof java.lang.Cloneable");
-    ok(saa[0] instanceof java.lang.Object,"saa[0] instanceof java.lang.Object");
-
-    test_clone();
-    test_arraycopy();
-  }
-}
diff --git a/tests/TestArrayClasses.output b/tests/TestArrayClasses.output
deleted file mode 100644 (file)
index f9ad359..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-ok String[] implements 2 interfaces
-ok String[] implements Cloneable
-ok String[] implements Serializable
-ok String[] is public final abstract
-ok classname ref
-ok classname primitive
-ok arraylength primitive
-ok arraylength ref
-ok arraylength of saa2
-ok arraylength of saa2[1]
-ok arraylength of saaa
-ok arraylength of saaa[0]
-ok arraylength of saaa[0][1]
-ok Object[].isArray
-ok int[].isArray
-ok !Object.isArray
-ok !Object.isPrimitive
-ok component ref
-ok component ref !isPrimitive
-ok component primitive
-ok component primitive isPrimitive
-ok component of String[][] equals String[]
-ok component of String[][] !equals Object[]
-ok saa[0].getClass equals component of String[][]
-    ArrayStoreException
-ok !store Object in String[]
-ok store String in String[]
-ok store Object in Object[]
-ok store String in Object[]
-ok store String[] in Object[][]
-    ArrayStoreException
-ok !store Object[] in String[][]
-ok store String[] in java.io.Serializable[]
-ok store String[] in Cloneable[]
-    ArrayStoreException
-ok !store String[] in StringBuffer[][]
-ok store Foo in Foo[]
-ok store FooChild in Foo[]
-    ArrayStoreException
-ok !store Foo in FooChild[]
-ok store FooChild in FooChild[]
-ok cast String[] to Object[]
-    ClassCastException
-ok !cast Object[] to String[]
-ok String[] instanceof String[]
-ok String[] instanceof Object[]
-ok Object[] !instanceof String[]
-ok Object[] instanceof Object[]
-ok Object[][] instanceof Object[]
-ok String[][] instanceof Object[]
-ok String[] instanceof java.io.Serializable
-ok String[] instanceof java.lang.Cloneable
-ok String[] instanceof java.lang.Object
-ok saa[0] instanceof java.io.Serializable
-ok saa[0] instanceof java.lang.Cloneable
-ok saa[0] instanceof java.lang.Object
-ok cloned int array length
-ok cloned int array data
-ok cloned Integer array length
-ok cloned Integer array data
-ok arraycopy primitive
-ok arraycopy ref
-ok arraycopy ref different classes
-ok arraycopy Integer to Number
-    ArrayStoreException
-ok !arraycopy Number to Integer
diff --git a/tests/TestBase.java b/tests/TestBase.java
deleted file mode 100644 (file)
index b8d134c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-public class TestBase {
-  public static boolean ok(boolean test,String msg) {
-    if (test) {
-      System.out.println("ok "+msg);
-      return true;
-    }
-    else {
-      System.out.println("NOT ok "+msg);
-      return false;
-    }
-  }
-
-  public static boolean is(String a,String b,String msg) {
-    if (ok(a.equals(b),msg)) return true;
-    System.out.println("    a='"+a+"' b='"+b+"'");
-    return false;
-  }
-
-  public static boolean is(int a,int b,String msg) {
-    return ok(a == b,msg);
-  }
-
-  public static boolean equals(Object a,Object b,String msg) {
-    return ok(a.equals(b),msg);
-  }
-}
index 9d9c8e8b7d357bd6aefac1f9eae81e003f4b575e..05085c32a46295c7023130dbc42d6f5a28c050fb 100644 (file)
@@ -29,6 +29,7 @@ import org.junit.runners.Suite;
 @RunWith(Suite.class)
 
 @Suite.SuiteClasses({
+TestArrayClasses.class,
 TestExceptionInStaticClassInitializer.class,
 TestPatcher.class
 })
diff --git a/tests/regression/base/TestArrayClasses.java b/tests/regression/base/TestArrayClasses.java
new file mode 100644 (file)
index 0000000..db56f1d
--- /dev/null
@@ -0,0 +1,288 @@
+/* tests/regression/base/TestArrayClasses.java
+
+   Copyright (C) 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import java.io.Serializable;
+
+public class TestArrayClasses {
+  public static class Foo {
+  }
+
+  public static class FooChild extends Foo {
+  }
+  
+  private void doStore(Object[] array, Object obj, boolean oktostore, String msg) {
+    try {
+      array[0] = obj;
+      assertTrue(msg, oktostore);
+    }
+    catch (ArrayStoreException x) {
+      assertFalse(msg, oktostore);
+    }
+  }
+
+  @Test
+  public void testClone() {
+    int[] ia1 = new int[100];
+    Integer[] Ia1 = new Integer[ia1.length];
+    int i;
+    
+    for (i=0; i<ia1.length; ++i) {
+      ia1[i] = i*i;
+      Ia1[i] = new Integer(ia1[i]);
+    }
+
+    int[] ia2 = (int[]) ia1.clone();
+
+    assertEquals("cloned int array length", ia1.length, ia2.length);
+
+    boolean eq = true;
+    for (i=0; i<ia1.length; ++i) {
+      if (ia2[i] != ia1[i])
+        eq = false;
+      //      System.out.println(ia2[i]);
+    }
+    assertTrue("cloned int array data", eq);
+
+    Integer[] Ia2 = (Integer[]) Ia1.clone();
+    
+    assertEquals("cloned Integer array length", Ia1.length, Ia2.length);
+    
+    eq = true;
+    for (i=0; i<ia1.length; ++i) {
+      if (Ia2[i].intValue() != ia1[i])
+        eq = false;
+      //      System.out.println(ia2[i]);
+    }
+    assertTrue("cloned Integer array data", eq);
+  }
+
+  @Test
+  public void testArraycopy() {
+    int len;
+    int i;
+
+    long[] la1 = new long[1024];
+    long[] la2 = (long[]) la1.clone();
+    int size = la1.length;
+    Long[] La1 = new Long[size];
+    Long[] La2 = (Long[]) La1.clone();
+    Number[] Na2 = new Number[size];
+
+    for (i=0; i<la1.length; ++i) {
+      la1[i] = i*i;
+      La1[i] = new Long(la1[i]);
+    }
+
+    i = size;
+    while (i>1) {
+      if ((i & 1) != 0)
+        System.err.println("ERROR: arracopy test only works for powers of two");
+      i >>= 1;
+    }
+    
+    // reverse array
+    len = size / 2;
+    while (len>0) {
+      for (int j=0;j<(size/2)/len;++j) {
+        //        System.err.println(len);
+        //        System.err.println(j);
+        System.arraycopy(la1,(2*j+1)*len,la2,2*j*len,len);
+        System.arraycopy(la1,2*j*len,la1,(2*j+1)*len,len);
+        System.arraycopy(la2,2*j*len,la1,2*j*len,len);
+      }
+      len /= 2;
+    }
+
+    boolean eq = true;
+    for (i=0; i<size; ++i) {
+      if (la1[i] != (size-i-1)*(size-i-1))
+        eq = false;
+      //      System.out.println(la1[i]);
+    }
+    assertTrue("arraycopy primitive", eq);
+    
+    // reverse array
+    len = size / 2;
+    while (len>0) {
+      for (int j=0;j<(size/2)/len;++j) {
+        //        System.err.println(len);
+        //        System.err.println(j);
+        System.arraycopy(La1,(2*j+1)*len,La2,2*j*len,len);
+        System.arraycopy(La1,2*j*len,La1,(2*j+1)*len,len);
+        System.arraycopy(La2,2*j*len,La1,2*j*len,len);
+      }
+      len /= 2;
+    }
+
+    eq = true;
+    for (i=0; i<size; ++i) {
+      if (La1[i].intValue() != (size-i-1)*(size-i-1))
+        eq = false;
+    }
+    assertTrue("arraycopy ref", eq);
+    
+    // reverse array
+    len = size / 2;
+    while (len>0) {
+      for (int j=0;j<(size/2)/len;++j) {
+        //        System.err.println(len);
+        //        System.err.println(j);
+        System.arraycopy(La1,(2*j+1)*len,Na2,2*j*len,len);
+        System.arraycopy(La1,2*j*len,La1,(2*j+1)*len,len);
+        System.arraycopy(Na2,2*j*len,La1,2*j*len,len);
+      }
+      len /= 2;
+    }
+
+    eq = true;
+    for (i=0; i<size; ++i) {
+      if (La1[i].intValue() != i*i)
+        eq = false;
+    }
+    assertTrue("arraycopy ref different classes", eq);
+
+    Integer[] Ia = new Integer[size];
+
+    try {
+      System.arraycopy(Ia,0,Na2,0,1);
+      assertTrue("arraycopy Integer to Number", true);
+    }
+    catch (ArrayStoreException x) {
+      fail("arraycopy Integer to Number");
+    }
+
+    try {
+      System.arraycopy(Na2,1,Ia,1,1);
+      fail("!arraycopy Number to Integer");
+    }
+    catch (ArrayStoreException x) {
+      assertTrue("!arraycopy Number to Integer", true);
+    }
+  }
+
+  @Test
+  public void testMain() {
+    int[] ia = new int[5];
+    Object[] oa = new Object[2];
+    Object[][] oaa = new Object[1][1];
+    String[] sa = new String[3];
+    String[][] saa = new String[1][1];
+    String[][] saa2 = new String[2][];
+    String[][][] saaa = new String[1][2][3];
+    Object o = new Object();
+    java.io.Serializable[] sera = new java.io.Serializable[1];
+    Cloneable[] cloa = new Cloneable[1];
+    StringBuffer[][] sbaa = new StringBuffer[1][1];
+    Foo[] fooa = new Foo[1];
+    FooChild[] fooca = new FooChild[1];
+
+    Class[] ifs = String[].class.getInterfaces();
+    assertEquals("String[] implements 2 interfaces", 2, ifs.length);
+    assertTrue("String[] implements Cloneable", ifs[0] == java.lang.Cloneable.class || ifs[1] == java.lang.Cloneable.class);
+    assertTrue("String[] implements Serializable", ifs[0] == java.io.Serializable.class || ifs[1] == java.io.Serializable.class);
+
+    assertEquals("String[] is public final abstract", 1041, String[].class.getModifiers());
+
+    assertEquals("classname ref", "[Ljava.lang.Object;", oa.getClass().getName());
+    assertEquals("classname primitive", "[I", ia.getClass().getName());
+    assertEquals("arraylength primitive", 5, ia.length);
+    assertEquals("arraylength ref", 2, oa.length);
+
+    assertEquals("arraylength of saa2", 2, saa2.length);
+    saa2[1] = new String[4];
+    assertEquals("arraylength of saa2[1]", 4, saa2[1].length);
+
+    assertEquals("arraylength of saaa", 1, saaa.length);
+    assertEquals("arraylength of saaa[0]", 2, saaa[0].length);
+    assertEquals("arraylength of saaa[0][1]", 3, saaa[0][1].length);
+
+    assertTrue("Object[].isArray", oa.getClass().isArray());
+    assertTrue("int[].isArray", ia.getClass().isArray());
+    assertFalse("!Object.isArray", o.getClass().isArray());
+    assertFalse("!Object.isPrimitive", o.getClass().isPrimitive());
+
+    assertEquals("component ref", "java.lang.Object", oa.getClass().getComponentType().getName());
+    assertFalse("component ref !isPrimitive", oa.getClass().getComponentType().isPrimitive());
+    assertEquals("component primitive", "int", ia.getClass().getComponentType().getName());
+    assertTrue("component primitive isPrimitive", ia.getClass().getComponentType().isPrimitive());
+
+    assertTrue("component of String[][] equals String[]", saa.getClass().getComponentType().equals(sa.getClass()));
+    assertFalse("component of String[][] !equals Object[]", saa.getClass().getComponentType().equals(oa.getClass()));
+
+    assertTrue("saa[0].getClass equals component of String[][]", saa[0].getClass().equals(saa.getClass().getComponentType()));
+
+    doStore(sa, new Object(), false, "!store Object in String[]");
+    doStore(sa, new String("test"), true, "store String in String[]");
+    doStore(oa, new Object(), true, "store Object in Object[]");
+    doStore(oa, new String("test"), true, "store String in Object[]");
+
+    doStore(oaa, sa, true, "store String[] in Object[][]");
+    doStore(saa, oa, false, "!store Object[] in String[][]");
+
+    doStore(sera, sa, true, "store String[] in java.io.Serializable[]");
+    doStore(cloa, sa, true, "store String[] in Cloneable[]");
+    
+    doStore(sbaa, sa, false, "!store String[] in StringBuffer[][]");
+
+    doStore(fooa, new Foo(), true, "store Foo in Foo[]");
+    doStore(fooa, new FooChild(), true, "store FooChild in Foo[]");
+    doStore(fooca, new Foo(), false, "!store Foo in FooChild[]");
+    doStore(fooca, new FooChild(), true, "store FooChild in FooChild[]");
+    
+    try {
+      Object[] oa2 = (Object[]) sa;
+      assertTrue("cast String[] to Object[]", true);
+    }
+    catch (ClassCastException x) {
+      fail("cast String[] to Object[]");
+    }
+
+    try {
+      String[] sa2 = (String[]) oa;
+      fail("!cast Object[] to String[]");
+    }
+    catch (ClassCastException x) {
+      assertTrue("!cast Object[] to String[]", true);
+    }
+
+    assertTrue("String[] instanceof String[]", sa instanceof String[]);
+    assertTrue("String[] instanceof Object[]", sa instanceof Object[]);
+    assertFalse("Object[] !instanceof String[]", oa instanceof String[]);
+    assertTrue("Object[] instanceof Object[]", oa instanceof Object[]);
+
+    assertTrue("Object[][] instanceof Object[]", oaa instanceof Object[]);
+    assertTrue("String[][] instanceof Object[]", saa instanceof Object[]);
+
+    assertTrue("String[] instanceof java.io.Serializable", sa instanceof java.io.Serializable);
+    assertTrue("String[] instanceof java.lang.Cloneable", sa instanceof java.lang.Cloneable);
+    assertTrue("String[] instanceof java.lang.Object", sa instanceof java.lang.Object);
+    assertTrue("saa[0] instanceof java.io.Serializable", saa[0] instanceof java.io.Serializable);
+    assertTrue("saa[0] instanceof java.lang.Cloneable", saa[0] instanceof java.lang.Cloneable);
+    assertTrue("saa[0] instanceof java.lang.Object", saa[0] instanceof java.lang.Object);
+  }
+}