16
|
1 #!/usr/bin/python
|
|
2 # Copyright (c) 2010 Chortos-2 <chortos@inbox.lv>
|
|
3
|
|
4 try:
|
|
5 import files as _files, problem as _problem
|
|
6 except ImportError as e:
|
|
7 import __main__
|
|
8 __main__.import_error(e)
|
|
9
|
|
10 class TestCase(object):
|
|
11 __slots__ = 'problem', 'infile', 'outfile'
|
|
12
|
|
13 def __init__(case, prob, infile, outfile):
|
|
14 case.problem = prob
|
|
15 case.infile = infile
|
|
16 case.outfile = outfile
|
|
17
|
|
18 def __call__(case):
|
|
19 os.copy()
|
|
20
|
|
21 def load_problem(prob):
|
|
22 if prob.config.usegroups:
|
|
23 pass
|
|
24 else:
|
|
25 for i in prob.config.tests:
|
|
26 s = str(i).zfill(prob.config.padwithzeroestolength)
|
|
27 prob.cache.padoutputtolength = max(prob.cache.padoutputtolength, len(s))
|
|
28 infile = _files.TestCaseFile(prob, prob.config.testcaseinname.replace('$', s))
|
|
29 if infile:
|
|
30 if prob.config.kind != _problem.BATCH:
|
|
31 yield TestCase(prob, infile, None)
|
|
32 else:
|
|
33 outfile = _files.TestCaseFile(prob, prob.config.testcaseoutname.replace('$', s))
|
|
34 if outfile:
|
|
35 yield TestCase(prob, infile, outfile) |