hyporo-cpp/source/hpr/mesh/tests/hmesh-test.cpp

22 lines
701 B
C++
Raw Normal View History

2022-09-22 20:43:06 +05:00
#include <gtest/gtest.h>
2022-11-04 18:38:39 +05:00
#include "../mesh.hpp"
2022-09-22 20:43:06 +05:00
2022-11-04 18:38:39 +05:00
TEST(hmeshTest, Mesh)
2022-09-22 20:43:06 +05:00
{
2022-11-04 18:38:39 +05:00
hpr::mesh::Mesh mesh;
2022-11-18 21:50:49 +05:00
mesh.addVertex(0, 0, 0);
mesh.addVertex(1, 1, 1);
mesh.addVertex(10, 0, 0);
mesh.addVertex(0, 0, 0);
2022-11-04 18:38:39 +05:00
mesh.addEdge(mesh.vertex(0), mesh.vertex(1));
2022-11-18 21:50:49 +05:00
mesh.addEdge(mesh.vertex(1), mesh.vertex(2));
mesh.addEdge(mesh.vertex(2), mesh.vertex(0));
mesh.addEdge(mesh.vertex(0), mesh.vertex(3));
mesh.addFace(mesh.edge(0), mesh.edge(1), mesh.edge(2));
EXPECT_EQ(mesh.vertices().size(), 4);
EXPECT_EQ(mesh.edges().size(), 4);
EXPECT_EQ(mesh.faces().size(), 1);
EXPECT_EQ(mesh.vertex(1)->refEdges().size(), 2);
EXPECT_FALSE(mesh.edges().back()->isValid());
2022-09-22 20:43:06 +05:00
}