コード例 #1
0
  /**
   * This function performs an individual formatting test after the input and output streams have
   * been created.
   *
   * @param commands the input that decides which tests to perform
   * @return a String holding the error messages for any failed tests or null if no tests are
   *     failed.
   */
  private static /*@Nullable*/ String performTest(LineNumberReader commands) {
    StringBuffer output = new StringBuffer();
    //  List invariantTestCases = new Vector();
    boolean noTestFailed = true;

    while (true) {
      // Create a new test case
      //  FormatTestCase currentCase = FormatTestCase.instantiate(commands, generateGoals);

      // if (currentCase == null)
      //  break;
      //  else {
      //  invariantTestCases.add(currentCase);
      String results = AddAndCheckTestCase.runTest(commands);
      if (results == null) break;
      if (!(results.length() == 0)) {
        //  output.print(currentCase.getDiffString());
        output.append(results);
        noTestFailed = false;
      }
    }
    if (noTestFailed) {
      return null;
    } else {
      return output.toString();
    }
  }
コード例 #2
0
  private static String generateCommands(LineNumberReader input) {
    StringBuffer output = new StringBuffer();

    while (true) {
      String commands = AddAndCheckTestCase.generateTest(input);
      if (commands == null) break;
      output.append(commands);
    }
    return output.toString();
  }