This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: more 1.1 front-end tests


I'm checking in this patch.  It adds a number of new 1.1 tests for the
compiler front end.  These tests are from Alex.

2000-02-07  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* libjava.lang/instinit2.out: New file.
	* libjava.lang/instinit2.java: New file.
	* libjava.lang/instinit.out: New file.
	* libjava.lang/instinit.java: New file.
	* libjava.lang/anonarray2.out: New file.
	* libjava.lang/anonarray2.java: New file.
	* libjava.lang/anonarray.out: New file.
	* libjava.lang/anonarray.java: New file.
	* libjava.lang/nested_with_ctor.out: New file.
	* libjava.lang/nested_with_ctor.java: New file.
	* libjava.lang/anfi.out: New file.
	* libjava.lang/anfi.java: New file.
	* libjava.lang/stub.out: New file.
	* libjava.lang/stub.java: New file.

Tom

Index: libjava.lang/anfi.java
===================================================================
RCS file: anfi.java
diff -N anfi.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ anfi.java	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,33 @@
+// Class anfi
+// Generated on Sat Jan 29 16:06:33 PST 2000
+// Anonymous with access to outer context locals
+
+class anfi {
+
+    itf foo (final String s, final int i) {
+        return new itf () {
+            String buff = s+" "+i;
+            public void setString (String s) { buff = s+" "+i; }
+            public String getString () { return buff; }
+        };
+    }
+
+    void test () {
+        itf x = foo ("Hello", 123);
+        System.out.println (x.getString ());
+        x.setString ("Frinkahedron");
+        System.out.println (x.getString ());
+    }
+
+    public static void main (String[] arg)
+    {
+        System.out.println ("Testing class `anfi'...");
+        new anfi().test();
+    }
+}
+
+interface itf {
+    void setString (String s);
+    String getString();
+    String buff = null;
+}
Index: libjava.lang/anfi.out
===================================================================
RCS file: anfi.out
diff -N anfi.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ anfi.out	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,3 @@
+Testing class `anfi'...
+Hello 123
+Frinkahedron 123
Index: libjava.lang/anonarray.java
===================================================================
RCS file: anonarray.java
diff -N anonarray.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ anonarray.java	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,22 @@
+// Class anonarray
+// Generated on Tue Feb  1 16:11:29 PST 2000
+// Simple anonymous array, of primitive types.
+
+class anonarray {
+
+  static void foo (int [][] x) {
+      for (int i = 0; i < x.length; i++)
+          {
+              for (int j = 0; j < x[i].length; j++)
+                  System.out.print (x[i][j]);
+              System.out.println();
+          }
+  }
+  
+  public static void main (String[] arg)
+  {  
+      foo (new int[][] {{2,3},{5,7}});
+      System.out.println ((new int [][] {{11,13},{17,19}}).length);
+      System.out.println ((new int [][] {{23,29},{31,37}})[0][1]);
+  }
+}
Index: libjava.lang/anonarray.out
===================================================================
RCS file: anonarray.out
diff -N anonarray.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ anonarray.out	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,4 @@
+23
+57
+2
+29
Index: libjava.lang/anonarray2.java
===================================================================
RCS file: anonarray2.java
diff -N anonarray2.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ anonarray2.java	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,22 @@
+// Class anonarray2
+// Generated on Tue Feb  1 21:14:06 PST 2000
+// Anonymous array, with a non primitive type.
+
+class anonarray2 {
+
+  static void foo (String [][] x) {
+      for (int i = 0; i < x.length; i++)
+          {
+              for (int j = 0; j < x[i].length; j++)
+                  System.out.print (x[i][j]);
+              System.out.println();
+          }
+  }
+
+  public static void main (String[] arg)
+  {
+      foo (new String[][] {{"2","3"},{"5","7"}});
+      System.out.println ((new String [][] {{"11","13"},{"17","19"}}).length);
+      System.out.println ((new String [][] {{"23","29"},{"31","37"}})[0][1]);
+  }
+}
Index: libjava.lang/anonarray2.out
===================================================================
RCS file: anonarray2.out
diff -N anonarray2.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ anonarray2.out	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,4 @@
+23
+57
+2
+29
Index: libjava.lang/instinit.java
===================================================================
RCS file: instinit.java
diff -N instinit.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ instinit.java	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,22 @@
+// Class instinit
+// Generated on Wed Feb  2 12:31:16 PST 2000
+// Simple instance initializer test case.
+
+class instinit extends foo {
+
+    String buffer = "No Oink! Oink!";
+
+    /* Instance initializer */
+    {
+        System.out.println ("Oinking...");
+    }
+    {
+        buffer = "Oink! Oink!";
+    }
+  
+    public static void main (String[] arg)
+    {
+        System.out.println ("Testing class `instinit'...");
+        System.out.println (new instinit ().buffer);
+    }
+}
Index: libjava.lang/instinit.out
===================================================================
RCS file: instinit.out
diff -N instinit.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ instinit.out	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,4 @@
+Testing class `instinit'...
+Plain old boring foo
+Oinking...
+Oink! Oink!
Index: libjava.lang/instinit2.java
===================================================================
RCS file: instinit2.java
diff -N instinit2.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ instinit2.java	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,31 @@
+// Class ii2
+// Generated on Wed Feb  2 17:52:49 PST 2000
+// The instance initializer throws a checked exception. This is OK
+// since the constructors declares it in its `throws' clause -- at
+// least that's what the specs are saying.
+
+class ii2 {
+
+    String buffer = "Oink Oink!";
+
+    {
+        System.out.println ("Checking the oink...");
+        if (buffer != null)
+            throw new Exception ("It just oinked");
+    }
+
+    ii2 () throws Exception
+    {
+        System.out.println ("Ctor");
+    }
+
+    public static void main (String[] arg)
+    {
+        System.out.println ("Testing class `ii2'...");
+        try {
+            System.out.println (new ii2 ().buffer);
+        } catch (Exception e) {
+            System.out.println (e.toString());
+        }
+    }
+} 
Index: libjava.lang/instinit2.out
===================================================================
RCS file: instinit2.out
diff -N instinit2.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ instinit2.out	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,4 @@
+Testing class `instinit2'...
+Ctor
+Checking the oink...
+java.lang.Exception: It just oinked
Index: libjava.lang/nested_with_ctor.java
===================================================================
RCS file: nested_with_ctor.java
diff -N nested_with_ctor.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ nested_with_ctor.java	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,27 @@
+// Class nested_with_ctor
+// Generated on Mon Jan 31 18:31:47 PST 2000
+// The nested class contains explicit constructors. Their argument
+// lists should be augmented with the alias initializer values when
+// the ctors are seen declared (as opposed to generated.)
+
+class nested_with_ctor {
+  
+  void fct(final String s, final int i)
+  {
+      class nested {
+          String buffer = s+i;
+          String getString () { return buffer; }
+          nested (int i) { buffer = "(int)"+i; }
+          nested () {}
+      }
+      nested x = new nested ();
+      System.out.println (x.getString ());
+      nested y = new nested (123);
+      System.out.println (y.getString ());
+  }
+  public static void main (String[] arg)
+  {
+    System.out.println ("Testing class `nested_with_ctor'...");
+    new nested_with_ctor ().fct ("Yikes!", 321);
+  }
+}
Index: libjava.lang/nested_with_ctor.out
===================================================================
RCS file: nested_with_ctor.out
diff -N nested_with_ctor.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ nested_with_ctor.out	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,3 @@
+Testing class `nested_with_ctor'...
+Yikes!321
+(int)123
Index: libjava.lang/stub.java
===================================================================
RCS file: stub.java
diff -N stub.java
--- /dev/null	Tue May  5 13:32:27 1998
+++ stub.java	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,101 @@
+// Class stub
+// Generated on Fri Feb  4 20:23:47 PST 2000
+// A somewhat thorough test of function invocator generated stubs.
+
+class stub {
+
+    String ok;
+
+    void OK () {System.out.println (ok);}
+    void OK (int i) {System.out.println (ok+" "+i);}
+    static void testOK () {System.out.println ("OK");}
+    static void testOK (int i) {System.out.println ("OK "+i); }
+
+    // STATIC   PRIVATE         R_VALUE         ARGS
+    // No       No              No              No
+                                void    t1      () {OK();}
+    // Yes      No              No              No
+       static                   void    t2      () {testOK();}
+    // No       Yes             No              No
+                private         void    t3      () {OK();}
+    // Yes      Yes             No              No
+       static   private         void    t4      () {testOK();}
+    // No       No              Yes             No
+                                int     t5      () {return 5;}
+    // Yes      No              Yes             No
+       static                   int     t6      () {return 6;}
+    // No       Yes             Yes             No
+                private         int     t7      () {return 7;}
+    // Yes      Yes             Yes             No
+       static   private         int     t8      () {return 8;}
+
+    // No       No              No              Yes
+                                void    t9      (int i) {OK(i);}
+    // Yes      No              No              Yes
+       static                   void    t10     (int i) {testOK(i);}
+    // No       Yes             No              Yes
+                private         void    t11     (int i) {OK(i);}
+    // Yes      Yes             No              Yes
+       static   private         void    t12     (int i) {testOK(i);}
+    // No       No              Yes             Yes
+                                int     t13     (int i) {return i*2;}
+    // Yes      No              Yes             Yes
+       static                   int     t14     (int i) {return i*3;}
+    // No       Yes             Yes             Yes
+                private         int     t15     (int i) {return i*4;}
+    // Yes      Yes             Yes             Yes
+       static   private         int     t16     (int i) {return i*5;}
+
+    void foo ()
+    {
+        this.new bar ().test ();
+    }
+    class bar {
+        void test () {
+            ok = "OK";
+            t1 ();
+            t2 ();
+            t3 ();
+            t4 ();
+            System.out.println (t5());
+            System.out.println (t6());
+            System.out.println (t7());
+            System.out.println (t8());
+            t9 (9);
+            t10 (10);
+            t11 (11);
+            t12 (12);
+            System.out.println (t13(13));
+            System.out.println (t14(14));
+            System.out.println (t15(15));
+            System.out.println (t16(16));
+            this.new baz ().test ();
+        }
+        class baz {
+            void test () {
+                ok = "OKOK";
+                t1 ();
+                t2 ();
+                t3 ();
+                t4 ();
+                System.out.println (t5());
+                System.out.println (t6());
+                System.out.println (t7());
+                System.out.println (t8());
+                t9 (9);
+                t10 (10);
+                t11 (11);
+                t12 (12);
+                System.out.println (t13(13));
+                System.out.println (t14(14));
+                System.out.println (t15(15));
+                System.out.println (t16(16));
+            }
+        }
+    }
+    public static void main (String[] arg)
+    {   
+        System.out.println ("Testing class `stub'...");
+        new stub ().foo ();
+    }
+}
Index: libjava.lang/stub.out
===================================================================
RCS file: stub.out
diff -N stub.out
--- /dev/null	Tue May  5 13:32:27 1998
+++ stub.out	Mon Feb  7 13:18:14 2000
@@ -0,0 +1,33 @@
+Testing class `stub'...
+OK
+OK
+OK
+OK
+5
+6
+7
+8
+OK 9
+OK 10
+OK 11
+OK 12
+26
+42
+60
+80
+OKOK
+OK
+OKOK
+OK
+5
+6
+7
+8
+OKOK 9
+OK 10
+OKOK 11
+OK 12
+26
+42
+60
+80

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]