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