X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fmisc%2FRegressionTests.java;h=677f7dda6e66692726a6cd9bcb0c509f5cf46001;hb=a8478f5ddfbfbc8d910d09f27163cbd55752d3b6;hp=d870ae2e7763627f7e461774eb7421d6303b3cb0;hpb=2ca60a30895e90a0458361974402cee001498784;p=sbp.git diff --git a/src/edu/berkeley/sbp/misc/RegressionTests.java b/src/edu/berkeley/sbp/misc/RegressionTests.java index d870ae2..677f7dd 100644 --- a/src/edu/berkeley/sbp/misc/RegressionTests.java +++ b/src/edu/berkeley/sbp/misc/RegressionTests.java @@ -1,3 +1,5 @@ +// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license + package edu.berkeley.sbp.misc; import java.io.*; import java.util.*; @@ -15,6 +17,10 @@ public class RegressionTests { public static boolean yes = false; public static boolean graph = false; + public static void main() throws Exception { + main(new String[] { "tests/meta.g", "tests/testcase.g", "tests/regression.tc" }); + } + public static void main(String[] s) throws Exception { try { boolean profile = false; @@ -154,7 +160,10 @@ public class RegressionTests { p.close(); System.out.println(parser); } - Collection> results = res==null ? new HashSet>() : res.expand(false); + + HashSet> results = new HashSet>(); + if (res != null) res.expand(results); + System.out.print("\r"); if (results == null || (results.size() == 0 && (output!=null && output.length > 0))) { System.out.print("\033[31m"); @@ -199,13 +208,13 @@ public class RegressionTests { else if ("input".equals(tree.head())) return string(tree.children()); else if ("testcase".equals(tree.head())) { String input = string(tree.child(0)); - String[] output = tree.numChildren()>2 ? ((String[])walk(tree, 1)) : new String[0]; - Union grammar = Grammar.create(tree.child(tree.numChildren()-1), "s", new MetaGrammarBindings()); + String[] output = tree.size()>2 ? ((String[])walk(tree, 1)) : new String[0]; + Union grammar = Grammar.create(tree.child(tree.size()-1), "s", new MetaGrammarBindings()); TestCase tc = new TestCase(input, output, grammar, false, false); return tc; } else if ("ts".equals(tree.head())) return walk(tree, 0); else if (tree.head() == null) { - Object[] ret = new Object[tree.numChildren()]; + Object[] ret = new Object[tree.size()]; for(int i=0; i