Variable result table pruning is buggy, remove for now, also adding improved tests...
[IRC.git] / Robust / src / Tests / mlp / tinyTest / test.java
index 17e45e0b93c6aa12be024d9bfef37ebcf397d78a..3c779968d36df04ca5184eed5927ca6775081de9 100644 (file)
@@ -1,56 +1,68 @@
-public class Foo {
-  int f;
-  public Foo() {}
-}
-
 
 public class Test {
 
-  public static void main( String args[] ) {
-    
+  public static void main( String args[] ) {        
     int x = Integer.parseInt( args[0] );
-    int y = Integer.parseInt( args[1] );
-    //System.out.println( "root: x="+x+", y="+y );
-
-    /*
-    Foo foo = new Foo();
-    foo.f = x;
-    */
+    doSomeWork( x );
+  }
 
-    /*
-    int[] a = new int[x];
+  public static void doSomeWork( int x ) {
     for( int i = 0; i < x; ++i ) {
-      sese fill {
-       a[i] = i;
+      sese calc {
+       int sum = 0;    
+       for( int j = 0; j <= i; ++j ) {
+         sum = calculateStuff( sum, 1, 0 );
+       }       
+      }           
+      sese forceVirtualReal {
+       if( i % 3 == 0 ) {
+         sum = sum + (i % 20);
+       }
+      }      
+      if( i % 2 == 0 ) {
+       sese change {
+         for( int k = 0; k < i*2; ++k ) {
+           sum = calculateStuff( sum, k, 1 );
+         }
+         sum = sum + 1;
+       }       
+       
+       for( int l = 0; l < 3; ++l ) {
+         sum = calculateStuff( sum, 2, 2 );
+       }
+      }      
+      sese prnt {
+       mightPrint( x, i, sum );
       }
     }
-    */
+  }
 
-    int total = 0;
-    for( int i = 0; i < x; ++i ) {
-      sese sum {
-       total = total + i;
-      }
+  public static int calculateStuff( int sum, int num, int mode ) {
+    int answer = sum;
+    sese makePlaceholderStallAfter {
+      sum = sum + 1;
     }
+    sum = sum + 1;
+    if( mode == 0 ) {
+      sese mode1 {
+       answer = sum + num;
+      }
+    } else if( mode == 1 ) {
+      sese mode2 {
+       answer = sum + (num/2);
+      }
+    } else if( mode == 2 ) {
+      sese mode3 {
+       answer = sum + (num/2);
+      }
+    }    
 
-
-    //setTo3( foo );
-
-    System.out.println( "total="+total );
-
-    // just for testing root's ability to
-    // realize a single exit after all returns
-    // DOESN'T WORK!
-    //if( false ) {
-    //  return;
-    //}
+    return answer;
   }
 
-  /*
-  public static void setTo3( Foo foo ) {
-    sese func {
-      foo.f = 3;
-    }   
+  public static void mightPrint( int x, int i, int sum ) {
+    if( i == x - 1 ) {
+      System.out.println( "sum of integers 0-"+i+"("+x+") is "+sum );
+    }
   }
-  */
 }