Toponaming/Part: Correct elementsMatch to test all entries

This commit is contained in:
bgbsww
2024-03-03 19:10:42 -05:00
parent 0420f72ca0
commit 046e43651c
2 changed files with 16 additions and 18 deletions

View File

@@ -169,17 +169,17 @@ testing::AssertionResult elementsMatch(const TopoShape& shape,
{
auto elements = shape.getElementMap();
if (!elements.empty() || !names.empty()) {
if (std::find_first_of(elements.begin(),
elements.end(),
names.begin(),
names.end(),
[&](const Data::MappedElement& element, const std::string& name) {
return matchStringsWithoutClause(element.name.toString(),
name,
";D[a-fA-F0-9]+");
})
== elements.end()) {
return testing::AssertionFailure() << mappedElementVectorToString(elements);
for (auto name : names) {
if (std::find_if(elements.begin(),
elements.end(),
[&, name](const Data::MappedElement& element) {
return matchStringsWithoutClause(element.name.toString(),
name,
";D[a-fA-F0-9]+");
})
== elements.end()) {
return testing::AssertionFailure() << mappedElementVectorToString(elements);
}
}
}
return testing::AssertionSuccess();

View File

@@ -2444,13 +2444,11 @@ TEST_F(TopoShapeExpansionTest, replaceElementShape)
EXPECT_TRUE(elementsMatch(
result,
{
"Edge1", "Edge1;:H1,E", "Edge1;:H2,E", "Edge1;:H3,E", "Edge2",
"Edge2;:H1,E", "Edge2;:H2,E", "Edge2;:H3,E", "Edge3", "Edge3;:H1,E",
"Edge3;:H2,E", "Edge3;:H3,E", "Edge4;:H1,E", "Edge4;:H2,E", "Edge4;:H3,E",
"Face1;:H2,F", "Face1;:H3,F", "Face1;:H4,F", "Face1;:H5,F", "Face1;:H6,F",
"Vertex1", "Vertex1;:H1,V", "Vertex1;:H2,V", "Vertex2", "Vertex2;:H1,V",
"Vertex2;:H2,V", "Vertex3", "Vertex3;:H1,V", "Vertex3;:H2,V", "Vertex4;:H1,V",
"Vertex4;:H2,V",
"Edge1;:H1,E", "Edge1;:H2,E", "Edge1;:H3,E", "Edge2;:H1,E", "Edge2;:H2,E",
"Edge2;:H3,E", "Edge3;:H1,E", "Edge3;:H2,E", "Edge3;:H3,E", "Edge4;:H1,E",
"Edge4;:H2,E", "Edge4;:H3,E", "Face1;:H2,F", "Face1;:H3,F", "Face1;:H4,F",
"Face1;:H5,F", "Face1;:H6,F", "Vertex1;:H1,V", "Vertex1;:H2,V", "Vertex2;:H1,V",
"Vertex2;:H2,V", "Vertex3;:H1,V", "Vertex3;:H2,V", "Vertex4;:H1,V", "Vertex4;:H2,V",
}));
}