diff 2.00/testcases.py @ 26:5bbb68833868

Output text improvements Detailed error messages are now printed in more cases and have only their first letter forced into lowercase. The description of the --update option now describes properly what it does.
author Oleg Oshmyan <chortos@inbox.lv>
date Thu, 23 Sep 2010 23:50:45 +0000
parents b500e117080e
children dc4be35d17e0
line wrap: on
line diff
--- a/2.00/testcases.py	Thu Sep 23 23:05:58 2010 +0000
+++ b/2.00/testcases.py	Thu Sep 23 23:50:45 2010 +0000
@@ -292,7 +292,6 @@
 		else:
 			case.validator = case.problem.config.tester
 	
-	# TODO
 	def validate(case, output):
 		if not case.validator:
 			# Compare the output with the reference output
@@ -317,7 +316,7 @@
 			except OSError:
 				raise CannotStartValidator(sys.exc_info()[1])
 			comment = case.process.communicate()[0].strip()
-			match = re.match(r'(?i)(ok|correct|wrong(?:(?:\s|_)*answer)?)(?:$|\s+|[.,!:]+\s*)', comment)
+			match = re.match(r'(?i)(ok|(?:correct|wrong)(?:(?:\s|_)*answer)?)(?:$|\s+|[.,!:]+\s*)', comment)
 			if match:
 				comment = comment[match.end():]
 			if not case.problem.config.maxexitcode:
@@ -374,6 +373,7 @@
 							except MemoryError:
 								# If there is not enough memory for the forked test.py,
 								# opt for silent dropping of the limit
+								# TODO: show a warning somewhere
 								case.process = Popen(case.problem.config.path, stdin=infile, stdout=outfile, stderr=devnull, universal_newlines=True, bufsize=-1)
 						except OSError:
 							raise CannotStartTestee(sys.exc_info()[1])
@@ -424,6 +424,7 @@
 				except MemoryError:
 					# If there is not enough memory for the forked test.py,
 					# opt for silent dropping of the limit
+					# TODO: show a warning somewhere
 					case.process = Popen(case.problem.config.path, stdin=devnull, stdout=devnull, stderr=STDOUT)
 			except OSError:
 				raise CannotStartTestee(sys.exc_info()[1])
@@ -480,7 +481,7 @@
 	# The basic idea is to launch the program to be tested and the grader
 	# and to pipe their standard I/O from and to each other,
 	# and then to capture the grader's exit code and use it
-	# like the exit code of a test validator is used.
+	# like the exit code of an output validator is used.
 
 
 def load_problem(prob, _types={'batch'   : BatchTestCase,