# HG changeset patch # User Oleg Oshmyan # Date 1266107053 0 # Node ID ddc9aa02007bdb2b59923ee15b557570cdac8a29 # Parent a99db3631d100e17aac8dc0e411a8970a52050cc Bug fix backporting Applying the fix of fractional scores from changeset eb15a5a9b026 to 1.20. diff -r a99db3631d10 -r ddc9aa02007b 1.20/test.py --- a/1.20/test.py Sun Feb 14 00:21:10 2010 +0000 +++ b/1.20/test.py Sun Feb 14 00:24:13 2010 +0000 @@ -1,9 +1,9 @@ #! /usr/bin/python -# Copyright (c) 2009 Chortos-2 +# Copyright (c) 2009, 2010 Chortos-2 import os, sys, shutil, time, subprocess, filecmp, optparse, signal, tempfile, tarfile, zipfile -parser = optparse.OptionParser(version='test.py 1.20.0', usage='usage: %prog [options] [problem names] [[path/to/]solution-app] [test case numbers]\n\nTest case numbers can be specified in plain text or as a Python expression\nif there is only one positional argument.\n\nOnly problem names listed in testconf.py are recognized.') +parser = optparse.OptionParser(version='test.py 1.20.1', usage='usage: %prog [options] [problem names] [[path/to/]solution-app] [test case numbers]\n\nTest case numbers can be specified in plain text or as a Python expression\nif there is only one positional argument.\n\nOnly problem names listed in testconf.py are recognized.') parser.add_option('-e', '--exclude', dest='exclude', action='append', help='test case number(s) to exclude, as a Python expression; multiple -e options can be supplied') parser.add_option('-c', '--cleanup', dest='clean', action='store_true', default=False, help='delete the copies of input/output files and exit') 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') @@ -879,7 +879,7 @@ else: print 'Grand total: %d/%d tests; %g/%g points; weighted score: %g/%g' % (ncorrect, ntotal, score, maxpoints, (score*taskweight/maxpoints if not score*taskweight%maxpoints else float(score*taskweight)/maxpoints) if maxpoints else 0, taskweight) - scoresumoveralltasks += score*taskweight//maxpoints if maxpoints else 0 + scoresumoveralltasks += (score*taskweight/maxpoints if not score*taskweight%maxpoints else float(score*taskweight)/maxpoints) if maxpoints else 0 scoremaxoveralltasks += taskweight ntasks += 1 nfulltasks += int((score == maxpoints) if maxpoints else (taskweight == 0))