Browse Source

Merge pull request #1365 from libigl/alecjacobson-patch-test_common

Update test_common.h
Alec Jacobson 6 years ago
parent
commit
6c50f857a9
34 changed files with 76 additions and 100 deletions
  1. 1 1
      tests/include/igl/avg_edge_length.cpp
  2. 2 2
      tests/include/igl/boundary_loop.cpp
  3. 4 4
      tests/include/igl/copyleft/boolean/mesh_boolean.cpp
  4. 1 1
      tests/include/igl/copyleft/cgal/CSGTree.cpp
  5. 2 2
      tests/include/igl/copyleft/cgal/hausdorff.cpp
  6. 2 2
      tests/include/igl/copyleft/cgal/mesh_to_polyhedron.cpp
  7. 3 3
      tests/include/igl/copyleft/cgal/order_facets_around_edges.cpp
  8. 5 5
      tests/include/igl/copyleft/cgal/outer_facet.cpp
  9. 1 1
      tests/include/igl/copyleft/cgal/outer_hull.cpp
  10. 2 2
      tests/include/igl/copyleft/cgal/peel_outer_hull_layers.cpp
  11. 3 3
      tests/include/igl/copyleft/cgal/points_inside_component.cpp
  12. 1 1
      tests/include/igl/copyleft/cgal/remesh_self_intersections.cpp
  13. 3 3
      tests/include/igl/cotmatrix.cpp
  14. 2 2
      tests/include/igl/cotmatrix_entries.cpp
  15. 1 1
      tests/include/igl/cotmatrix_intrinsic.cpp
  16. 3 3
      tests/include/igl/cut_to_disk.cpp
  17. 2 2
      tests/include/igl/decimate.cpp
  18. 1 1
      tests/include/igl/dijkstra.cpp
  19. 1 1
      tests/include/igl/doublearea.cpp
  20. 1 1
      tests/include/igl/edge_flaps.cpp
  21. 1 1
      tests/include/igl/edge_lengths.cpp
  22. 1 1
      tests/include/igl/embree/EmbreeIntersector.cpp
  23. 1 1
      tests/include/igl/intrinsic_delaunay_cotmatrix.cpp
  24. 2 2
      tests/include/igl/is_edge_manifold.cpp
  25. 1 1
      tests/include/igl/is_irregular_vertex.cpp
  26. 1 1
      tests/include/igl/iterative_closest_point.cpp
  27. 1 1
      tests/include/igl/per_face_normals.cpp
  28. 2 2
      tests/include/igl/readDMAT.cpp
  29. 4 2
      tests/include/igl/readOBJ.cpp
  30. 1 1
      tests/include/igl/readOFF.cpp
  31. 1 1
      tests/include/igl/squared_edge_lengths.cpp
  32. 1 1
      tests/include/igl/triangle_triangle_adjacency.cpp
  33. 1 1
      tests/include/igl/upsample.cpp
  34. 17 43
      tests/test_common.h

+ 1 - 1
tests/include/igl/avg_edge_length.cpp

