unrolling forests without recursion
[sbp.git] / src / edu / berkeley / sbp / misc / RegressionTests.java
index 196382c..6501727 100644 (file)
@@ -62,7 +62,22 @@ public class RegressionTests {
 
             TestCase[] expanded = (TestCase[])new TestCaseBuilder().walk(r2.expand1());
             System.err.println("executing...");
 
             TestCase[] expanded = (TestCase[])new TestCaseBuilder().walk(r2.expand1());
             System.err.println("executing...");
-            for(TestCase tc : expanded) tc.execute();
+            for(TestCase tc : expanded) {
+                tc.execute();
+                /*
+                String st = "a";
+                for(int i=0; i<12; i++) {
+                    //System.out.println("length " + st.length());
+                    tc.input = st;
+                    long nowy = System.currentTimeMillis();
+                    GSS.shifts = 0;
+                    GSS.reductions = 0;
+                    tc.execute();
+                    System.out.println("length " + st.length() + " => " + ((System.currentTimeMillis()-nowy)/1000.0) + " " + GSS.shifts + " " + GSS.reductions);
+                    st = st+st;
+                }
+                */
+            }
 
         } catch (Throwable t) {
             System.err.println("\n\nexception thrown, class == " + t.getClass().getName());
 
         } catch (Throwable t) {
             System.err.println("\n\nexception thrown, class == " + t.getClass().getName());
@@ -76,7 +91,7 @@ public class RegressionTests {
     public static class TestCase {
         private final boolean tib;
         private final boolean jav;
     public static class TestCase {
         private final boolean tib;
         private final boolean jav;
-        public final String input;        
+        public /*final*/ String input;        
         public final String[] output;
         public final Union grammar;
         public TestCase(String input, String[] output, Union grammar, boolean tib, boolean jav) throws IOException {
         public final String[] output;
         public final Union grammar;
         public TestCase(String input, String[] output, Union grammar, boolean tib, boolean jav) throws IOException {
@@ -105,6 +120,7 @@ public class RegressionTests {
                 pfe = pf;
             }
             //ystem.out.println("res=="+res);
                 pfe = pf;
             }
             //ystem.out.println("res=="+res);
+
             if (graph) {
                 FileOutputStream fos = new FileOutputStream("out.dot");
                 PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
             if (graph) {
                 FileOutputStream fos = new FileOutputStream("out.dot");
                 PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
@@ -147,6 +163,7 @@ public class RegressionTests {
                 return true;
             }             
             System.out.println("\r\033[32mPASS\033[0m                                                                              ");
                 return true;
             }             
             System.out.println("\r\033[32mPASS\033[0m                                                                              ");
+
             return false;
         }
     }
             return false;
         }
     }