comparison upreckon/upreckon-vcs @ 213:ad4362bf9858 2.03 2.03.0

Created a branch for the 2.03 release
author Oleg Oshmyan <chortos@inbox.lv>
date Thu, 18 Aug 2011 22:37:22 +0300
parents 1cbe2c428942
children b40e76b8e8b2
comparison
equal deleted inserted replaced
212:1cbe2c428942 213:ad4362bf9858
5 import optparse 5 import optparse
6 6
7 from upreckon import compat 7 from upreckon import compat
8 from upreckon.compat import * 8 from upreckon.compat import *
9 9
10 parser = optparse.OptionParser(version='Upreckon 2.03.0 ($$REV$$)', epilog='Python 2.6 or newer is required.') 10 parser = optparse.OptionParser(version='Upreckon 2.03.0', epilog='Python 2.6 or newer is required.')
11 parser.add_option('-1', dest='legacy', action='store_true', default=False, help='handle configuration files in a way more compatible with test.py 1.x') 11 parser.add_option('-1', dest='legacy', action='store_true', default=False, help='handle configuration files in a way more compatible with test.py 1.x')
12 parser.add_option('-p', '--problem', dest='problems', metavar='PROBLEM', action='append', help='test only the PROBLEM (this option can be specified more than once with different problem names, all of which will be tested)') 12 parser.add_option('-p', '--problem', dest='problems', metavar='PROBLEM', action='append', help='test only the PROBLEM (this option can be specified more than once with different problem names, all of which will be tested)')
13 parser.add_option('--list-problems', action='store_true', default=False, help='just list all problem names') 13 parser.add_option('--list-problems', action='store_true', default=False, help='just list all problem names')
14 parser.add_option('-m', '--copy-io', dest='copyonly', action='store_true', default=False, help='create a copy of the input/output files of the last test case for manual testing and exit')
15 parser.add_option('-x', '--auto-exit', dest='pause', action='store_false', default=True, help='do not wait for a key to be pressed after finishing testing') 14 parser.add_option('-x', '--auto-exit', dest='pause', action='store_false', default=True, help='do not wait for a key to be pressed after finishing testing')
16 #parser.add_option('-s', '--save-io', dest='erase', action='store_false', default=True, help='do not delete the copies of input/output files after the last test case; create copies of input files and store output in files even if the solution uses standard I/O; delete the stored input/output files if the solution uses standard I/O and the -c/--cleanup option is specified')
17 parser.add_option('-s', '--save-io', dest='erase', action='store_false', default=True, help='do not delete the copies of input/output files after the last test case; create copies of input files and store output in files even if the solution uses standard I/O') 15 parser.add_option('-s', '--save-io', dest='erase', action='store_false', default=True, help='do not delete the copies of input/output files after the last test case; create copies of input files and store output in files even if the solution uses standard I/O')
18 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed') 16 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed')
19 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits') 17 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits')
20 18
21 options, args = parser.parse_args() 19 options, args = parser.parse_args()
74 realscore = 0 72 realscore = 0
75 73
76 for taskname in options.problems or globalconf.problems: 74 for taskname in options.problems or globalconf.problems:
77 problem = Problem(taskname) 75 problem = Problem(taskname)
78 76
79 if ntasks and not options.copyonly: say() 77 if ntasks: say()
80 if shouldprintnames: say(taskname) 78 if shouldprintnames: say(taskname)
81 79
82 if options.copyonly: 80 real, max = problem.test()
83 problem.copytestdata()
84 else:
85 real, max = problem.test()
86 81
87 ntasks += 1 82 ntasks += 1
88 nfulltasks += real == max 83 nfulltasks += real == max
89 realscore += real 84 realscore += real
90 maxscore += max 85 maxscore += max
91
92 if options.copyonly:
93 sys.exit()
94 86
95 if ntasks != 1: 87 if ntasks != 1:
96 say() 88 say()
97 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks)) 89 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks))
98 except KeyboardInterrupt: 90 except KeyboardInterrupt: