Skip to content

Conversation

@jmarquisbq
Copy link
Contributor

No description provided.

@jmarquisbq jmarquisbq self-assigned this Jan 9, 2026
@jmarquisbq jmarquisbq added the Testing Dealing with bug hunting in software label Jan 9, 2026
@imikejackson imikejackson force-pushed the topic/DataStructureCompareUnitTest branch 3 times, most recently from 0fd375f to 2c687c1 Compare January 21, 2026 22:24
@imikejackson imikejackson force-pushed the topic/DataStructureCompareUnitTest branch from 2c687c1 to 2db7460 Compare January 23, 2026 17:52
@imikejackson imikejackson force-pushed the topic/DataStructureCompareUnitTest branch from 2db7460 to c02c3c8 Compare January 23, 2026 19:25
@imikejackson imikejackson requested review from JDuffeyBQ and removed request for imikejackson January 23, 2026 19:26
Copy link
Collaborator

@JDuffeyBQ JDuffeyBQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably also check objects like geometries and attribute matrices for equality as well.

#include <catch2/catch.hpp>

#include "simplnx/Core/Application.hpp"
#include "simplnx/DataStructure/IO/HDF5/DataStructureWriter.hpp"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these includes missing before? And same for other files.

Comment on lines +1458 to +1474
// groupACDPath.createChildPath(arrayI->getName());
// groupBCDPath.createChildPath(arrayI->getName());
//
// groupBCDPath.createChildPath(arrayJ->getName());
// groupACEPath.createChildPath(arrayJ->getName());
// groupBCEPath.createChildPath(arrayJ->getName());
// groupBEPath.createChildPath(arrayJ->getName());
// groupBFEPath.createChildPath(arrayJ->getName());
//
// groupACEPath.createChildPath(arrayK->getName());
// groupBCEPath.createChildPath(arrayK->getName());
// groupBEPath.createChildPath(arrayK->getName());
// groupBFEPath.createChildPath(arrayK->getName());
//
// groupBFGPath.createChildPath(arrayL->getName());
//
// groupBFGPath.createChildPath(arrayM->getName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these used?

Comment on lines +886 to +891
if(parentA == nullptr || parentB == nullptr)
{
// std::cout << "DEBUG TEST: parentA or parentB is null!";
INFO("DEBUG TEST: parentA or parentB is null!");
REQUIRE(false);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(parentA == nullptr || parentB == nullptr)
{
// std::cout << "DEBUG TEST: parentA or parentB is null!";
INFO("DEBUG TEST: parentA or parentB is null!");
REQUIRE(false);
}
REQUIRE(parentA != nullptr);
REQUIRE(parentB != nullptr);

childrenNamesB = parentB->getDataMap().getNames();
}

for(int i = 0; i < childrenNamesA.size(); ++i)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for(int i = 0; i < childrenNamesA.size(); ++i)
for(usize i = 0; i < childrenNamesA.size(); ++i)

Comment on lines +912 to +913
auto objectA = dataStructureA.getData(childPath);
auto objectB = dataStructureB.getData(childPath);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto objectA = dataStructureA.getData(childPath);
auto objectB = dataStructureB.getData(childPath);
const DataObject* objectA = dataStructureA.getData(childPath);
const DataObject* objectB = dataStructureB.getData(childPath);
REQUIRE(objectA != nullptr);
REQUIRE(objectB != nullptr);

Comment on lines +958 to +960
REQUIRE(dataArrayA != nullptr);
REQUIRE(dataArrayB != nullptr);
CompareStringArrays(*dataArrayA, *dataArrayB);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
REQUIRE(dataArrayA != nullptr);
REQUIRE(dataArrayB != nullptr);
CompareStringArrays(*dataArrayA, *dataArrayB);
REQUIRE(stringArrayA != nullptr);
REQUIRE(stringArrayB != nullptr);
CompareStringArrays(*stringArrayA, *stringArrayB);

Comment on lines +914 to +915
// Make sure both are the same object type
// If this fails the test will throw and return at this point
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Make sure both are the same object type
// If this fails the test will throw and return at this point

Comment on lines +1018 to +1021
} catch(std::exception& e)
{
REQUIRE(false);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch(std::exception& e)
{
REQUIRE(false);
}
} catch(const std::exception& e)
{
INFO(fmt::format("Caught exception: {}", e.what()));
REQUIRE(false);
}

Is there a particular exception we are expecting to catch?

Comment on lines +1010 to +1014
default:
std::cout << "Missing DataType: " << static_cast<uint32>(objectA->getDataObjectType()) << std::endl;
INFO(fmt::format("DEBUG TEST: Child path ({}) cannot be found or has different array types in data structures A and B!", childPath.toString()));
REQUIRE(false);
break;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default:
std::cout << "Missing DataType: " << static_cast<uint32>(objectA->getDataObjectType()) << std::endl;
INFO(fmt::format("DEBUG TEST: Child path ({}) cannot be found or has different array types in data structures A and B!", childPath.toString()));
REQUIRE(false);
break;
default: {
auto underlyingDataType = to_underlying(objectA->getDataObjectType());
std::cout << "Missing DataType: " << underlyingDataType << std::endl;
INFO(fmt::format("Object at path ({}) has unhandled type ({})", childPath.toString(), underlyingDataType));
REQUIRE(false);
break;
}

Also might as well store the data object type before this point since we use it before the switch.

DataPath childPath = parentGroup.createChildPath(childrenNamesA[i]);
if(dataStructureA.getDataAs<BaseGroup>(childPath))
{
CompareDataStructures(dataStructureA, dataStructureB, childPath);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is recursive, it is possible a very deep DataStructure would theoretically be an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing Dealing with bug hunting in software

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants