* TopoShape::getElementTypeAndIndex * ComplexGeoData::getTypeAndIndex and fix crashes there when passing a null pointer
91 lines
2.3 KiB
C++
91 lines
2.3 KiB
C++
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
#include "gtest/gtest.h"
|
|
#include <Mod/Part/App/TopoShape.h>
|
|
|
|
// clang-format off
|
|
TEST(TopoShape, TestElementTypeFace1)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getElementTypeAndIndex("Face1"),
|
|
std::make_pair(std::string("Face"), 1UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestElementTypeEdge12)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getElementTypeAndIndex("Edge12"),
|
|
std::make_pair(std::string("Edge"), 12UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestElementTypeVertex3)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getElementTypeAndIndex("Vertex3"),
|
|
std::make_pair(std::string("Vertex"), 3UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestElementTypeFacer)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getElementTypeAndIndex("Facer"),
|
|
std::make_pair(std::string(), 0UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestElementTypeVertex)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getElementTypeAndIndex("Vertex"),
|
|
std::make_pair(std::string(), 0UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestElementTypeEmpty)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getElementTypeAndIndex(""),
|
|
std::make_pair(std::string(), 0UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestElementTypeNull)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getElementTypeAndIndex(nullptr),
|
|
std::make_pair(std::string(), 0UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestTypeFace1)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getTypeAndIndex("Face1"),
|
|
std::make_pair(std::string("Face"), 1UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestTypeEdge12)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getTypeAndIndex("Edge12"),
|
|
std::make_pair(std::string("Edge"), 12UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestTypeVertex3)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getTypeAndIndex("Vertex3"),
|
|
std::make_pair(std::string("Vertex"), 3UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestTypeFacer)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getTypeAndIndex("Facer"),
|
|
std::make_pair(std::string("Facer"), 0UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestTypeVertex)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getTypeAndIndex("Vertex"),
|
|
std::make_pair(std::string("Vertex"), 0UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestTypeEmpty)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getTypeAndIndex(""),
|
|
std::make_pair(std::string(), 0UL));
|
|
}
|
|
|
|
TEST(TopoShape, TestTypeNull)
|
|
{
|
|
EXPECT_EQ(Part::TopoShape::getTypeAndIndex(nullptr),
|
|
std::make_pair(std::string(), 0UL));
|
|
}
|
|
// clang-format on
|