tests: more helpful assertion failures from check_nodes
Tests would fail as: Test name: AutomationListPropertyTest::basicTest equality assertion failed - Expected: 4 - Actual : 5 It is slightly more informative when the size assertion is the last check and it fails as: - Expected: state - Actual : time-domain The performance benefits from checking size first is not relevant.
This commit is contained in:
parent
58cc2aed87
commit
9f69b8ccd9
@ -49,11 +49,10 @@ check_nodes (XMLNode const * p, XMLNode const * q, list<string> const & ignore_p
|
||||
|
||||
XMLPropertyList const & pp = p->properties ();
|
||||
XMLPropertyList const & qp = q->properties ();
|
||||
CPPUNIT_ASSERT_EQUAL (qp.size(), pp.size());
|
||||
|
||||
XMLPropertyList::const_iterator i = pp.begin ();
|
||||
XMLPropertyList::const_iterator j = qp.begin ();
|
||||
while (i != pp.end ()) {
|
||||
while (i != pp.end () && j != qp.end ()) {
|
||||
CPPUNIT_ASSERT_EQUAL ((*j)->name(), (*i)->name());
|
||||
if (find (ignore_properties.begin(), ignore_properties.end(), (*i)->name ()) == ignore_properties.end ()) {
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE ((*j)->name(), (*i)->value(), (*i)->value());
|
||||
@ -62,18 +61,21 @@ check_nodes (XMLNode const * p, XMLNode const * q, list<string> const & ignore_p
|
||||
++j;
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL (qp.size(), pp.size());
|
||||
|
||||
XMLNodeList const & pc = p->children ();
|
||||
XMLNodeList const & qc = q->children ();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL (qc.size(), pc.size());
|
||||
XMLNodeList::const_iterator k = pc.begin ();
|
||||
XMLNodeList::const_iterator l = qc.begin ();
|
||||
|
||||
while (k != pc.end ()) {
|
||||
while (k != pc.end () && l != qc.end ()) {
|
||||
check_nodes (*k, *l, ignore_properties);
|
||||
++k;
|
||||
++l;
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL (qc.size(), pc.size());
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user