2016-11-08 18:57:35 +01:00
|
|
|
|
2016-11-11 18:41:43 +01:00
|
|
|
|
|
|
|
|
def isclose(value1,value2,error_tolerance=1e-2):
|
|
|
|
|
""" This is used to compare relative values.. """
|
|
|
|
|
import debug
|
|
|
|
|
relative_diff = abs(value1 - value2) / max(value1,value2)
|
|
|
|
|
check = relative_diff <= error_tolerance
|
|
|
|
|
if not check:
|
2016-11-11 19:04:09 +01:00
|
|
|
debug.info(1,"NOT CLOSE {0} {1} relative diff={2}".format(value1,value2,relative_diff))
|
2016-11-11 18:41:43 +01:00
|
|
|
else:
|
|
|
|
|
debug.info(2,"CLOSE {0} {1} relative diff={2}".format(value1,value2,relative_diff))
|
|
|
|
|
return (check)
|
|
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
def header(str, tec):
|
|
|
|
|
tst = "Running Test for:"
|
|
|
|
|
print "\n"
|
|
|
|
|
print " ______________________________________________________________________________ "
|
|
|
|
|
print "|==============================================================================|"
|
|
|
|
|
print "|=========" + tst.center(60) + "=========|"
|
|
|
|
|
print "|=========" + tec.center(60) + "=========|"
|
|
|
|
|
print "|=========" + str.center(60) + "=========|"
|
|
|
|
|
print "|==============================================================================|"
|