[Libreoffice-commits] core.git: test/source

Stephan Bergmann sbergman at redhat.com
Wed Aug 6 01:10:24 PDT 2014


 test/source/diff/diff.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit eacd4c044f2bdec41b02e3832772c65327e5be57
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 6 10:09:50 2014 +0200

    Improve test failure output
    
    Change-Id: I4417318988ef70639cbcec9d776c783ad69c3990

diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx
index 004a0e5..80b6704 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;


More information about the Libreoffice-commits mailing list