Commit bbb3a55e authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

Split up unit tests into multiple compile units.

Added mesh_cast unit test.


git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@958 fdac6126-5c0c-442c-9429-916003d36597
parent 5094916f
......@@ -27,7 +27,8 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
endif()
# Create new target named unittests_hexmeshing
add_executable(unittests unittests.cc)
FILE(GLOB UNITTEST_SRC *.cc)
add_executable(unittests ${UNITTEST_SRC})
if ( NOT WIN32)
# Link against all necessary libraries
......
#include <gtest/gtest.h>
#include "unittests_common.hh"
#include "unittests_property.hh"
#include "unittests_read_write_OBJ.hh"
#include "unittests_read_write_OFF.hh"
#include "unittests_read_write_OM.hh"
#include "unittests_read_write_PLY.hh"
#include "unittests_read_write_STL.hh"
#include "unittests_trimesh_iterators.hh"
#include "unittests_trimesh_collapse.hh"
#include "unittests_decimater.hh"
#include "unittests_mc_decimater.hh"
#include "unittests_mesh_dual.hh"
#include "unittests_mixed_decimater.hh"
#include "unittests_stripifier.hh"
#include "unittests_subdivider_uniform.hh"
#include "unittests_subdivider_adaptive.hh"
#include "unittests_trimesh_normal_calculations.hh"
#include "unittests_trimesh_others.hh"
#include "unittests_add_face.hh"
#include "unittests_delete_face.hh"
#include "unittests_faceless_mesh.hh"
#include "unittests_trimesh_garbage_collection.hh"
#include "unittests_randomNumberGenerator.hh"
#include "unittests_split_copy.hh"
#include "unittests_vector_type.hh"
#include "unittests_boundary.hh"
// Circulators on triangular meshes
#include "unittests_trimesh_circulator_face_edge.hh"
#include "unittests_trimesh_circulator_face_face.hh"
#include "unittests_trimesh_circulator_face_halfedge.hh"
#include "unittests_trimesh_circulator_face_vertex.hh"
#include "unittests_trimesh_circulator_vertex_edge.hh"
#include "unittests_trimesh_circulator_vertex_face.hh"
#include "unittests_trimesh_circulator_vertex_ihalfedge.hh"
#include "unittests_trimesh_circulator_vertex_ihalfedge.hh"
#include "unittests_trimesh_circulator_vertex_ohalfedge.hh"
#include "unittests_trimesh_circulator_vertex_vertex.hh"
#include "unittests_trimesh_circulator_current_halfedge_handle_replacement.hh"
int main(int _argc, char** _argv) {
testing::InitGoogleTest(&_argc, _argv);
......
#ifndef INCLUDE_UNITTESTS_OpenMeshAddFaceTriangleMesh_HH
#define INCLUDE_UNITTESTS_OpenMeshAddFaceTriangleMesh_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshAddFaceTriangleMesh : public OpenMeshBase {
protected:
......@@ -429,5 +428,4 @@ TEST_F(OpenMeshAddFacePolyMesh, CreatePolyMeshCube) {
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_BOUNDARY_HH
#define INCLUDE_UNITTESTS_BOUNDARY_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshBoundaryTriangleMesh : public OpenMeshBase {
protected:
......@@ -189,5 +188,4 @@ TEST_F(OpenMeshBoundaryTriangleMesh, TestBoundaryFace) {
EXPECT_TRUE ( mesh_.is_boundary( face_handles[4] ) ) << "Face 4 is not boundary!";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_DECIMATER_HH
#define INCLUDE_UNITTESTS_DECIMATER_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
......@@ -7,6 +5,8 @@
#include <OpenMesh/Tools/Decimater/ModQuadricT.hh>
#include <OpenMesh/Tools/Decimater/ModNormalFlippingT.hh>
namespace {
class OpenMeshDecimater : public OpenMeshBase {
protected:
......@@ -106,5 +106,4 @@ TEST_F(OpenMeshDecimater, DecimateMeshToFaceFaceLimit) {
EXPECT_EQ(14994u, mesh_.n_edges()) << "The number of edges after decimation is not correct!";
EXPECT_EQ(9996u, mesh_.n_faces()) << "The number of faces after decimation is not correct!";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_OpenMeshDeleteFaceTriangleMesh_HH
#define INCLUDE_UNITTESTS_OpenMeshDeleteFaceTriangleMesh_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshDeleteFaceTriangleMesh : public OpenMeshBase {
protected:
......@@ -613,5 +613,4 @@ TEST_F(OpenMeshDeleteFacePolyMesh, DeleteteHalfPolyMeshCubeWithEdgeStatus) {
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_OpenMeshFacelessTriangleMesh_HH
#define INCLUDE_UNITTESTS_OpenMeshFacelessTriangleMesh_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshFacelessMesh : public OpenMeshBase {
protected:
......@@ -65,5 +65,4 @@ class OpenMeshFacelessMesh : public OpenMeshBase {
//
//}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_MC_DECIMATER_HH
#define INCLUDE_UNITTESTS_MC_DECIMATER_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
......@@ -7,6 +5,8 @@
#include <OpenMesh/Tools/Decimater/ModQuadricT.hh>
#include <OpenMesh/Tools/Decimater/ModNormalFlippingT.hh>
namespace {
class OpenMeshMultipleChoiceDecimater : public OpenMeshBase {
protected:
......@@ -106,5 +106,4 @@ TEST_F(OpenMeshMultipleChoiceDecimater, DecimateMeshToFaceFaceLimit) {
EXPECT_EQ(14994u, mesh_.n_edges()) << "The number of edges after decimation is not correct!";
EXPECT_EQ(9996u, mesh_.n_faces()) << "The number of faces after decimation is not correct!";
}
#endif // INCLUDE GUARD
}
#include <iostream>
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
namespace {
class OpenMeshMeshCastTest: public testing::Test {
};
struct TriTraits1: public OpenMesh::DefaultTraits {
typedef OpenMesh::Vec3d Point;
};
struct TriTraits2: public OpenMesh::DefaultTraits {
typedef OpenMesh::Vec3d Point;
};
TEST_F(OpenMeshMeshCastTest, PerformCast) {
OpenMesh::TriMesh_ArrayKernelT<TriTraits1> a;
OpenMesh::TriMesh_ArrayKernelT<TriTraits2> &b =
OpenMesh::mesh_cast<OpenMesh::TriMesh_ArrayKernelT<TriTraits2>&>(a);
/*
OpenMesh::TriMesh_ArrayKernelT < TriTraits2 > &b =
OpenMesh::MeshCast<
TriMesh_ArrayKernelT<TriTraits2>&,
OpenMesh::TriMesh_ArrayKernelT<TriTraits1>&
>::cast(a);
*/
}
}
#ifndef INCLUDE_UNITTESTS_MESHDUAL_HH
#define INCLUDE_UNITTESTS_MESHDUAL_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <OpenMesh/Tools/Dualizer/meshDualT.hh>
namespace {
class OpenMeshMeshDual : public OpenMeshBasePoly {
protected:
......@@ -49,5 +49,4 @@ TEST_F(OpenMeshMeshDual, Dualize) {
delete(dualMesh);
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_MIXED_DECIMATER_HH
#define INCLUDE_UNITTESTS_MIXED_DECIMATER_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
......@@ -7,6 +5,8 @@
#include <OpenMesh/Tools/Decimater/ModQuadricT.hh>
#include <OpenMesh/Tools/Decimater/ModNormalFlippingT.hh>
namespace {
class OpenMeshMixedDecimater : public OpenMeshBase {
protected:
......@@ -106,5 +106,4 @@ TEST_F(OpenMeshMixedDecimater, DecimateMeshToFaceFaceLimit) {
EXPECT_EQ(14994u, mesh_.n_edges()) << "The number of edges after decimation is not correct!";
EXPECT_EQ(9996u, mesh_.n_faces()) << "The number of faces after decimation is not correct!";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_PROPERTY_HH
#define INCLUDE_UNITTESTS_PROPERTY_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
namespace {
class OpenMeshProperties : public OpenMeshBase {
protected:
......@@ -596,5 +596,4 @@ TEST_F(OpenMeshProperties, CopyAllPropertiesVertexAfterRemoveOfProperty) {
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_RANDOMNUMBER_HH
#define INCLUDE_UNITTESTS_RANDOMNUMBER_HH
#include <gtest/gtest.h>
#include <OpenMesh/Core/Utils/RandomNumberGenerator.hh>
namespace {
class RandomNumberGenerator : public testing::Test {
protected:
......@@ -89,5 +89,4 @@ TEST_F(RandomNumberGenerator, RandomNumberGeneratorMaxTestLowres) {
EXPECT_TRUE( (average - 0.5) < 0.01 ) << "Expected value not 0.5";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_READ_WRITE_OBJ_HH
#define INCLUDE_UNITTESTS_READ_WRITE_OBJ_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
namespace {
class OpenMeshReadWriteOBJ : public OpenMeshBase {
protected:
......@@ -292,5 +292,4 @@ TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJWithVertexColorsAsVCLines) {
mesh_.release_vertex_colors();
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_READ_WRITE_OFF_HH
#define INCLUDE_UNITTESTS_READ_WRITE_OFF_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
namespace {
class OpenMeshReadWriteOFF : public OpenMeshBase {
protected:
......@@ -203,5 +202,4 @@ TEST_F(OpenMeshReadWriteOFF, WriteAndReadBinaryFloatVertexColorsToAndFromOFFFile
mesh_.release_vertex_colors();
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_READ_WRITE_OM_HH
#define INCLUDE_UNITTESTS_READ_WRITE_OM_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
namespace {
class OpenMeshReadWriteOM : public OpenMeshBase {
protected:
......@@ -671,5 +670,4 @@ TEST_F(OpenMeshReadWriteOM, ReadBigMeshWithCustomProperty) {
EXPECT_FALSE(wrong) << "min one vertex has worng vertex property";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_READ_WRITE_PLY_HH
#define INCLUDE_UNITTESTS_READ_WRITE_PLY_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
namespace {
class OpenMeshReadWritePLY : public OpenMeshBase {
protected:
......@@ -440,5 +439,4 @@ TEST_F(OpenMeshReadWritePLY, LoadSimplePLYWithNormals) {
mesh_.release_vertex_normals();
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_READ_WRITE_STL_HH
#define INCLUDE_UNITTESTS_READ_WRITE_STL_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
namespace {
class OpenMeshReadWriteSTL : public OpenMeshBase {
protected:
......@@ -67,5 +67,4 @@ TEST_F(OpenMeshReadWriteSTL, LoadSimpleSTLBinaryFile) {
EXPECT_EQ(15048u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_OpenMeshSplitCopy_HH
#define INCLUDE_UNITTESTS_OpenMeshSplitCopy_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshSplitCopyTriangleMesh : public OpenMeshBase {
protected:
......@@ -145,5 +145,4 @@ TEST_F(OpenMeshSplitCopyPolyMesh, SplitCopyPolymesh) {
EXPECT_EQ(999, mesh_.property(fprop_int, *f_it)) << "Different Property value";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_STRIPIFIER_HH
#define INCLUDE_UNITTESTS_STRIPIFIER_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <OpenMesh/Tools/Utils/StripifierT.hh>
namespace {
class OpenMeshStripify : public OpenMeshBase {
protected:
......@@ -47,5 +47,4 @@ TEST_F(OpenMeshStripify, Stripify) {
EXPECT_TRUE(stripifier.is_valid()) << "Strips not computed!";
}
#endif // INCLUDE GUARD
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment