test: testcase stolen from JorthVM
authorBernhard Urban <lewurm@gmail.com>
Fri, 27 Apr 2012 10:23:08 +0000 (12:23 +0200)
committerBernhard Urban <lewurm@gmail.com>
Fri, 27 Apr 2012 10:23:08 +0000 (12:23 +0200)
tests/ObjectCreation.java [new file with mode: 0644]

diff --git a/tests/ObjectCreation.java b/tests/ObjectCreation.java
new file mode 100644 (file)
index 0000000..c3c441c
--- /dev/null
@@ -0,0 +1,46 @@
+package tests;
+
+public class ObjectCreation {
+       public static int checkMe;
+       public static ObjectCreation obj;
+
+       public int stuff;
+
+       public static void main(String []args) {
+               CreateMe obj = new CreateMe();
+               obj.executeMe();
+               obj.objcOnly();
+               CreateMe.woot();
+               System.out.printf("result: 0x%08x\n", CreateMe.checkMe);
+       }
+
+       public ObjectCreation() {
+               this.stuff = 0x1300;
+       }
+
+       public void objcOnly() {
+               ObjectCreation.checkMe += 0x3;
+       }
+       
+       public void executeMe() {
+               ObjectCreation.checkMe = 0xdead;
+       }
+
+       public static void woot() {
+               checkMe++;
+       }
+}
+
+class CreateMe extends ObjectCreation {
+       public int var1;
+       public int var2;
+
+       public CreateMe() {
+               this.var1 = 0x11;
+               this.var2 = 0x22;
+       }
+
+       public void executeMe() {
+               ObjectCreation.checkMe = this.var1 + this.var2 + this.stuff;
+       }
+}