Path: blob/master/test/jdk/java/io/Serializable/oldTests/ArrayTest.java
41153 views
/*1* Copyright (c) 2005, 2019, 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 {24private static final long serialVersionUID = 1L;2526byte b[] = { 0, 1};27short s[] = { 0, 1, 2};28char c[] = { 'Z', 'Y', 'X'};29int i[] = { 0, 1, 2, 3, 4};30long l[] = { 0, 1, 2, 3, 4, 5};31boolean z[] = new boolean[4];32float f[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f};33double d[] = { 1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d};34String string[] = { "ABC", "DEF", "GHI", "JKL"};35PrimitivesTest prim[] = { new PrimitivesTest(), new PrimitivesTest() } ;3637transient int ti[] = {99, 98, 97, 96};38ArrayTest self = this;3940static int si[] = {9, 8, 7, 6, 4} ;4142public ArrayTest() {43z[0] = true;44z[1] = false;45z[2] = true;46z[3] = false;47}4849public boolean equals(ArrayTest other) {50boolean ret = true;51if (other == null) {52System.err.println("\nother Array is " + other);53return false;54}55if (!ArrayOpsTest.verify(i, other.i)) {56System.err.println("\nUnpickling of int array failed");57ret = false;58}59if (!ArrayOpsTest.verify(b, other.b)) {60System.err.println("\nUnpickling of byte array failed");61ret = false;62}63if (!ArrayOpsTest.verify(s, other.s)) {64System.err.println("\nUnpickling of short array failed");65ret = false;66}67if (!ArrayOpsTest.verify(c, other.c)) {68System.err.println("\nUnpickling of char array failed");69ret = false;70}71if (!ArrayOpsTest.verify(l, other.l)) {72System.err.println("\nUnpickling of long array failed");73ret = false;74}75if (!ArrayOpsTest.verify(f, other.f)) {76System.err.println("\nUnpickling of float array failed");77ret = false;78}79if (!ArrayOpsTest.verify(d, other.d)) {80System.err.println("\nUnpickling of double array failed");81ret = false;82}83if (!ArrayOpsTest.verify(z, other.z)) {84System.err.println("\nUnpickling of boolean array failed");85ret = false;86}87if (!ArrayOpsTest.verify(string, other.string)) {88System.err.println("\nUnpickling of String array failed");89ret = false;90}91if (!ArrayOpsTest.verify(prim, other.prim)) {92System.err.println("\nUnpickling of Primitives array failed");93ret = false;94}95return ret;96}97}9899100