# HG changeset patch # User Oleg Oshmyan # Date 1302273750 -10800 # Node ID 8f46e84922f93cafe482688ceef35bd5dad0cc5f # Parent 4e6f231f055fd100cd3630d1b84b15447ac002e5 Output-only problems are now supported diff -r 4e6f231f055f -r 8f46e84922f9 testcases.py --- 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__ = ()