package tester;

import edu.neu.ccs.satsolver.*;
import edu.neu.ccs.demeter.dj.*;

import java.util.Set;
import java.util.HashSet;

public class Tester {
  public static final String VERSION = "1.0 (11/9/2006)";

  public static final String HEADER =
  "tester: version: " + VERSION + ", guaraldi@ccs.neu.edu";

  public static final String SYNTAX =
  "tester: Syntax: java -cp . tester [-h|--help]\n\n" +
  "Pass the input by stdin (or use \"demeterj test\").\n\n" +
  "This allows you to write a test file and test various methods \n" +
  "in the interface.  The test file has the following grammar:\n\n" +
  "GRAMMAR HERE\n\n" +
  "Any questions, please send an email to guaraldi@ccs.neu.edu .\n";

  public static final String INPUTFILE =
  "computebiastest computetest1\n" +
  "254 : .5\n" +
  "250 : .5\n" +
  "result 1.0\n" +
  "\n" +
  "computebiastest computetest2\n" +
  "22 : .5\n" +
  "254: .5\n" +
  "result .5\n" +
  "\n" +
  "computebiastest computetest3\n" +
  "22 : 1.0\n" +
  "result .333333\n" +
  "\n";


  public static void main(String args[]) {
    System.out.println(HEADER);

    if (args.length > 0) {
      if (args[0] == "--help" || args[0] == "-h") {
        System.out.println(SYNTAX);
        System.exit(0);
      }
    }

    try {
      TestFile testfile = TestFile.parse(System.in);
      ClassGraph cg = new ClassGraph("tester", true, false);
      TestVisitor tv = new TestVisitor();

      cg.traverse(testfile, "from tester.TestFile to *", tv);
    } catch (ParseException pe) {
      System.out.println("ParseException: " + pe);
    }
  }
}