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

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
}
#ifndef INCLUDE_UNITTESTS_SUBIVIDER_ADAPTIVE_HH
#define INCLUDE_UNITTESTS_SUBIVIDER_ADAPTIVE_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.hh>
#include <OpenMesh/Tools/Subdivider/Adaptive/Composite/RulesT.hh>
namespace {
class OpenMeshSubdividerAdaptive_Poly : public OpenMeshBasePoly {
protected:
......@@ -299,5 +299,4 @@ TEST_F(OpenMeshSubdividerAdaptive_Triangle, AdaptiveCompositeRefineFace) {
EXPECT_EQ(458u, mesh.n_faces() ) << "Wrong number of faces after subdivision with sqrt3";
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_SUBIVIDER_UNIFORM_HH
#define INCLUDE_UNITTESTS_SUBIVIDER_UNIFORM_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/CatmullClarkT.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh>
namespace {
class OpenMeshSubdividerUniform_Poly : public OpenMeshBasePoly {
protected:
......@@ -244,5 +244,4 @@ TEST_F(OpenMeshSubdividerUniform_Poly, Subdivider_CatmullClark) {
EXPECT_EQ(256u, mesh_.n_faces() ) << "Wrong number of faces after subdivision with catmull clark";
}
#endif // INCLUDE GUARD
}
#ifndef UNITTESTS_TRIMESH_CIRCULATOR_CURRENT_HANDLE_REPLACEMENT_HH
#define UNITTESTS_TRIMESH_CIRCULATOR_CURRENT_HANDLE_REPLACEMENT_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement : public OpenMeshBase {
protected:
......@@ -275,5 +275,4 @@ TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, fe_iter) {
EXPECT_EQ(heh0[i], heh1[i]) << "halfedge handles do not match";
}
#endif // UNITTESTS_TRIMESH_CIRCULATOR_CURRENT_HANDLE_REPLACEMENT_HH
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorFaceEdge : public OpenMeshBase {
protected:
......@@ -127,7 +127,7 @@ TEST_F(OpenMeshTrimeshCirculatorFaceEdge, FaceEdgeIterWithoutHolesIncrement) {
EXPECT_TRUE( cfe_it == cfe_end ) << "End iterator for ConstFaceEdgeIter not matching";
}
}
/*
* Small FaceEdgeIterator Test
......@@ -224,5 +224,4 @@ TEST_F(OpenMeshTrimeshCirculatorFaceEdge, FaceEdgeIterWithoutHolesDecrement) {
EXPECT_TRUE( cfe_it == cfe_end ) << "End iterator for ConstFaceEdgeIter not matching";
}
*/
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorFaceFace : public OpenMeshBase {
protected:
......@@ -262,5 +262,4 @@ TEST_F(OpenMeshTrimeshCirculatorFaceFace, FaceFaceIteratorHandleConversion) {
EXPECT_EQ(1, faceHandle1.idx() ) << "Wrong face handle index when getting from iterator via handle";
}
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorFaceHalfEdge : public OpenMeshBase {
protected:
......@@ -126,4 +126,4 @@ TEST_F(OpenMeshTrimeshCirculatorFaceHalfEdge, FaceHalfedgeIterWithoutHolesIncrem
EXPECT_TRUE( cfh_it == cfh_end ) << "End iterator for ConstFaceHalfedgeIter not matching";
}
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorFaceVertex : public OpenMeshBase {
protected:
......@@ -120,5 +121,6 @@ TEST_F(OpenMeshTrimeshCirculatorFaceVertex, FaceVertexIterWithoutIncrement) {
EXPECT_EQ(0, cfv_it->idx() ) << "Index wrong in ConstFaceVertexIter at step 3";
EXPECT_FALSE(cfv_it.is_valid()) << "Iterator invalid in ConstFaceVertexIter at step 3";
EXPECT_TRUE( cfv_it == cfv_end ) << "End iterator for ConstFaceVertexIter not matching";
}
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorVertexEdge : public OpenMeshBase {
protected:
......@@ -199,5 +199,4 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, VertexEdgeIterBoundaryIncrement) {
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorVertexFace : public OpenMeshBase {
protected:
......@@ -266,4 +267,4 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, VertexFaceIterBoundaryIncrement) {
EXPECT_FALSE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 2";
EXPECT_TRUE( vf_it == vf_end ) << "End iterator for VertexFaceIter not matching";
}
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorVertexIHalfEdge : public OpenMeshBase {
protected:
......@@ -310,5 +310,5 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, VertexIncomingHalfedgeDereferen
EXPECT_EQ(eh.idx() , 5 ) << "Wrong edge handle after dereferencing";
EXPECT_EQ(heh.idx() , 10 ) << "Wrong half edge handle after dereferencing";
EXPECT_EQ(vh2.idx() , 1 ) << "Wrong vertex handle after dereferencing";
}
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorVertexOHalfEdge : public OpenMeshBase {
protected:
......@@ -312,5 +312,4 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, VertexOutgoingHalfedgeDereferen
EXPECT_EQ(vh2.idx() , 4 ) << "Wrong vertex handle after dereferencing";
}
}
#pragma once
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTrimeshCirculatorVertexVertex : public OpenMeshBase {
protected:
......@@ -198,5 +198,5 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, VertexVertexBoundaryIncrement) {
EXPECT_EQ(4, vv_it->idx() ) << "Index wrong in VertexVertexIter step 3";
EXPECT_FALSE(vv_it.is_valid()) << "Iterator invalid in VertexVertexIter at step 3";
EXPECT_TRUE( vv_it == vv_end ) << "Miss matched end iterator";
}
}
#ifndef INCLUDE_UNITTESTS_TRIMESH_COLLAPSE_HH
#define INCLUDE_UNITTESTS_TRIMESH_COLLAPSE_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshCollapse : public OpenMeshBase {
protected:
......@@ -608,5 +607,4 @@ TEST_F(OpenMeshCollapse, LargeCollapseHalfEdge) {
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_TRIMESH_GARBAGE_COLLECTION_HH
#define INCLUDE_UNITTESTS_TRIMESH_GARBAGE_COLLECTION_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshTriMeshGarbageCollection : public OpenMeshBase {
protected:
......@@ -486,5 +485,4 @@ TEST_F(OpenMeshTriMeshGarbageCollection, TrackedGarbageCollection) {
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_TRIMESH_ITERATORS_HH
#define INCLUDE_UNITTESTS_TRIMESH_ITERATORS_HH
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <iostream>
namespace {
class OpenMeshIterators : public OpenMeshBase {
protected:
......@@ -775,5 +774,4 @@ TEST_F(OpenMeshIterators, FaceIterEmptyMeshOneDeletedFace) {
mesh_.release_face_status();
}
#endif // INCLUDE GUARD
}
#ifndef INCLUDE_UNITTESTS_NORMAL_CALCULATIONS_HH
#define INCLUDE_UNITTESTS_NORMAL_CALCULATIONS_HH
#include <gtest/gtest.h>