added debug output for tests, corrected bug reporting number of successful tests

This commit is contained in:
Martin Diehl 2012-01-31 13:10:14 +00:00
parent 9b679c3c0b
commit e87296b10a
1 changed files with 20 additions and 20 deletions

View File

@ -23,27 +23,27 @@ class Test():
if len(variants) == 0: variants = xrange(len(self.variants)) # iterate over all variants if len(variants) == 0: variants = xrange(len(self.variants)) # iterate over all variants
self.clean() self.clean()
# for variant in variants:
# try:
# self.prepare(variant)
# self.run(variant)
# self.postprocess(variant)
# if variant in update:
# self.update(variant)
# elif not self.compare(variant):
# return variant
# except:
# return variant
# return -1
for variant in variants: for variant in variants:
self.prepare(variant) try:
self.run(variant) self.prepare(variant)
self.postprocess(variant) self.run(variant)
if variant in update: self.postprocess(variant)
self.update(variant) if variant in update:
elif not self.compare(variant): self.update(variant)
elif not self.compare(variant):
return variant
except:
return variant return variant
return -1 return -1
# for variant in variants:
# self.prepare(variant)
# self.run(variant)
# self.postprocess(variant)
# if variant in update:
# self.update(variant)
# elif not self.compare(variant):
# return variant
# return -1
def clean(self): def clean(self):
@ -152,9 +152,9 @@ class Test():
print 'maximum relative error',max_err print 'maximum relative error',max_err
return max_err return max_err
def reportSuccess(self,culprit): def report_Success(self,culprit):
if culprit < 0: if culprit < 0:
print '%s passed.'%({False: 'The test', print '%s passed.'%({False: 'The test',
True: 'All %i tests'%(len(theTest.variants))}[len(theTest.variants) > 1]) True: 'All %i tests'%(len(self.variants))}[len(self.variants) > 1])
else: else:
print 'Test %i failed...'%(culprit+1) print 'Test %i failed...'%(culprit+1)