diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-08-06 10:09:50 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-08-06 10:09:50 +0200 |
commit | eacd4c044f2bdec41b02e3832772c65327e5be57 (patch) | |
tree | 16cbb768b4234b07083252d306b0b719793ca939 | |
parent | d85f513934bb5735a2c0c343fbe7dc2b9c11af3e (diff) |
Improve test failure output
Change-Id: I4417318988ef70639cbcec9d776c783ad69c3990
-rw-r--r-- | test/source/diff/diff.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx index 004a0e594944..80b67040d046 100644 --- a/test/source/diff/diff.cxx +++ b/test/source/diff/diff.cxx @@ -90,7 +90,7 @@ private: void cppunitAssertEqual(const xmlChar *expected, const xmlChar *found); /// Error message for cppunit that prints out when expected and found are not equal - for doubles. - void cppunitAssertEqualDouble(const xmlChar *node, double expected, double found, double delta); + void cppunitAssertEqualDouble(const xmlNodePtr node, const xmlAttrPtr attr, double expected, double found, double delta); ToleranceContainer toleranceContainer; xmlDocPtr xmlFile1; @@ -260,11 +260,13 @@ void XMLDiff::cppunitAssertEqual(const xmlChar *expected, const xmlChar *found) #endif } -void XMLDiff::cppunitAssertEqualDouble(const xmlChar *node, double expected, double found, double delta) +void XMLDiff::cppunitAssertEqualDouble(const xmlNodePtr node, const xmlAttrPtr attr, double expected, double found, double delta) { #if USE_CPPUNIT + xmlChar * path = xmlGetNodePath(node); std::stringstream stringStream; - stringStream << "Reference: " << fileName << "\n- Node: " << (const char*) node; + stringStream << "Reference: " << fileName << "\n- Node: " << (const char*) path << "\n- Attr: " << (const char*) attr->name; + xmlFree(path); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(stringStream.str(), expected, found, delta); #endif @@ -334,7 +336,7 @@ bool XMLDiff::compareAttributes(xmlNodePtr node1, xmlNodePtr node2) else { #if USE_CPPUNIT - cppunitAssertEqualDouble(attr1->name, dVal1, dVal2, 1e-08); + cppunitAssertEqualDouble(node1, attr1, dVal1, dVal2, 1e-08); #else if (dVal1 != dVal2) return false; |