| 330 | } |
| 331 | |
| 332 | bool 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 | |
| 379 | bool mitk::DataStorageCompare::ArePropertyListsEqual(const mitk::PropertyList &reference, |
| 380 | const mitk::PropertyList &test, |
nothing calls this directly
no test coverage detected