diff --git a/src/Unittests/unittests.cc b/src/Unittests/unittests.cc index 2e9b78f4..92bb71e6 100644 --- a/src/Unittests/unittests.cc +++ b/src/Unittests/unittests.cc @@ -17,6 +17,7 @@ #include "unittests_trimesh_garbage_collection.hh" #include "unittests_randomNumberGenerator.hh" #include "unittests_split_copy.hh" +#include "unittests_vector_type.hh" int main(int _argc, char** _argv) { diff --git a/src/Unittests/unittests_vector_type.hh b/src/Unittests/unittests_vector_type.hh new file mode 100644 index 00000000..87209683 --- /dev/null +++ b/src/Unittests/unittests_vector_type.hh @@ -0,0 +1,62 @@ +#ifndef INCLUDE_UNITTESTS_OpenMeshVectorTest_HH +#define INCLUDE_UNITTESTS_OpenMeshVectorTest_HH + +#include +#include +#include + +class OpenMeshVectorTest : public testing::Test { + + protected: + + // This function is called before each test is run + virtual void SetUp() { + + // Do some initial stuff with the member data here... + } + + // This function is called after all tests are through + virtual void TearDown() { + + // Do some final stuff with the member data here... + } + +}; + + + +/* + * ==================================================================== + * Define tests below + * ==================================================================== + */ + +/* Compute surface area via cross product + */ +TEST_F(OpenMeshVectorTest, ComputeTriangleSurfaceWithCrossProduct) { + + + // + // vec1 + // x + // | + // | + // | + // x------>x vec2 + // + + OpenMesh::Vec3d vec1(0.0,1.0,0.0); + OpenMesh::Vec3d vec2(1.0,0.0,0.0); + + double area = 0.5 * cross(vec1,vec2).norm(); + EXPECT_EQ(0.5f , area ) << "Wrong area in cross product function"; + + area = 0.5 * ( vec1 % vec2 ).norm(); + EXPECT_EQ(0.5f , area ) << "Wrong area in cross product operator"; + +} + + + + +#endif // INCLUDE GUARD