Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/io/Serializable/oldTests/ArrayTest.java
38828 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223public class ArrayTest implements java.io.Serializable {24byte b[] = { 0, 1};25short s[] = { 0, 1, 2};26char c[] = { 'Z', 'Y', 'X'};27int i[] = { 0, 1, 2, 3, 4};28long l[] = { 0, 1, 2, 3, 4, 5};29boolean z[] = new boolean[4];30float f[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f};31double d[] = { 1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d};32String string[] = { "ABC", "DEF", "GHI", "JKL"};33PrimitivesTest prim[] = { new PrimitivesTest(), new PrimitivesTest() } ;3435transient int ti[] = {99, 98, 97, 96};36ArrayTest self = this;3738static int si[] = {9, 8, 7, 6, 4} ;3940public ArrayTest() {41z[0] = true;42z[1] = false;43z[2] = true;44z[3] = false;45}4647public boolean equals(ArrayTest other) {48boolean ret = true;49if (other == null) {50System.err.println("\nother Array is " + other);51return false;52}53if (!ArrayOpsTest.verify(i, other.i)) {54System.err.println("\nUnpickling of int array failed");55ret = false;56}57if (!ArrayOpsTest.verify(b, other.b)) {58System.err.println("\nUnpickling of byte array failed");59ret = false;60}61if (!ArrayOpsTest.verify(s, other.s)) {62System.err.println("\nUnpickling of short array failed");63ret = false;64}65if (!ArrayOpsTest.verify(c, other.c)) {66System.err.println("\nUnpickling of char array failed");67ret = false;68}69if (!ArrayOpsTest.verify(l, other.l)) {70System.err.println("\nUnpickling of long array failed");71ret = false;72}73if (!ArrayOpsTest.verify(f, other.f)) {74System.err.println("\nUnpickling of float array failed");75ret = false;76}77if (!ArrayOpsTest.verify(d, other.d)) {78System.err.println("\nUnpickling of double array failed");79ret = false;80}81if (!ArrayOpsTest.verify(z, other.z)) {82System.err.println("\nUnpickling of boolean array failed");83ret = false;84}85if (!ArrayOpsTest.verify(string, other.string)) {86System.err.println("\nUnpickling of String array failed");87ret = false;88}89if (!ArrayOpsTest.verify(prim, other.prim)) {90System.err.println("\nUnpickling of Primitives array failed");91ret = false;92}93return ret;94}95}969798