MCPcopy Create free account
hub / github.com/MITK/MITK / ArePropertyListsEqual

Method ArePropertyListsEqual

Modules/SceneSerialization/test/mitkDataStorageCompare.cpp:332–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332bool mitk::DataStorageCompare::ArePropertyListsEqual(const mitk::DataNode &reference,
333 const mitk::DataNode &test,
334 bool verbose)
335{
336 DataNode::PropertyListKeyNames refListNames = reference.GetPropertyListNames();
337 DataNode::PropertyListKeyNames testListNames = test.GetPropertyListNames();
338 // add the empty names to treat all lists equally
339 refListNames.push_back("");
340 testListNames.push_back("");
341
342 // verify that list names are identical
343 bool error = false;
344 if (refListNames.size() != testListNames.size())
345 {
346 for (const auto &name : refListNames)
347 if (std::find(testListNames.begin(), testListNames.end(), name) == testListNames.end())
348 {
349 MITK_WARN << "Propertylist '" << name << "' from reference node (" << reference.GetName()
350 << ") not found in test node.";
351 error = true;
352 }
353
354 for (const auto &name : testListNames)
355 if (std::find(refListNames.begin(), refListNames.end(), name) == refListNames.end())
356 {
357 MITK_WARN << "Propertylist '" << name << "' did not exist in reference node (" << reference.GetName()
358 << "), but is present in test node.";
359 error = true;
360 }
361
362 if (error)
363 return false;
364 }
365
366 // compare each list
367 for (const auto &name : refListNames)
368 {
369 if (!ArePropertyListsEqual(*(reference.GetPropertyList(name)), *(test.GetPropertyList(name)), verbose))
370 {
371 MITK_WARN << "Property mismatch while comparing propertylist '" << name << "'. See messages above.";
372 error = true;
373 }
374 }
375
376 return !error;
377}
378
379bool mitk::DataStorageCompare::ArePropertyListsEqual(const mitk::PropertyList &reference,
380 const mitk::PropertyList &test,

Callers

nothing calls this directly

Calls 9

GetPropertyListNamesMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetNameMethod · 0.45
GetPropertyListMethod · 0.45
GetPropertyMethod · 0.45
IsNullMethod · 0.45
GetValueAsStringMethod · 0.45

Tested by

no test coverage detected