/* 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; i1) { 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; i0) { 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; i0) { 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