コード例 #1
0
  private static void writeCommandFile() {
    LineNumberReader inputReader = getInputReader();

    String output = generateCommands(inputReader);
    FileWriter commandOutput = getCommandWriter();
    try {
      commandOutput.write(output, 0, output.length());
      commandOutput.close();
    } catch (IOException e) {
      throw new RuntimeException("Could not output generated commands");
    }
    System.out.println("Goals generated");
  }
コード例 #2
0
  /**
   * This function performs the testing for a particular format indicated by the format string. It
   * subsequently sets up appropriate input and output streams for the format test, performs the
   * test, and the compares the test results to the goals. If the goals differ from the actual
   * results the test fails.
   *
   * @return false if any tests fail.
   */
  private static boolean execute() {
    LineNumberReader commandReader = getCommands();
    String output = performTest(commandReader);

    if (output == null) { // no errors
      return true;
    } else {
      FileWriter diffsOutput = getDiffsOutputWriter();
      try {
        diffsOutput.write(output, 0, output.length());
        diffsOutput.close();
      } catch (IOException e) {
        throw new RuntimeException("Could not output generated diffs");
      }
      return false;
    }
  }