[llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/ArrayInstanceOf.java

Alkis Evlogimenos alkis at cs.uiuc.edu
Mon Jan 10 00:56:29 PST 2005



Changes in directory llvm-java/test/Programs/SingleSource/UnitTests:

ArrayInstanceOf.java added (r1.1)
---
Log message:

Add test for instanceof on arrays

---
Diffs of the changes:  (+60 -0)

Index: llvm-java/test/Programs/SingleSource/UnitTests/ArrayInstanceOf.java
diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/ArrayInstanceOf.java:1.1
*** /dev/null	Mon Jan 10 02:56:29 2005
--- llvm-java/test/Programs/SingleSource/UnitTests/ArrayInstanceOf.java	Mon Jan 10 02:56:19 2005
***************
*** 0 ****
--- 1,60 ----
+ public class ArrayInstanceOf
+ {
+     private static class Base
+     {
+         int foo() { return 0; }
+         int bar() { return 0; }
+     }
+ 
+     interface Interface
+     {
+         public int baz();
+     }
+ 
+     private static class Derived extends Base implements Interface
+     {
+         int foo() { return 1; }
+         public int baz() { return foo(); }
+ 
+     }
+ 
+     public static void main(String[] args) {
+         Object[] ob = new Base[10];
+         Object[] od = new Derived[10];
+         Base[] bb = new Base[10];
+         Base[] bd = new Derived[10];
+         Interface[] id = new Derived[10];
+         Derived[] dd = new Derived[10];
+ 
+         Test.println(ob instanceof Object[]);
+         Test.println(ob instanceof Base[]);
+         Test.println(ob instanceof Interface[]);
+         Test.println(ob instanceof Derived[]);
+ 
+         Test.println(od instanceof Object[]);
+         Test.println(od instanceof Base[]);
+         Test.println(od instanceof Interface[]);
+         Test.println(od instanceof Derived[]);
+ 
+         Test.println(bb instanceof Object[]);
+         Test.println(bb instanceof Base[]);
+         Test.println(bb instanceof Interface[]);
+         Test.println(bb instanceof Derived[]);
+ 
+         Test.println(bd instanceof Object[]);
+         Test.println(bd instanceof Base[]);
+         Test.println(bd instanceof Interface[]);
+         Test.println(bd instanceof Derived[]);
+ 
+         Test.println(id instanceof Object[]);
+         Test.println(id instanceof Base[]);
+         Test.println(id instanceof Interface[]);
+         Test.println(id instanceof Derived[]);
+ 
+         Test.println(dd instanceof Object[]);
+         Test.println(dd instanceof Base[]);
+         Test.println(dd instanceof Interface[]);
+         Test.println(dd instanceof Derived[]);
+ 
+     }
+ }






More information about the llvm-commits mailing list