[llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/InstanceOf.java
Alkis Evlogimenos
alkis at cs.uiuc.edu
Mon Sep 13 14:35:27 PDT 2004
Changes in directory llvm-java/test/Programs/SingleSource/UnitTests:
InstanceOf.java added (r1.1)
---
Log message:
Add testcase for instanceof.
---
Diffs of the changes: (+36 -0)
Index: llvm-java/test/Programs/SingleSource/UnitTests/InstanceOf.java
diff -c /dev/null llvm-java/test/Programs/SingleSource/UnitTests/InstanceOf.java:1.1
*** /dev/null Mon Sep 13 16:35:27 2004
--- llvm-java/test/Programs/SingleSource/UnitTests/InstanceOf.java Mon Sep 13 16:35:17 2004
***************
*** 0 ****
--- 1,36 ----
+ class A
+ {
+ int foo() { return 0; }
+ int bar() { return 0; }
+ }
+
+ interface I {
+ public int baz();
+ }
+
+ class B extends A implements I
+ {
+ int foo() { return 1; }
+ public int baz() { return foo(); }
+ }
+
+ public class InstanceOf
+ {
+ public static void main(String[] args) {
+ A aa = new A();
+ A ab = new B();
+ B bb = new B();
+
+ boolean aaA = aa instanceof A;
+ boolean aaB = aa instanceof B;
+ boolean aaI = aa instanceof I;
+
+ boolean abA = ab instanceof A;
+ boolean abB = ab instanceof B;
+ boolean abI = ab instanceof I;
+
+ boolean bbA = bb instanceof A;
+ boolean bbB = bb instanceof B;
+ boolean bbI = bb instanceof I;
+ }
+ }
More information about the llvm-commits
mailing list