OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unittests_read_write_STL.hh
1 #ifndef INCLUDE_UNITTESTS_READ_WRITE_STL_HH
2 #define INCLUDE_UNITTESTS_READ_WRITE_STL_HH
3 
4 #include <gtest/gtest.h>
5 #include <Unittests/unittests_common.hh>
6 
7 
9 
10  protected:
11 
12  // This function is called before each test is run
13  virtual void SetUp() {
14 
15  // Do some initial stuff with the member data here...
16  }
17 
18  // This function is called after all tests are through
19  virtual void TearDown() {
20 
21  // Do some final stuff with the member data here...
22  }
23 
24  // Member already defined in OpenMeshBase
25  //Mesh mesh_;
26 };
27 
28 /*
29  * ====================================================================
30  * Define tests below
31  * ====================================================================
32  */
33 
34 /*
35  * Just load a simple mesh file in stla format and count whether
36  * the right number of entities has been loaded.
37  */
38 TEST_F(OpenMeshReadWriteSTL, LoadSimpleSTLFile) {
39 
40  mesh_.clear();
41 
42  bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.stl");
43 
44  EXPECT_TRUE(ok);
45 
46  EXPECT_EQ(7526u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
47  EXPECT_EQ(22572u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
48  EXPECT_EQ(15048u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
49 }
50 
51 
52 
53 /*
54  * Just load a simple mesh file in stlb format and count whether
55  * the right number of entities has been loaded.
56  */
57 TEST_F(OpenMeshReadWriteSTL, LoadSimpleSTLBinaryFile) {
58 
59  mesh_.clear();
60 
61  bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1Binary.stl");
62 
63  EXPECT_TRUE(ok);
64 
65  EXPECT_EQ(7526u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
66  EXPECT_EQ(22572u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
67  EXPECT_EQ(15048u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
68 }
69 
70 
71 #endif // INCLUDE GUARD

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .