Bug fixed in BuildCode.
[IRC.git] / Robust / src / Tests / OptionalArgsTest / TestRuntime / TestRuntime3 / Willy.java
diff --git a/Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime3/Willy.java b/Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime3/Willy.java
new file mode 100644 (file)
index 0000000..c2db749
--- /dev/null
@@ -0,0 +1,74 @@
+//Same as the previous test but object is not optional
+//for task two. Implies multiple entering flags
+// (tricky part we spoke about, Brian and William)
+
+task Startup(StartupObject s {initialstate}){
+    
+    Test o = new Test() {A};
+    
+    taskexit(s {!initialstate});
+    
+}
+
+task ONE(Test o{A}){
+    o.decrease();
+    System.printString("Inside ONE\n");
+    int i = 100/o.getNumber();
+    taskexit(o {!A, B});
+    taskexit(o {!A, B});
+}
+
+task TWO(Test o{B}){
+ System.printString("Inside TWO\n");   
+ if(false) taskexit(o {!B, C});
+ else taskexit(o {!B, D});
+  
+}
+
+/*task THREE(Test o{B}){
+
+    taskexit(o {!B, D});
+    }*/
+
+task FOUR(Test o{C}){
+System.printString("Inside FOUR\n");
+    taskexit(o {!C, E});
+    
+    
+}
+
+task FIVE(optional Test o{D}){
+  System.printString("Inside FIVE\n");
+    taskexit(o {!D, F});
+
+}
+
+task SIX(Test o{E}){
+  System.printString("Inside SIX\n");
+    taskexit(o {!E, G, J});
+
+}
+
+task SEVEN(optional Test o{F}){
+  System.printString("Inside SEVEN\n");
+    taskexit(o {!F, G, K});
+
+}
+
+task EIGHT(optional Test o{G}){
+  System.printString("Inside EIGHT\n");
+    
+    if(false) taskexit(o {!G, H}); 
+    else taskexit(o {!G, I});
+
+}
+
+task NINE(optional Test o{H}){
+System.printString("Inside NINE\n");
+taskexit(o {!H}); 
+}
+task TEN(optional Test o{I}){
+System.printString("Inside TEN\n");
+ if(true) taskexit(o {!I,L }); 
+ else taskexit(o {!I,M });
+}