Skip to content

Commit f775c75

Browse files
author
thk123
committed
Add tests showing clone of arrays working
1 parent 9f1e528 commit f775c75

11 files changed

+119
-0
lines changed
Binary file not shown.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
public class ArrayClone {
2+
public static void cloneReferenceArray() {
3+
ArrayClone[] a = {new ArrayClone(), new ArrayClone() };
4+
ArrayClone[] clone = a.clone();
5+
6+
assert(a.length == clone.length);
7+
}
8+
9+
public static void cloneObjectArray() {
10+
Object[] a = {new Object(), new Object() };
11+
Object[] clone = a.clone();
12+
13+
assert(a.length == clone.length);
14+
}
15+
16+
public static void cloneByteArray() {
17+
byte[] a = {(byte) 1, (byte) 2};
18+
byte[] clone = a.clone();
19+
20+
assert(a.length == clone.length);
21+
}
22+
23+
public static void cloneShortArray() {
24+
short[] a = {(short) 1, (short) 2};
25+
short[] clone = a.clone();
26+
27+
assert(a.length == clone.length);
28+
}
29+
30+
public static void cloneIntArray() {
31+
int[] a = {1, 2};
32+
int[] clone = a.clone();
33+
34+
assert(a.length == clone.length);
35+
}
36+
37+
public static void cloneLongArray() {
38+
long[] a = {1L, 2L };
39+
long[] clone = a.clone();
40+
41+
assert(a.length == clone.length);
42+
}
43+
44+
public static void cloneFloatArray() {
45+
float[] a = {1.0f, 2.0f};
46+
float[] clone = a.clone();
47+
48+
assert(a.length == clone.length);
49+
}
50+
51+
public static void cloneDoubleArray() {
52+
double[] a = {1.0, 2.0};
53+
double[] clone = a.clone();
54+
55+
assert(a.length == clone.length);
56+
}
57+
58+
public static void cloneBooleanArray() {
59+
boolean[] a = {true, false};
60+
boolean[] clone = a.clone();
61+
62+
assert(a.length == clone.length);
63+
}
64+
65+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneBooleanArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneByteArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneDoubleArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneFloatArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneIntArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneLongArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneObjectArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneReferenceArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayClone.class
3+
--function ArrayClone.cloneShortArray
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$

0 commit comments

Comments
 (0)