001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.harmony.drlvm.tests.regression.h3954;
019:
020: import junit.framework.TestCase;
021: import org.vmmagic.unboxed.*;
022:
023: public class Test extends TestCase {
024:
025: public static void testClass() {
026: Class[] arr1 = new Class[100];
027: Class elem = arr1.getClass();
028: arr1[1] = elem;
029: Class[] arr2 = new Class[100];
030: System.arraycopy(arr1, 0, arr2, 0, 100);
031:
032: assertEquals(elem, arr2[1]);
033: }
034:
035: public static void testString() {
036: String[] arr1 = new String[100];
037: String elem = "Hello!";
038: arr1[1] = elem;
039: String[] arr2 = new String[100];
040: System.arraycopy(arr1, 0, arr2, 0, 100);
041:
042: assertEquals(elem, arr2[1]);
043: }
044:
045: public static void testObject() {
046: Object[] arr1 = new Object[100];
047: Object elem = new Object();
048: arr1[1] = elem;
049: Object[] arr2 = new Object[100];
050: System.arraycopy(arr1, 0, arr2, 0, 100);
051:
052: assertEquals(elem, arr2[1]);
053: }
054:
055: public static void testByte() {
056: byte[] arr1 = new byte[100];
057: byte elem = 1;
058: arr1[1] = elem;
059: byte[] arr2 = new byte[100];
060: System.arraycopy(arr1, 0, arr2, 0, 100);
061:
062: assertEquals(elem, arr2[1]);
063: }
064:
065: public static void testShort() {
066: short[] arr1 = new short[100];
067: short elem = 1;
068: arr1[1] = elem;
069: short[] arr2 = new short[100];
070: System.arraycopy(arr1, 0, arr2, 0, 100);
071:
072: assertEquals(elem, arr2[1]);
073: }
074:
075: public static void testChar() {
076: char[] arr1 = new char[100];
077: char elem = 1;
078: arr1[1] = elem;
079: char[] arr2 = new char[100];
080: System.arraycopy(arr1, 0, arr2, 0, 100);
081:
082: assertEquals(elem, arr2[1]);
083: }
084:
085: public static void testInt() {
086: int[] arr1 = new int[100];
087: int elem = 1;
088: arr1[1] = elem;
089: int[] arr2 = new int[100];
090: System.arraycopy(arr1, 0, arr2, 0, 100);
091:
092: assertEquals(elem, arr2[1]);
093: }
094:
095: public static void testLong() {
096: long[] arr1 = new long[100];
097: long elem = 1;
098: arr1[1] = elem;
099: long[] arr2 = new long[100];
100: System.arraycopy(arr1, 0, arr2, 0, 100);
101:
102: assertEquals(elem, arr2[1]);
103: }
104:
105: public static void testFloat() {
106: float[] arr1 = new float[100];
107: float elem = 1;
108: arr1[1] = elem;
109: float[] arr2 = new float[100];
110: System.arraycopy(arr1, 0, arr2, 0, 100);
111:
112: assertEquals(elem, arr2[1]);
113: }
114:
115: public static void testDouble() {
116: double[] arr1 = new double[100];
117: double elem = 1;
118: arr1[1] = elem;
119: double[] arr2 = new double[100];
120: System.arraycopy(arr1, 0, arr2, 0, 100);
121:
122: assertEquals(elem, arr2[1]);
123: }
124: }
|