Commit dd9d5b98 authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[fuzzycompare]

changed fuzzycompare script, so that now that _maximum_ difference in 
_every_ field is printed

reviewed by gruenich



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14415 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 82fb954a
...@@ -24,7 +24,7 @@ def isFuzzyEqualNode(node1, node2, absolute, relative): ...@@ -24,7 +24,7 @@ def isFuzzyEqualNode(node1, node2, absolute, relative):
return False return False
if node1child.nodeType == node1child.TEXT_NODE and not isFuzzyEqualText(node1child.data, node2child.data, absolute, relative): if node1child.nodeType == node1child.TEXT_NODE and not isFuzzyEqualText(node1child.data, node2child.data, absolute, relative):
print 'Data differs in parameter ', node2.attributes.items(), ' at node ', node2child.nodeType print 'Data differs in parameter ', node2.attributes.items(), ' at node ', node2child.nodeType
return False continue
if node1child.nodeType == node1child.ELEMENT_NODE and not isFuzzyEqualNode(node1child, node2child, absolute, relative): if node1child.nodeType == node1child.ELEMENT_NODE and not isFuzzyEqualNode(node1child, node2child, absolute, relative):
return False return False
return True return True
...@@ -37,12 +37,18 @@ def isFuzzyEqualText(text1, text2, absolute, relative): ...@@ -37,12 +37,18 @@ def isFuzzyEqualText(text1, text2, absolute, relative):
if (list1 == list2): if (list1 == list2):
return True return True
# compare number by number # compare number by number
maximum1 = 0.0
maximum2 = 0.0
for number1, number2 in zip(list1, list2): for number1, number2 in zip(list1, list2):
number1 = float(number1) number1 = float(number1)
number2 = float(number2) number2 = float(number2)
if (abs(number1 - number2) > absolute if (abs(number1 - number2) > absolute
and (number2 == 0.0 or abs(abs(number1 / number2) - 1.0) > relative)): and (number2 == 0.0 or abs(abs(number1 / number2) - 1.0) > relative)):
print 'Difference is too large between', number1, ' and ', number2 if (abs(number1 - number2) > abs(maximum1 - maximum2)):
maximum1 = float(number1)
maximum2 = float(number2)
if (abs(maximum1 - maximum2) > 0.0):
print 'Difference is too large between', maximum1, ' and ', maximum2
return False return False
return True return True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment