summaryrefslogtreecommitdiff
path: root/libjava/classpath/testsuite/java.lang/ArrayTest.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@gcc.gnu.org>2005-07-16 00:30:23 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-07-16 00:30:23 +0000
commitf911ba985aa7fe0096c386c5be385ac5825ea527 (patch)
treea0b991cf5866ae1d616639b906ac001811d74508 /libjava/classpath/testsuite/java.lang/ArrayTest.java
parent6f4434b39b261de5317dc81ddfdd94d2e1d62b11 (diff)
Initial revision
From-SVN: r102074
Diffstat (limited to 'libjava/classpath/testsuite/java.lang/ArrayTest.java')
-rw-r--r--libjava/classpath/testsuite/java.lang/ArrayTest.java100
1 files changed, 100 insertions, 0 deletions
diff --git a/libjava/classpath/testsuite/java.lang/ArrayTest.java b/libjava/classpath/testsuite/java.lang/ArrayTest.java
new file mode 100644
index 00000000000..36eaff4064f
--- /dev/null
+++ b/libjava/classpath/testsuite/java.lang/ArrayTest.java
@@ -0,0 +1,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);
+ }
+ }
+}