[llvm-commits] CVS: llvm-java/test/Programs/SingleSource/UnitTests/VirtualCall.java
Alkis Evlogimenos
alkis at cs.uiuc.edu
Wed Mar 2 01:49:13 PST 2005
Changes in directory llvm-java/test/Programs/SingleSource/UnitTests:
VirtualCall.java updated: 1.2 -> 1.3
---
Log message:
Make this test a bit more interesting.
---
Diffs of the changes: (+29 -20)
VirtualCall.java | 49 +++++++++++++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 20 deletions(-)
Index: llvm-java/test/Programs/SingleSource/UnitTests/VirtualCall.java
diff -u llvm-java/test/Programs/SingleSource/UnitTests/VirtualCall.java:1.2 llvm-java/test/Programs/SingleSource/UnitTests/VirtualCall.java:1.3
--- llvm-java/test/Programs/SingleSource/UnitTests/VirtualCall.java:1.2 Sat Dec 11 17:31:49 2004
+++ llvm-java/test/Programs/SingleSource/UnitTests/VirtualCall.java Wed Mar 2 03:49:02 2005
@@ -1,28 +1,37 @@
-class VirtualCallBase
+public class VirtualCall
{
- public int foo() { return 1; }
- public int bar() { return 2; }
-}
+ static class A
+ {
+ public void m1() { Test.println(1); m2(); m3(); }
+ public void m2() { Test.println(2); m3(); }
+ public void m3() { Test.println(3); }
+ }
-class VirtualCallDerived extends VirtualCallBase
-{
- public int foo() { return 100; }
- public int bar() { return super.bar() + super.foo(); }
-}
+ static class B extends A
+ {
+ public void m2() { Test.println(22); }
+ public void m3() { Test.println(33); }
+ }
+
+ static class C extends B
+ {
+ public void m2() { Test.println(222); m3(); }
+ }
-public class VirtualCall
-{
public static void main(String[] args) {
- VirtualCallBase a = new VirtualCallBase();
- Test.println(a.foo());
- Test.println(a.bar());
+ A a = new A();
+ a.m1();
+ a.m2();
+ a.m3();
- a = new VirtualCallDerived();
- Test.println(a.foo());
- Test.println(a.bar());
+ a = new B();
+ a.m1();
+ a.m2();
+ a.m3();
- VirtualCallDerived b = new VirtualCallDerived();
- Test.println(b.foo());
- Test.println(b.bar());
+ a = new C();
+ a.m1();
+ a.m2();
+ a.m3();
}
}
More information about the llvm-commits
mailing list