tests: Add unit tests for getElementTypes()
This commit is contained in:
@@ -4,4 +4,5 @@ target_sources(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/KDTree.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Exporter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Mesh.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MeshFeature.cpp
|
||||
)
|
||||
|
||||
40
tests/src/Mod/Mesh/App/MeshFeature.cpp
Normal file
40
tests/src/Mod/Mesh/App/MeshFeature.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <src/App/InitApplication.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
|
||||
class MeshFeatureTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
static void SetUpTestSuite()
|
||||
{
|
||||
tests::initApplication();
|
||||
}
|
||||
|
||||
void SetUp() override
|
||||
{}
|
||||
|
||||
void TearDown() override
|
||||
{}
|
||||
};
|
||||
|
||||
// NOLINTBEGIN(cppcoreguidelines-*,readability-*)
|
||||
TEST_F(MeshFeatureTest, getElementTypes)
|
||||
{
|
||||
Mesh::Feature mf;
|
||||
std::vector<const char*> types = mf.getElementTypes();
|
||||
|
||||
EXPECT_EQ(types.size(), 2);
|
||||
EXPECT_STREQ(types[0], "Mesh");
|
||||
EXPECT_STREQ(types[1], "Segment");
|
||||
}
|
||||
|
||||
TEST_F(MeshFeatureTest, getComplexElementTypes)
|
||||
{
|
||||
Mesh::MeshObject mf;
|
||||
std::vector<const char*> types = mf.getElementTypes();
|
||||
|
||||
EXPECT_EQ(types.size(), 2);
|
||||
EXPECT_STREQ(types[0], "Mesh");
|
||||
EXPECT_STREQ(types[1], "Segment");
|
||||
}
|
||||
// NOLINTEND(cppcoreguidelines-*,readability-*)
|
||||
@@ -216,3 +216,25 @@ TEST_F(FeaturePartTest, getSubObject)
|
||||
ASSERT_NE(result, nullptr);
|
||||
EXPECT_STREQ(result->getNameInDocument(), "Part__Box001");
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartTest, getElementTypes)
|
||||
{
|
||||
Part::Feature pf;
|
||||
std::vector<const char*> types = pf.getElementTypes();
|
||||
|
||||
EXPECT_EQ(types.size(), 3);
|
||||
EXPECT_STREQ(types[0], "Face");
|
||||
EXPECT_STREQ(types[1], "Edge");
|
||||
EXPECT_STREQ(types[2], "Vertex");
|
||||
}
|
||||
|
||||
TEST_F(FeaturePartTest, getComplexElementTypes)
|
||||
{
|
||||
Part::TopoShape shape;
|
||||
std::vector<const char*> types = shape.getElementTypes();
|
||||
|
||||
EXPECT_EQ(types.size(), 3);
|
||||
EXPECT_STREQ(types[0], "Face");
|
||||
EXPECT_STREQ(types[1], "Edge");
|
||||
EXPECT_STREQ(types[2], "Vertex");
|
||||
}
|
||||
|
||||
@@ -2,4 +2,5 @@ target_sources(
|
||||
Points_tests_run
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Points.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PointsFeature.cpp
|
||||
)
|
||||
|
||||
36
tests/src/Mod/Points/App/PointsFeature.cpp
Normal file
36
tests/src/Mod/Points/App/PointsFeature.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <src/App/InitApplication.h>
|
||||
#include <Mod/Points/App/PointsFeature.h>
|
||||
|
||||
class PointsFeatureTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
static void SetUpTestSuite()
|
||||
{
|
||||
tests::initApplication();
|
||||
}
|
||||
|
||||
void SetUp() override
|
||||
{}
|
||||
|
||||
void TearDown() override
|
||||
{}
|
||||
};
|
||||
|
||||
// NOLINTBEGIN(cppcoreguidelines-*,readability-*)
|
||||
TEST_F(PointsFeatureTest, getElementTypes)
|
||||
{
|
||||
Points::Feature pf;
|
||||
std::vector<const char*> types = pf.getElementTypes();
|
||||
|
||||
EXPECT_EQ(types.size(), 0);
|
||||
}
|
||||
|
||||
TEST_F(PointsFeatureTest, getComplexElementTypes)
|
||||
{
|
||||
Points::PointKernel pk;
|
||||
std::vector<const char*> types = pk.getElementTypes();
|
||||
|
||||
EXPECT_EQ(types.size(), 0);
|
||||
}
|
||||
// NOLINTEND(cppcoreguidelines-*,readability-*)
|
||||
Reference in New Issue
Block a user