コード例 #1
0
 /**
  * @return a String containing the proper add and check commands for this input lines of this
  *     test case.
  */
 public static String generateTest(LineNumberReader commands) {
   boolean endOfFile = initFields(commands, true);
   if (endOfFile) return null;
   while (true) {
     String commandLine = getNextLine(commands).trim();
     int lineNumber = commands.getLineNumber();
     if (InvariantAddAndCheckTester.isComment(commandLine)) {
       results.append(commandLine + lineSep);
     } else if (isTestTerminator(commandLine)) {
       results.append(commandLine + lineSep + lineSep);
       break;
     } else if (isAddCommand(commandLine) || isCheckCommand(commandLine)) {
       generateCheckOrAddCommand(commandLine, lineNumber);
     } else if (isCompareCommand(commandLine)) {
       // generateCompareCommand(commandLine);
     } else {
       throw new RuntimeException("unrecognized command");
     }
   }
   return results.toString();
 }
コード例 #2
0
 /**
  * @return String containing error messages for any failed cases. In the case that there are no
  *     failed cases, the empty string is returned. In the case where commands is empty (there
  *     are no more test cases and the end of the file has been reached), null is returned.
  */
 public static String runTest(LineNumberReader commands) {
   boolean endOfFile = initFields(commands, false);
   if (endOfFile) {
     return null;
   }
   while (true) {
     String commandLine = getNextRealLine(commands);
     int lineNumber = commands.getLineNumber();
     if (InvariantAddAndCheckTester.isComment(commandLine)) {
       continue;
     } else if (isTestTerminator(commandLine)) {
       break;
     } else if (isAddCommand(commandLine) || isCheckCommand(commandLine)) {
       exicuteCheckOrAddCommand(commandLine, lineNumber);
     } else if (isCompareCommand(commandLine)) {
     } else {
       throw new RuntimeException("unrecognized command");
     }
   }
   return results.toString();
 }
コード例 #3
0
 /**
  * This function is an alias for the {@link #getNextRealLine(BufferedReader) getNextRealLine}
  * method.
  */
 static String getNextRealLine(BufferedReader buffer) {
   return InvariantAddAndCheckTester.getNextRealLine(buffer);
 }