Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/io/Serializable/oldTests/ArrayOpsTest.java
41153 views
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 ArrayOpsTest {
25
public static boolean verify(int a[], int b[]) {
26
boolean result = true;
27
28
if (a.length != b.length) {
29
System.err.println("\nInt array lengths differ: " +
30
a.length + " != " + b.length);
31
result = false;
32
}
33
34
for (int i = 0; i < a.length; i++) {
35
if (a[i] != b[i]) {
36
System.err.println("\nInt array contents differ " +
37
"at index " + i + ": " + a[i] + " != " + b[i]);
38
result = false;
39
}
40
}
41
return result;
42
}
43
44
public static boolean verify(byte a[], byte b[]) {
45
boolean result = true;
46
47
if (a.length != b.length) {
48
System.err.println("\nByte array lengths differ: " +
49
a.length + " != " + b.length);
50
result = false;
51
}
52
53
for (int i = 0; i < a.length; i++) {
54
if (a[i] != b[i]) {
55
System.err.println("\nByte array contents differ at index " +
56
i + ": " + a[i] + " != " + b[i]);
57
result = false;
58
}
59
}
60
return result;
61
}
62
63
public static boolean verify(char a[], char b[]) {
64
boolean result = true;
65
66
if (a.length != b.length) {
67
System.err.println("\nChar array lengths differ: " +
68
a.length + " != " + b.length);
69
result = false;
70
}
71
72
for (int i = 0; i < a.length; i++) {
73
if (a[i] != b[i]) {
74
System.err.println("\nChar array contents differ at index " +
75
i + ": " + a[i] + " != " + b[i]);
76
result = false;
77
}
78
}
79
return result;
80
}
81
82
public static boolean verify(short a[], short b[]) {
83
boolean result = true;
84
85
if (a.length != b.length) {
86
System.err.println("\nShort array lengths differ: " +
87
a.length + " != " + b.length);
88
result = false;
89
}
90
91
for (int i = 0; i < a.length; i++) {
92
if (a[i] != b[i]) {
93
System.err.println("\nShort array contents differ at index " +
94
i + ": " + a[i] + " != " + b[i]);
95
result = false;
96
}
97
}
98
return result;
99
}
100
101
public static boolean verify(boolean a[], boolean b[]) {
102
boolean result = true;
103
104
if (a.length != b.length) {
105
System.err.println("\nBoolean array lengths differ: " +
106
a.length + " != " + b.length);
107
result = false;
108
}
109
110
for (int i = 0; i < a.length; i++) {
111
if (a[i] != b[i]) {
112
System.err.println("\nBoolean array contents differ at index " +
113
i + ": " + a[i] + " != " + b[i]);
114
result = false;
115
}
116
}
117
return result;
118
}
119
120
public static boolean verify(float a[], float b[]) {
121
boolean result = true;
122
123
if (a.length != b.length) {
124
System.err.println("\nFloat array lengths differ: " +
125
a.length + " != " + b.length);
126
result = false;
127
}
128
129
for (int i = 0; i < a.length; i++) {
130
if (a[i] != b[i]) {
131
System.err.println("\nFloat array contents differ at index " +
132
i + ": " + a[i] + " != " + b[i]);
133
result = false;
134
}
135
}
136
return result;
137
}
138
139
public static boolean verify(double a[], double b[]) {
140
boolean result = true;
141
142
if (a.length != b.length) {
143
System.err.println("\nDouble array lengths differ: " +
144
a.length + " != " + b.length);
145
result = false;
146
}
147
148
for (int i = 0; i < a.length; i++) {
149
if (a[i] != b[i]) {
150
System.err.println("\nDouble array contents differ at index " +
151
i + ": " + a[i] + " != " + b[i]);
152
result = false;
153
}
154
}
155
return result;
156
}
157
158
public static boolean verify(long a[], long b[]) {
159
boolean result = true;
160
161
if (a.length != b.length) {
162
System.err.println("\nLong array lengths differ: " +
163
a.length + " != " + b.length);
164
result = false;
165
}
166
167
for (int i = 0; i < a.length; i++) {
168
if (a[i] != b[i]) {
169
System.err.println("\nLong array contents differ at index " +
170
i + ": " + a[i] + " != " + b[i]);
171
result = false;
172
}
173
}
174
return result;
175
}
176
177
public static boolean verify(String a[], String b[]) {
178
boolean result = true;
179
180
if (a.length != b.length) {
181
System.err.println("\nString array lengths differ: " +
182
a.length + " != " + b.length);
183
result = false;
184
}
185
186
for (int i = 0; i < a.length; i++) {
187
if (!a[i].equals(b[i])) {
188
System.err.println("\nString array contents differ at index " +
189
i + ": " + a[i] + " != " + b[i]);
190
result = false;
191
}
192
}
193
return result;
194
}
195
196
public static boolean verify(PrimitivesTest a[], PrimitivesTest b[]) {
197
boolean result = true;
198
199
if (a.length != b.length) {
200
System.err.println("\nPrimitivesTest array lengths differ: " +
201
a.length + " != " + b.length);
202
result = false;
203
}
204
205
for (int i = 0; i < a.length; i++) {
206
if (a[i] == null && b[i] == null) {
207
continue;
208
}
209
210
if (!a[i].equals(b[i])) {
211
System.err.println("\nPrimitivesTest array contents differ at " +
212
"index " + i + ": " + a[i] + " != " + b[i]);
213
result = false;
214
}
215
}
216
return result;
217
}
218
}
219
220