Rename test and add more assertions

This commit is contained in:
bgbsww
2024-01-24 20:10:55 -05:00
committed by Chris Hennes
parent 43f4db445a
commit 5135564fb4

View File

@@ -63,16 +63,15 @@ TEST_F(TopoShapeMakeShapeWithElementMapTests, nullShapeThrows)
using Data::IndexedName, Data::MappedName;
using Part::TopoShape;
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapVertex)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapEdge)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapWire)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapFace)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapShell)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapSolid)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapCompound)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapCompSolid)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapOffsetCubes)
TEST_F(TopoShapeMakeShapeWithElementMapTests, mapIntersectingCubes)
TEST_F(TopoShapeMakeShapeWithElementMapTests, mapCompound)
{
// Arrange
auto [cube1, cube2] = TopoShapeExpansionHelpers::CreateTwoCubes();
@@ -82,25 +81,40 @@ TEST_F(TopoShapeMakeShapeWithElementMapTests, mapIntersectingCubes)
std::vector<TopoShape> sources {cube1, cube2};
sources[0].Tag = 1;
sources[1].Tag = 2;
// sources[0].makeShapeWithElementMap(sources[0].getShape(), *Mapper(), {sources[0]});
// sources[1].makeShapeWithElementMap(sources[1].getShape(), *Mapper(), {sources[1]});
// Map only one of the two sources to test different names.
sources[0].makeShapeWithElementMap(sources[0].getShape(), *Mapper(), {sources[0]});
TopoShape compound;
compound.makeElementCompound(sources);
auto preElements = compound.getElementMap(); // Map before mapping.
std::map<IndexedName, MappedName> preMap;
for (auto name : preElements) {
preMap.emplace(name.index, name.name);
}
// Act
compound.makeShapeWithElementMap(compound.getShape(), *Mapper(), sources);
auto elements = compound.getElementMap();
std::map<IndexedName, MappedName> mapped;
auto elements = compound.getElementMap(); // Map after mapping
std::map<IndexedName, MappedName> map;
for (auto name : elements) {
mapped.emplace(name.index, name.name);
map.emplace(name.index, name.name);
}
// Assert
EXPECT_EQ(elements.size(), 52);
EXPECT_EQ(mapped[IndexedName("Edge1")], MappedName("Edge1;MAK;:H1:4,E"));
EXPECT_EQ(mapped[IndexedName("Edge", 13)], MappedName("Edge1;MAK;:H2:4,E"));
// EXPECT_STREQ(mapped[IndexedName("Edge1")],MappedName("Edge1;MAK;:H:4,E;MAK;:H1:f,E"));
// EXPECT_STREQ(mapped[IndexedName("Edge",13)],MappedName("Edge1;MAK;:H:4,E;MAK;:H2:f,E"));
EXPECT_EQ(preElements.size(), 52); // Check the before map.
EXPECT_EQ(preMap[IndexedName("Edge", 1)], MappedName("Edge1;MAK;:H:4,E;:H1:b,E"));
EXPECT_EQ(preMap[IndexedName("Edge", 13)], MappedName("Edge1;:H2,E"));
EXPECT_EQ(elements.size(), 52); // 12 Edges, 8 Vertexes, 6 Faces per each Cube
EXPECT_EQ(map[IndexedName("Edge", 1)], MappedName("Edge1;MAK;:H:4,E;MAK;:H1:f,E"));
EXPECT_EQ(map[IndexedName("Edge", 13)], MappedName("Edge1;MAK;:H2:4,E"));
EXPECT_EQ(map.count(IndexedName("Edge", 24)), 1);
EXPECT_EQ(map.count(IndexedName("Edge", 25)), 0);
EXPECT_EQ(map.count(IndexedName("Vertex", 16)), 1);
EXPECT_EQ(map.count(IndexedName("Vertex", 17)), 0);
EXPECT_EQ(map.count(IndexedName("Face", 12)), 1);
EXPECT_EQ(map.count(IndexedName("Face", 13)), 0);
EXPECT_STREQ(sources[0].shapeName().c_str(), "Solid");
EXPECT_STREQ(sources[1].shapeName().c_str(), "Solid");
EXPECT_STREQ(compound.shapeName().c_str(), "Compound");
}
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapCompSolid)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapOffsetCubes)
// TEST_F(TopoShapeMakeShapeWithElementMapTests, mapIntersectingCubes)