Merge branch 'carl'
This commit is contained in:
commit
d6dd16bc9e
|
@ -10,13 +10,19 @@ import Database
|
||||||
import SQL
|
import SQL
|
||||||
import fpdb_import
|
import fpdb_import
|
||||||
|
|
||||||
def error_report( filename, hand, stat, ghash, testhash, player):
|
|
||||||
|
class FpdbError:
|
||||||
|
def __init__(self):
|
||||||
|
self.errorcount = 0
|
||||||
|
|
||||||
|
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
|
||||||
|
self.errorcount += 1
|
||||||
|
|
||||||
def compare(leaf, importer):
|
def compare(leaf, importer, errors):
|
||||||
filename = leaf
|
filename = leaf
|
||||||
#print "DEBUG: fileanme: %s" % filename
|
#print "DEBUG: fileanme: %s" % filename
|
||||||
|
|
||||||
|
@ -52,21 +58,21 @@ def compare(leaf, importer):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# Stats don't match - Doh!
|
# Stats don't match - Doh!
|
||||||
error_report(filename, hand, stat, ghash, testhash, p)
|
errors.error_report(filename, hand, stat, ghash, testhash, p)
|
||||||
|
|
||||||
importer.clearFileList()
|
importer.clearFileList()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def walk_testfiles(dir, function, importer):
|
def walk_testfiles(dir, function, importer, errors):
|
||||||
"""Walks a directory, and executes a callback on each file """
|
"""Walks a directory, and executes a callback on each file """
|
||||||
dir = os.path.abspath(dir)
|
dir = os.path.abspath(dir)
|
||||||
for file in [file for file in os.listdir(dir) if not file in [".",".."]]:
|
for file in [file for file in os.listdir(dir) if not file in [".",".."]]:
|
||||||
nfile = os.path.join(dir,file)
|
nfile = os.path.join(dir,file)
|
||||||
if os.path.isdir(nfile):
|
if os.path.isdir(nfile):
|
||||||
walk_testfiles(nfile, compare, importer)
|
walk_testfiles(nfile, compare, importer, errors)
|
||||||
else:
|
else:
|
||||||
compare(nfile, importer)
|
compare(nfile, importer, errors)
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
if argv is None:
|
if argv is None:
|
||||||
|
@ -87,7 +93,13 @@ def main(argv=None):
|
||||||
importer.setCallHud(False)
|
importer.setCallHud(False)
|
||||||
importer.setFakeCacheHHC(True)
|
importer.setFakeCacheHHC(True)
|
||||||
|
|
||||||
walk_testfiles("regression-test-files/cash/Stars/", compare, importer)
|
errors = FpdbError()
|
||||||
|
|
||||||
|
walk_testfiles("regression-test-files/cash/Stars/", compare, importer, errors)
|
||||||
|
|
||||||
|
print "---------------------"
|
||||||
|
print "Total Errors: %d" % errors.errorcount
|
||||||
|
print "---------------------"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user