THP: Make THP print a better error message
This commit is contained in:
parent
edae36d108
commit
fb9d0c85c7
|
@ -14,14 +14,24 @@ import fpdb_import
|
||||||
class FpdbError:
|
class FpdbError:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.errorcount = 0
|
self.errorcount = 0
|
||||||
|
self.histogram = {}
|
||||||
|
|
||||||
def error_report(self, filename, hand, stat, ghash, testhash, player):
|
def error_report(self, filename, hand, stat, ghash, testhash, player):
|
||||||
print "Regression Test Error:"
|
print "Regression Test Error:"
|
||||||
print "\tFile: %s" % filename
|
print "\tFile: %s" % filename
|
||||||
print "\tStat: %s" % stat
|
print "\tStat: %s" % stat
|
||||||
print "\tPlayer: %s" % player
|
print "\tPlayer: %s" % player
|
||||||
|
if filename in self.histogram:
|
||||||
|
self.histogram[filename] += 1
|
||||||
|
else:
|
||||||
|
self.histogram[filename] = 1
|
||||||
self.errorcount += 1
|
self.errorcount += 1
|
||||||
|
|
||||||
|
def print_histogram(self):
|
||||||
|
for f in self.histogram:
|
||||||
|
idx = f.find('regression')
|
||||||
|
print "(%3d) : %s" %(self.histogram[f], f[idx:])
|
||||||
|
|
||||||
def compare(leaf, importer, errors):
|
def compare(leaf, importer, errors):
|
||||||
filename = leaf
|
filename = leaf
|
||||||
#print "DEBUG: fileanme: %s" % filename
|
#print "DEBUG: fileanme: %s" % filename
|
||||||
|
@ -100,6 +110,7 @@ def main(argv=None):
|
||||||
print "---------------------"
|
print "---------------------"
|
||||||
print "Total Errors: %d" % errors.errorcount
|
print "Total Errors: %d" % errors.errorcount
|
||||||
print "---------------------"
|
print "---------------------"
|
||||||
|
errors.print_histogram()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user