blob: 36eaff4064f5388235bfd970c8e1f3d39d108552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
public class ArrayTest {
public static void main (String args[])
{
BooleanArrayInit();
ByteArrayInit();
CharArrayInit();
ShortArrayInit();
IntArrayInit();
ArrayName(args);
}
public static void BooleanArrayInit()
{
try {
boolean val = true;
boolean [] x = { true };
if (x[0] == val)
passed("BooleanArrayInit() boolean[] x = {"+val+"}");
else
failed("BooleanArrayInit() boolean[] x = {"+val+"}");
} catch (Exception e) {
failed("BooleanArrayInit() "+e);
}
}
public static void ByteArrayInit()
{
try {
byte val = 42;
byte [] x = { 42 };
if (x[0] == val)
passed("ByteArrayInit() byte[] x = {"+val+"}");
else
failed("ByteArrayInit() byte[] x = {"+val+"}");
} catch (Exception e) {
failed("ByteArrayInit() "+e);
}
}
public static void CharArrayInit()
{
try {
char val = 'X';
char [] x = { 'X' };
if (x[0] == val)
passed("CharArrayInit() char[] x = {'"+val+"'}");
else
failed("CharArrayInit() char[] x = {'"+val+"'}");
} catch (Exception e) {
failed("CharArrayInit() "+e);
}
}
public static void ShortArrayInit()
{
try {
short val = 42;
short [] x = { 42 };
if (x[0] == val)
passed("ShortArrayInit() short[] x = {"+val+"}");
else
failed("ShortArrayInit() short[] x = {"+val+"}");
} catch (Exception e) {
failed("ShortArrayInit() "+e);
}
}
public static void IntArrayInit()
{
try {
int val = 42;
int [] x = { 42 };
if (x[0] == val)
passed("IntArrayInit() int[] x = {"+val+"}");
else
failed("IntArrayInit() int[] x = {"+val+"}");
} catch (Exception e) {
failed("IntArrayInit() "+e);
}
}
public static void failed(String s)
{
if (s != null)
System.out.println("FAILED: " + s);
else
System.out.println("FAILED: ");
}
public static void passed(String s)
{
if (s != null)
System.out.println("PASSED: " + s);
else
System.out.println("PASSED: ");
}
public static void ArrayName(String args[])
{
try {
String name = args.getClass().getName();
passed("ArrayName() name="+name);
} catch (Exception e) {
failed("ArrayName() "+e);
}
}
}
|