diff 1.20/test.py @ 8:ddc9aa02007b 1.20.1

Bug fix backporting Applying the fix of fractional scores from changeset eb15a5a9b026 to 1.20.
author Oleg Oshmyan <chortos@inbox.lv>
date Sun, 14 Feb 2010 00:24:13 +0000
parents a99db3631d10
children d4fc9341664e
line wrap: on
line diff
--- 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 <chortos@inbox.lv>
+# Copyright (c) 2009, 2010 Chortos-2 <chortos@inbox.lv>
 
 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))