@@ -10,7 +10,7 @@ TEST_CASE("avg_edge_length: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   //Create scaled versions of the cube
   //Create scaled versions of the cube
   double scale = 1.0;
   double scale = 1.0;
   double huge_scale = 1.0e8;
   double huge_scale = 1.0e8;

+ 2 - 2
tests/include/igl/boundary_loop.cpp

@@ -9,7 +9,7 @@ TEST_CASE("boundary_loop: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.off", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
 
 
   //Compute Boundary Loop
   //Compute Boundary Loop
   Eigen::VectorXi boundary;
   Eigen::VectorXi boundary;
@@ -24,7 +24,7 @@ TEST_CASE("boundary_loop: bunny", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //Load the Stanford bunny
   //Load the Stanford bunny
-  test_common::load_mesh("bunny.off", V, F);
+  igl::read_triangle_mesh(test_common::data_path("bunny.off"), V, F);
 
 
   //Compute list of ordered boundary loops for a manifold mesh
   //Compute list of ordered boundary loops for a manifold mesh
   std::vector<std::vector<int> >boundaries;
   std::vector<std::vector<int> >boundaries;

+ 4 - 4
tests/include/igl/copyleft/boolean/mesh_boolean.cpp

@@ -55,7 +55,7 @@ namespace {
 TEST_CASE("MeshBoolean: TwoCubes", "[igl/copyleft/boolean]") {
 TEST_CASE("MeshBoolean: TwoCubes", "[igl/copyleft/boolean]") {
     Eigen::MatrixXd V1;
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("two-boxes-bad-self-union.ply", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("two-boxes-bad-self-union.ply"), V1, F1);
 
 
     Eigen::MatrixXd V2(0, 3);
     Eigen::MatrixXd V2(0, 3);
     Eigen::MatrixXi F2(0, 3);
     Eigen::MatrixXi F2(0, 3);
@@ -76,8 +76,8 @@ TEST_CASE("MeshBoolean: MinusTest", "[igl/copyleft/boolean]") {
     // Many thanks to Eric Yao for submitting this test case.
     // Many thanks to Eric Yao for submitting this test case.
     Eigen::MatrixXd V1, V2, Vo;
     Eigen::MatrixXd V1, V2, Vo;
     Eigen::MatrixXi F1, F2, Fo;
     Eigen::MatrixXi F1, F2, Fo;
-    test_common::load_mesh("boolean_minus_test_cube.obj", V1, F1);
-    test_common::load_mesh("boolean_minus_test_green.obj", V2, F2);
+    igl::read_triangle_mesh(test_common::data_path("boolean_minus_test_cube.obj"), V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("boolean_minus_test_green.obj"), V2, F2);
 
 
     igl::copyleft::cgal::mesh_boolean(V1, F1, V2, F2,
     igl::copyleft::cgal::mesh_boolean(V1, F1, V2, F2,
             igl::MESH_BOOLEAN_TYPE_MINUS,
             igl::MESH_BOOLEAN_TYPE_MINUS,
@@ -91,7 +91,7 @@ TEST_CASE("MeshBoolean: MinusTest", "[igl/copyleft/boolean]") {
 TEST_CASE("MeshBoolean: IntersectWithSelf", "[igl/copyleft/boolean]") {
 TEST_CASE("MeshBoolean: IntersectWithSelf", "[igl/copyleft/boolean]") {
     Eigen::MatrixXd V1, Vo;
     Eigen::MatrixXd V1, Vo;
     Eigen::MatrixXi F1, Fo;
     Eigen::MatrixXi F1, Fo;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
 
     igl::copyleft::cgal::mesh_boolean(V1, F1, V1, F1,
     igl::copyleft::cgal::mesh_boolean(V1, F1, V1, F1,
             igl::MESH_BOOLEAN_TYPE_INTERSECT,
             igl::MESH_BOOLEAN_TYPE_INTERSECT,

+ 1 - 1
tests/include/igl/copyleft/cgal/CSGTree.cpp

@@ -5,7 +5,7 @@
 TEST_CASE("CSGTree: extrusion", "[igl/copyleft/cgal]") {
 TEST_CASE("CSGTree: extrusion", "[igl/copyleft/cgal]") {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("extrusion.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("extrusion.obj"), V, F);
     igl::copyleft::cgal::CSGTree tree(V, F);
     igl::copyleft::cgal::CSGTree tree(V, F);
     igl::copyleft::cgal::CSGTree inter(tree, tree, "i"); // returns error
     igl::copyleft::cgal::CSGTree inter(tree, tree, "i"); // returns error
 
 

+ 2 - 2
tests/include/igl/copyleft/cgal/hausdorff.cpp

@@ -9,8 +9,8 @@ TEST_CASE("hausdorff: knightVScheburashka", "[igl/copyleft/cgal]")
 {
 {
   Eigen::MatrixXd VA,VB;
   Eigen::MatrixXd VA,VB;
   Eigen::MatrixXi FA,FB;
   Eigen::MatrixXi FA,FB;
-  test_common::load_mesh("decimated-knight.obj", VA, FA);
-  test_common::load_mesh("cheburashka.off", VB, FB);
+  igl::read_triangle_mesh(test_common::data_path("decimated-knight.obj"), VA, FA);
+  igl::read_triangle_mesh(test_common::data_path("cheburashka.off"), VB, FB);
   //typedef CGAL::Epeck Kernel;
   //typedef CGAL::Epeck Kernel;
   typedef CGAL::Simple_cartesian<double> Kernel;
   typedef CGAL::Simple_cartesian<double> Kernel;
   CGAL::AABB_tree<
   CGAL::AABB_tree<

+ 2 - 2
tests/include/igl/copyleft/cgal/mesh_to_polyhedron.cpp

@@ -12,7 +12,7 @@ TEST_CASE(
   {
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     CGAL::Polyhedron_3<
     CGAL::Polyhedron_3<
       CGAL::Simple_cartesian<double>, 
       CGAL::Simple_cartesian<double>, 
       CGAL::Polyhedron_items_with_id_3, 
       CGAL::Polyhedron_items_with_id_3, 
@@ -31,7 +31,7 @@ TEST_CASE(
 {
 {
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
-  test_common::load_mesh("truck.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
   CGAL::Polyhedron_3<
   CGAL::Polyhedron_3<
     CGAL::Simple_cartesian<double>, 
     CGAL::Simple_cartesian<double>, 
     CGAL::Polyhedron_items_with_id_3, 
     CGAL::Polyhedron_items_with_id_3, 

+ 3 - 3
tests/include/igl/copyleft/cgal/order_facets_around_edges.cpp

@@ -54,7 +54,7 @@ void assert_order(
         Eigen::MatrixXd N;
         Eigen::MatrixXd N;
         //igl::per_face_normals_stable(V, F, N);
         //igl::per_face_normals_stable(V, F, N);
         //igl::per_face_normals(V, F, N);
         //igl::per_face_normals(V, F, N);
-        test_common::load_matrix(normal, N);
+        igl::readDMAT(test_common::data_path(normal), N);
         igl::copyleft::cgal::order_facets_around_edges(
         igl::copyleft::cgal::order_facets_around_edges(
           V, F, N, uE, uE2E, uE2oE, uE2C);
           V, F, N, uE, uE2E, uE2oE, uE2C);
     } else {
     } else {
@@ -192,9 +192,9 @@ TEST_CASE("copyleft_cgal_order_facets_around_edges: NormalSensitivity", "[igl/co
     // results in very different ordering of facets.
     // results in very different ordering of facets.
 
 
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
-    test_common::load_matrix("duplicated_faces_V.dmat", V);
+    igl::readDMAT(test_common::data_path("duplicated_faces_V.dmat"), V);
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_matrix("duplicated_faces_F.dmat", F);
+    igl::readDMAT(test_common::data_path("duplicated_faces_F.dmat"), F);
 
 
     assert_order(V, F, 223, 224, {2, 0, 3, 1}, "duplicated_faces_N1.dmat");
     assert_order(V, F, 223, 224, {2, 0, 3, 1}, "duplicated_faces_N1.dmat");
     assert_order(V, F, 223, 224, {0, 3, 2, 1}, "duplicated_faces_N2.dmat");
     assert_order(V, F, 223, 224, {0, 3, 2, 1}, "duplicated_faces_N2.dmat");

+ 5 - 5
tests/include/igl/copyleft/cgal/outer_facet.cpp

@@ -22,7 +22,7 @@ TEST_CASE("OuterFacet: Simple", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
 
     const size_t num_faces = F.rows();
     const size_t num_faces = F.rows();
 
 
@@ -41,7 +41,7 @@ TEST_CASE("OuterFacet: DuplicatedOppositeFaces", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F1);
 
 
     Eigen::MatrixXi F2 = F1;
     Eigen::MatrixXi F2 = F1;
     F2.col(0).swap(F2.col(1));
     F2.col(0).swap(F2.col(1));
@@ -64,7 +64,7 @@ TEST_CASE("OuterFacet: FullyDegnerated", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("degenerated.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("degenerated.obj"), V, F);
 
 
     Eigen::VectorXi I(F.rows());
     Eigen::VectorXi I(F.rows());
     I.setLinSpaced(F.rows(), 0, F.rows()-1);
     I.setLinSpaced(F.rows(), 0, F.rows()-1);
@@ -81,7 +81,7 @@ TEST_CASE("OuterFacet: InvertedNormal", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
     F.col(0).swap(F.col(1));
     F.col(0).swap(F.col(1));
 
 
     Eigen::VectorXi I(F.rows());
     Eigen::VectorXi I(F.rows());
@@ -99,7 +99,7 @@ TEST_CASE("OuterFacet: SliverTet", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("sliver_tet.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("sliver_tet.ply"), V, F);
 
 
     Eigen::VectorXi I(F.rows());
     Eigen::VectorXi I(F.rows());
     I.setLinSpaced(F.rows(), 0, F.rows()-1);
     I.setLinSpaced(F.rows(), 0, F.rows()-1);

+ 1 - 1
tests/include/igl/copyleft/cgal/outer_hull.cpp

@@ -7,7 +7,7 @@ TEST_CASE("OuterHull: CubeWithFold", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube_with_fold.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
 
 
     Eigen::MatrixXi G,J,flip;
     Eigen::MatrixXi G,J,flip;
     // Is this just checking that it doesn't crash?
     // Is this just checking that it doesn't crash?

+ 2 - 2
tests/include/igl/copyleft/cgal/peel_outer_hull_layers.cpp

@@ -15,7 +15,7 @@ TEST_CASE("copyleft_cgal_peel_outer_hull_layers: TwoCubes", "[igl/copyleft/cgal]
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("two-boxes-bad-self-union.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("two-boxes-bad-self-union.ply"), V, F);
     REQUIRE (V.rows() == 486);
     REQUIRE (V.rows() == 486);
     REQUIRE (F.rows() == 708);
     REQUIRE (F.rows() == 708);
 
 
@@ -55,7 +55,7 @@ TEST_CASE("PeelOuterHullLayers: CubeWithFold", "[igl/copyleft/cgal]")
 {
 {
     Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> V;
     Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube_with_fold.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
 
 
     typedef CGAL::Exact_predicates_exact_constructions_kernel K;
     typedef CGAL::Exact_predicates_exact_constructions_kernel K;
     typedef K::FT Scalar;
     typedef K::FT Scalar;

+ 3 - 3
tests/include/igl/copyleft/cgal/points_inside_component.cpp

@@ -7,7 +7,7 @@ TEST_CASE("PointInsideComponent: simple", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V1;
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
 
     Eigen::MatrixXd P(4, 3);
     Eigen::MatrixXd P(4, 3);
     P << 0.0, 0.0, 0.0,
     P << 0.0, 0.0, 0.0,
@@ -27,7 +27,7 @@ TEST_CASE("PointInsideComponent: near_boundary", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V1;
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
 
     const double EPS = std::numeric_limits<double>::epsilon();
     const double EPS = std::numeric_limits<double>::epsilon();
     Eigen::MatrixXd P(6, 3);
     Eigen::MatrixXd P(6, 3);
@@ -52,7 +52,7 @@ TEST_CASE("PointInsideComponent: near_corner", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V1;
     Eigen::MatrixXd V1;
     Eigen::MatrixXi F1;
     Eigen::MatrixXi F1;
-    test_common::load_mesh("cube.obj", V1, F1);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V1, F1);
 
 
     const double EPS = std::numeric_limits<double>::epsilon();
     const double EPS = std::numeric_limits<double>::epsilon();
     Eigen::MatrixXd P_out(8, 3);
     Eigen::MatrixXd P_out(8, 3);

+ 1 - 1
tests/include/igl/copyleft/cgal/remesh_self_intersections.cpp

@@ -10,7 +10,7 @@ TEST_CASE("RemeshSelfIntersections: CubeWithFold", "[igl/copyleft/cgal]")
 {
 {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh("cube_with_fold.ply", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube_with_fold.ply"), V, F);
 
 
     typedef CGAL::Exact_predicates_exact_constructions_kernel K;
     typedef CGAL::Exact_predicates_exact_constructions_kernel K;
     typedef Eigen::Matrix<K::FT, Eigen::Dynamic, Eigen::Dynamic> MatrixXe;
     typedef Eigen::Matrix<K::FT, Eigen::Dynamic, Eigen::Dynamic> MatrixXe;

+ 3 - 3
tests/include/igl/cotmatrix.cpp

@@ -10,7 +10,7 @@ TEST_CASE("cotmatrix: constant_in_null_space", "[igl]")
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
     Eigen::SparseMatrix<double> L;
     Eigen::SparseMatrix<double> L;
     // Load example mesh: GetParam() will be name of mesh file
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::cotmatrix(V,F,L);
     igl::cotmatrix(V,F,L);
     REQUIRE (L.rows() == V.rows());
     REQUIRE (L.rows() == V.rows());
     REQUIRE (L.cols() == L.rows());
     REQUIRE (L.cols() == L.rows());
@@ -33,7 +33,7 @@ TEST_CASE("cotmatrix: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
 
   //Scale the cube to have huge sides
   //Scale the cube to have huge sides
   Eigen::MatrixXd V_huge = V * 1.0e8;
   Eigen::MatrixXd V_huge = V * 1.0e8;
@@ -109,7 +109,7 @@ TEST_CASE("cotmatrix: tetrahedron", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
 
   //Prepare another mesh with triangles along side diagonals of the cube
   //Prepare another mesh with triangles along side diagonals of the cube
   //These triangles are form a regular tetrahedron of side sqrt(2)
   //These triangles are form a regular tetrahedron of side sqrt(2)

+ 2 - 2
tests/include/igl/cotmatrix_entries.cpp

@@ -12,7 +12,7 @@ TEST_CASE("cotmatrix_entries: simple", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
 
   //Prepare another mesh with triangles along side diagonals of the cube
   //Prepare another mesh with triangles along side diagonals of the cube
   //These triangles are form a regular tetrahedron of side sqrt(2)
   //These triangles are form a regular tetrahedron of side sqrt(2)
@@ -142,7 +142,7 @@ TEST_CASE("cotmatrix_entries: intrinsic", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   Eigen::MatrixXd Cext,Cint;
   Eigen::MatrixXd Cext,Cint;
   // compute C extrinsically
   // compute C extrinsically
   igl::cotmatrix_entries(V,F,Cext);
   igl::cotmatrix_entries(V,F,Cext);

+ 1 - 1
tests/include/igl/cotmatrix_intrinsic.cpp

@@ -67,7 +67,7 @@ TEST_CASE("cotmatrix_intrinsic: manifold_meshes", "[igl]")
   {
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     Eigen::MatrixXd l;
     Eigen::MatrixXd l;
     igl::edge_lengths(V,F,l);
     igl::edge_lengths(V,F,l);
     Eigen::SparseMatrix<double> L,Li;
     Eigen::SparseMatrix<double> L,Li;

+ 3 - 3
tests/include/igl/cut_to_disk.cpp

@@ -108,7 +108,7 @@ TEST_CASE("cut_to_disk: torus", "[igl]")
   using namespace igl;
   using namespace igl;
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
-  test_common::load_mesh("TinyTorus.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("TinyTorus.obj"), V, F);
 
 
   std::vector<std::vector<int>> cuts;
   std::vector<std::vector<int>> cuts;
   cut_to_disk(F, cuts);
   cut_to_disk(F, cuts);
@@ -122,7 +122,7 @@ TEST_CASE("cut_to_disk: cube", "[igl]")
   using namespace igl;
   using namespace igl;
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
 
   std::vector<std::vector<int>> cuts;
   std::vector<std::vector<int>> cuts;
   cut_to_disk(F, cuts);
   cut_to_disk(F, cuts);
@@ -136,7 +136,7 @@ TEST_CASE("cut_to_disk: annulus", "[igl]") {
   using namespace igl;
   using namespace igl;
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
-  test_common::load_mesh("annulus.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("annulus.obj"), V, F);
 
 
   std::vector<std::vector<int>> cuts;
   std::vector<std::vector<int>> cuts;
   cut_to_disk(F, cuts);
   cut_to_disk(F, cuts);

+ 2 - 2
tests/include/igl/decimate.cpp

@@ -22,7 +22,7 @@ TEST_CASE("decimate: hemisphere", "[igl]")
   Eigen::MatrixXi F,G;
   Eigen::MatrixXi F,G;
   Eigen::VectorXi J,I;
   Eigen::VectorXi J,I;
   // Load example mesh: GetParam() will be name of mesh file
   // Load example mesh: GetParam() will be name of mesh file
-  test_common::load_mesh("hemisphere.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("hemisphere.obj"), V, F);
   // Perfect normals from positions
   // Perfect normals from positions
   Eigen::MatrixXd NV = V.rowwise().normalized();
   Eigen::MatrixXd NV = V.rowwise().normalized();
   // Remove half of the faces
   // Remove half of the faces
@@ -48,7 +48,7 @@ TEST_CASE("decimate: closed", "[igl]")
     Eigen::MatrixXi F,G;
     Eigen::MatrixXi F,G;
     Eigen::VectorXi J;
     Eigen::VectorXi J;
     // Load example mesh: GetParam() will be name of mesh file
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::decimate(V,F,0,U,G,J);
     igl::decimate(V,F,0,U,G,J);
     REQUIRE (4 == U.rows());
     REQUIRE (4 == U.rows());
     REQUIRE (4 == G.rows());
     REQUIRE (4 == G.rows());

+ 1 - 1
tests/include/igl/dijkstra.cpp

@@ -8,7 +8,7 @@ TEST_CASE("dijkstra: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.off", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
 
 
   std::vector<std::vector<int>> VV;
   std::vector<std::vector<int>> VV;
   igl::adjacency_list(F, VV);
   igl::adjacency_list(F, VV);

+ 1 - 1
tests/include/igl/doublearea.cpp

@@ -8,7 +8,7 @@ TEST_CASE("doublearea: VF_vs_ABC", "[igl]")
     {
     {
       Eigen::MatrixXd V;
       Eigen::MatrixXd V;
       Eigen::MatrixXi F;
       Eigen::MatrixXi F;
-      test_common::load_mesh(param, V, F);
+      igl::read_triangle_mesh(test_common::data_path(param), V, F);
 
 
       // Check that computing double area with (V,F) is the same as computing
       // Check that computing double area with (V,F) is the same as computing
       // double area with (V1,V2,V2)
       // double area with (V1,V2,V2)

+ 1 - 1
tests/include/igl/edge_flaps.cpp

@@ -8,7 +8,7 @@ TEST_CASE("edge_flaps: verify", "[igl]")
 	{
 	{
 	  Eigen::MatrixXd V;
 	  Eigen::MatrixXd V;
 	  Eigen::MatrixXi F;
 	  Eigen::MatrixXi F;
-	  test_common::load_mesh(param, V, F);
+	  igl::read_triangle_mesh(test_common::data_path(param), V, F);
 
 
 	  Eigen::MatrixXi efE,efEF,efEI;
 	  Eigen::MatrixXi efE,efEF,efEI;
 	  Eigen::VectorXi efEMAP;
 	  Eigen::VectorXi efEMAP;

+ 1 - 1
tests/include/igl/edge_lengths.cpp

@@ -9,7 +9,7 @@ TEST_CASE("edge_lengths: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   //Create scaled versions of the cube
   //Create scaled versions of the cube
   double scale = 1.0;
   double scale = 1.0;
   double huge_scale = 1.0e8;
   double huge_scale = 1.0e8;

+ 1 - 1
tests/include/igl/embree/EmbreeIntersector.cpp

@@ -9,7 +9,7 @@ TEST_CASE("EmbreeIntersector: cube", "[igl/embree]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   // This is a cube of dimensions 1.0x1.0x1.0
   // This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
 
 
   // Initialize embree
   // Initialize embree
   igl::embree::EmbreeIntersector embree;
   igl::embree::EmbreeIntersector embree;

+ 1 - 1
tests/include/igl/intrinsic_delaunay_cotmatrix.cpp

@@ -43,7 +43,7 @@ TEST_CASE("intrinsic_delaunay_cotmatrix: manifold_meshes", "[igl]")
   {
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     Eigen::SparseMatrix<double> L;
     Eigen::SparseMatrix<double> L;
     Eigen::MatrixXi F_intrinsic;
     Eigen::MatrixXi F_intrinsic;
     Eigen::MatrixXd l_intrinsic;
     Eigen::MatrixXd l_intrinsic;

+ 2 - 2
tests/include/igl/is_edge_manifold.cpp

@@ -8,7 +8,7 @@ TEST_CASE("is_edge_manifold: positive", "[igl]")
   {
   {
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     REQUIRE ( igl::is_edge_manifold(F) );
     REQUIRE ( igl::is_edge_manifold(F) );
   };
   };
 
 
@@ -20,6 +20,6 @@ TEST_CASE("is_edge_manifold: negative", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   // Known non-manifold mesh
   // Known non-manifold mesh
-  test_common::load_mesh("truck.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
   REQUIRE (! igl::is_edge_manifold(F) );
   REQUIRE (! igl::is_edge_manifold(F) );
 }
 }

+ 1 - 1
tests/include/igl/is_irregular_vertex.cpp

@@ -7,7 +7,7 @@ TEST_CASE("is_irregular_vertex: simple", "[igl]")
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
     // Known "bad" mesh (many boundaries + irregular vertices, non-manifold)
     // Known "bad" mesh (many boundaries + irregular vertices, non-manifold)
-    test_common::load_mesh("truck.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("truck.obj"), V, F);
     std::vector<bool> vec = igl::is_irregular_vertex(V,F);
     std::vector<bool> vec = igl::is_irregular_vertex(V,F);
     // some vertices are irregular thus the sum over all vertices should evaluate to true
     // some vertices are irregular thus the sum over all vertices should evaluate to true
     REQUIRE(std::any_of(vec.begin(),vec.end(), [](bool v) { return v; }));
     REQUIRE(std::any_of(vec.begin(),vec.end(), [](bool v) { return v; }));

+ 1 - 1
tests/include/igl/iterative_closest_point.cpp

@@ -16,7 +16,7 @@ TEST_CASE("iterative_closest_point: identity","[igl]")
     Eigen::MatrixXd VX,VY;
     Eigen::MatrixXd VX,VY;
     Eigen::MatrixXi FX,FY;
     Eigen::MatrixXi FX,FY;
     // Load example mesh: GetParam() will be name of mesh file
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, VY, FY);
+    igl::read_triangle_mesh(test_common::data_path(param), VY, FY);
     VX = VY;
     VX = VY;
     FX = FY;
     FX = FY;
     // Single iteration should find a identity
     // Single iteration should find a identity

+ 1 - 1
tests/include/igl/per_face_normals.cpp

@@ -10,7 +10,7 @@ TEST_CASE("per_face_normals: dot", "[igl]")
 	  Eigen::MatrixXd V,N;
 	  Eigen::MatrixXd V,N;
 	  Eigen::MatrixXi F;
 	  Eigen::MatrixXi F;
 	  // Load example mesh: GetParam() will be name of mesh file
 	  // Load example mesh: GetParam() will be name of mesh file
-	  test_common::load_mesh(param, V, F);
+	  igl::read_triangle_mesh(test_common::data_path(param), V, F);
 	  igl::per_face_normals(V,F,N);
 	  igl::per_face_normals(V,F,N);
 	  REQUIRE (N.rows() == F.rows());
 	  REQUIRE (N.rows() == F.rows());
 	  for(int f = 0;f<N.rows();f++)
 	  for(int f = 0;f<N.rows();f++)

+ 2 - 2
tests/include/igl/readDMAT.cpp

@@ -3,8 +3,8 @@
 TEST_CASE("readDMAT: Comp", "[igl]")
 TEST_CASE("readDMAT: Comp", "[igl]")
 {
 {
     Eigen::MatrixXd N1, N2;
     Eigen::MatrixXd N1, N2;
-    test_common::load_matrix("duplicated_faces_N1.dmat", N1);
-    test_common::load_matrix("duplicated_faces_N2.dmat", N2);
+    igl::readDMAT(test_common::data_path("duplicated_faces_N1.dmat"), N1);
+    igl::readDMAT(test_common::data_path("duplicated_faces_N2.dmat"), N2);
 
 
     REQUIRE (N2.rows() == N1.rows());
     REQUIRE (N2.rows() == N1.rows());
     REQUIRE (N2.cols() == N1.cols());
     REQUIRE (N2.cols() == N1.cols());

+ 4 - 2
tests/include/igl/readOBJ.cpp

@@ -1,3 +1,4 @@
+#include <igl/readOBJ.h>
 #include <test_common.h>
 #include <test_common.h>
 #include <iostream>
 #include <iostream>
 #include <string>
 #include <string>
@@ -9,7 +10,7 @@ TEST_CASE("readOBJ: simple", "[igl]")
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
     // wait... so this is actually testing test_common::load_mesh not readOBJ
     // wait... so this is actually testing test_common::load_mesh not readOBJ
     // directly...
     // directly...
-    test_common::load_mesh("cube.obj", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
     REQUIRE (V.rows() == 8);
     REQUIRE (V.rows() == 8);
     REQUIRE (F.rows() == 12);
     REQUIRE (F.rows() == 12);
 }
 }
@@ -23,7 +24,8 @@ TEST_CASE("readOBJ: Obj with material", "[igl]")
     std::vector<std::vector<int > > FTC;
     std::vector<std::vector<int > > FTC;
     std::vector<std::vector<int > >  FN;
     std::vector<std::vector<int > >  FN;
     std::vector<std::tuple<std::string, int, int>> FM;
     std::vector<std::tuple<std::string, int, int>> FM;
-    test_common::load_obj_with_material<double, int>("cubewithmaterial.obj", V, TC, N, F, FTC, FN, FM);
+    igl::readOBJ(test_common::data_path("cubewithmaterial.obj"), V, TC, N, F, FTC, FN, FM);
+
     REQUIRE (V.size() == 8);
     REQUIRE (V.size() == 8);
     REQUIRE (F.size() == 6);
     REQUIRE (F.size() == 6);
     for ( const auto& i : FM ) {
     for ( const auto& i : FM ) {

+ 1 - 1
tests/include/igl/readOFF.cpp

@@ -6,7 +6,7 @@ TEST_CASE("readOFF: simple", "[igl]")
     Eigen::MatrixXi F;
     Eigen::MatrixXi F;
     // wait... so this is actually testing test_common::load_mesh not readOFF
     // wait... so this is actually testing test_common::load_mesh not readOFF
     // directly...
     // directly...
-    test_common::load_mesh("cube.off", V, F);
+    igl::read_triangle_mesh(test_common::data_path("cube.off"), V, F);
     REQUIRE (V.rows() == 8);
     REQUIRE (V.rows() == 8);
     REQUIRE (V.cols() == 3);
     REQUIRE (V.cols() == 3);
     REQUIRE (F.rows() == 12);
     REQUIRE (F.rows() == 12);

+ 1 - 1
tests/include/igl/squared_edge_lengths.cpp

@@ -10,7 +10,7 @@ TEST_CASE("squared_edge_lengths: cube", "[igl]")
   Eigen::MatrixXd V;
   Eigen::MatrixXd V;
   Eigen::MatrixXi F;
   Eigen::MatrixXi F;
   //This is a cube of dimensions 1.0x1.0x1.0
   //This is a cube of dimensions 1.0x1.0x1.0
-  test_common::load_mesh("cube.obj", V, F);
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
   //Create scaled versions of the cube
   //Create scaled versions of the cube
   double scale = 1.0;
   double scale = 1.0;
   double huge_scale = 1.0e8;
   double huge_scale = 1.0e8;

+ 1 - 1
tests/include/igl/triangle_triangle_adjacency.cpp

@@ -11,7 +11,7 @@ TEST_CASE("triangle_triangle_adjacency: dot", "[igl]")
     Eigen::MatrixXd V;
     Eigen::MatrixXd V;
     Eigen::MatrixXi F,TT,TTi;
     Eigen::MatrixXi F,TT,TTi;
     // Load example mesh: GetParam() will be name of mesh file
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::triangle_triangle_adjacency(F,TT,TTi);
     igl::triangle_triangle_adjacency(F,TT,TTi);
     REQUIRE (TT.rows() == F.rows());
     REQUIRE (TT.rows() == F.rows());
     REQUIRE (TTi.rows() == F.rows());
     REQUIRE (TTi.rows() == F.rows());

+ 1 - 1
tests/include/igl/upsample.cpp

@@ -34,7 +34,7 @@ TEST_CASE("upsample: V_comes_first_F_ordering", "[igl]")
     Eigen::MatrixXd V,NV;
     Eigen::MatrixXd V,NV;
     Eigen::MatrixXi F,NF;
     Eigen::MatrixXi F,NF;
     // Load example mesh: GetParam() will be name of mesh file
     // Load example mesh: GetParam() will be name of mesh file
-    test_common::load_mesh(param, V, F);
+    igl::read_triangle_mesh(test_common::data_path(param), V, F);
     igl::upsample(V,F,NV,NF);
     igl::upsample(V,F,NV,NF);
     REQUIRE (V.rows() <= NV.rows());
     REQUIRE (V.rows() <= NV.rows());
     REQUIRE (4*F.rows() == NF.rows());
     REQUIRE (4*F.rows() == NF.rows());

+ 17 - 43
tests/test_common.h

@@ -1,10 +1,12 @@
 #pragma once
 #pragma once
 
 
 
 
+// These are not directly used but would otherwise be included in most files.
+// Leaving them included here. 
 #include <igl/read_triangle_mesh.h>
 #include <igl/read_triangle_mesh.h>
-#include <igl/find.h>
 #include <igl/readDMAT.h>
 #include <igl/readDMAT.h>
-#include <igl/readOBJ.h>
+
+#include <igl/find.h>
 
 
 #include <Eigen/Core>
 #include <Eigen/Core>
 #include <catch2/catch.hpp>
 #include <catch2/catch.hpp>
@@ -21,7 +23,20 @@ namespace test_common
   void run_test_cases(const std::vector<Param> &params,  Fun test_case)
   void run_test_cases(const std::vector<Param> &params,  Fun test_case)
   {
   {
     for(const auto &p : params)
     for(const auto &p : params)
+    {
+      // Can't use INFO( p ) because we're not sure how to print p
       test_case(p);
       test_case(p);
+    }
+  }
+
+  template<typename Fun>
+  void run_test_cases(const std::vector<std::string> &params,  Fun test_case)
+  {
+    for(const auto &p : params)
+    {
+      INFO( p );
+      test_case(p);
+    }
   }
   }
 
 
   inline std::vector<std::string> closed_genus_0_meshes()
   inline std::vector<std::string> closed_genus_0_meshes()
@@ -75,47 +90,6 @@ namespace test_common
     return std::string(LIBIGL_DATA_DIR) + "/" + s;
     return std::string(LIBIGL_DATA_DIR) + "/" + s;
   };
   };
 
 
-  // TODO: this seems like a pointless indirection. Should just find and
-  // replace test_common::load_mesh(X,...) with
-  // igl::read_triangle_mesh(test_common::data_path(X),...)
-  template<typename DerivedV, typename DerivedF>
-  void load_mesh(
-    const std::string& filename,
-    Eigen::PlainObjectBase<DerivedV>& V,
-    Eigen::PlainObjectBase<DerivedF>& F)
-  {
-    igl::read_triangle_mesh(data_path(filename), V, F);
-  }
-
-  template<typename DerivedV, typename DerivedF>
-  void load_obj_with_material(
-    const std::string& filename,
-    std::vector<std::vector<DerivedV >> & V,
-    std::vector<std::vector<DerivedV >> & TC,
-    std::vector<std::vector<DerivedV >> & N,
-    std::vector<std::vector<DerivedF >> & F,
-    std::vector<std::vector<DerivedF >> & FTC,
-    std::vector<std::vector<DerivedF >> & FN,
-    std::vector<std::tuple<std::string, DerivedF, DerivedF >> &FM)
-  {
-    igl::readOBJ(data_path(filename), V, TC, N, F, FTC, FN, FM);
-  }
-
-
-
-
-
-  // TODO: this seems like a pointless indirection. Should just find and
-  // replace test_common::load_matrix(X,...) with
-  // igl::readDMAT(test_common::data_path(X),...)
-  template<typename Derived>
-  void load_matrix(
-    const std::string& filename,
-    Eigen::PlainObjectBase<Derived>& M)
-  {
-    igl::readDMAT(data_path(filename), M);
-  }
-
   template <typename DerivedA, typename DerivedB>
   template <typename DerivedA, typename DerivedB>
   void assert_eq(
   void assert_eq(
     const Eigen::MatrixBase<DerivedA> & A,
     const Eigen::MatrixBase<DerivedA> & A,