cols = line.split('|')
name = cols[0]
if cols[1] != 'KO':
- print >> sys.stderr, "Warning: outcome is %s" % cols[1]
+ print "Warning: outcome of %s is %s, skipping it" % (name, cols[1])
continue
stats['total'] += 1
expected_error = cols[2]
print "%s:" % field
for name in stats[field]:
print " %s" % name
+
+def get_stat(field):
+ global stats
+ return (stat, float(stat) / stats['total'] * 100)
+
+def format_stat(field):
+ global stats
+ if isinstance(stats[field], int):
+ stat = stats[field]
+ else:
+ stat = len(stats[field])
+ return r'%-15s & %6d & %6.1f\%% \\' % (field, stat,
+ float(stat) / stats['total'] * 100)
+
print "\n"
-print 'precise:\t%3d' % len(stats['precise'])
-print 'imprecise:\t%3d' % len(stats['imprecise'])
-print 'half-mistakes:\t%3d' % len(stats['half-mistakes'])
-print 'mistakes:\t%3d' % len(stats['mistakes'])
-print 'undetected:\t%3d' % len(stats['undetected'])
-print 'TOTAL:\t\t%3d' % stats['total'], "\n"
-
-print 'average spurious errors no: ', float(stats['spurious']['tot']) / len(stats['precise'])
-
-#for field, value in stats.iteritems():
-# if field == 'spurious':
-# value['avg'] = float(value['tot']) / stats['precise']
-# print "%s: %s" % (field, value)
+print format_stat('precise')
+print format_stat('imprecise')
+print format_stat('half-mistakes')
+print format_stat('mistakes')
+print format_stat('undetected')
+print r'\hline'
+print format_stat('total')
+print r'\\'
+print r'%-15s & %6.1f & \\' % ('spurious avg',
+ float(stats['spurious']['tot']) / len(stats['precise']))
+print r'\hline'