changeset 104:8f46e84922f9

Output-only problems are now supported
author Oleg Oshmyan <chortos@inbox.lv>
date Fri, 08 Apr 2011 17:42:30 +0300
parents 4e6f231f055f
children 9f922b11c98a
files testcases.py
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/testcases.py	Fri Apr 08 17:56:54 2011 +0300
+++ b/testcases.py	Fri Apr 08 17:42:30 2011 +0300
@@ -128,6 +128,7 @@
 	             'maxmemory', 'has_called_back', 'files_to_delete',
 	             'cpu_time_limit_string', 'wall_time_limit_string',
 	             'time_limit_string')
+	needs_realinname = True
 	
 	if ABCMeta:
 		__metaclass__ = ABCMeta
@@ -149,10 +150,12 @@
 		else:
 			case.wall_time_limit_string = ''
 		if not isdummy:
-			case.realinname = case.problem.config.testcaseinname
+			if case.needs_realinname:
+				case.realinname = case.problem.config.testcaseinname
 			case.realoutname = case.problem.config.testcaseoutname
 		else:
-			case.realinname = case.problem.config.dummyinname
+			if case.needs_realinname:
+				case.realinname = case.problem.config.dummyinname
 			case.realoutname = case.problem.config.dummyoutname
 	
 	@abstractmethod
@@ -335,11 +338,23 @@
 # This is the only test case type not executing any programs to be tested
 class OutputOnlyTestCase(ValidatedTestCase):
 	__slots__ = ()
-	def cleanup(case): pass
+	needs_realinname = False
+	
+	def cleanup(case):
+		pass
+	
+	def test(case, callback):
+		case.time_stopped = case.time_started = 0
+		case.has_called_back = True
+		callback()
+		with open(case.problem.config.outname.replace('$', case.id), 'rU') as output:
+			return case.validate(output)
+
 
 class BestOutputTestCase(ValidatedTestCase):
 	__slots__ = ()
 
+
 # This is the only test case type executing two programs simultaneously
 class ReactiveTestCase(TestCase):
 	__slots__ = ()