tet_tet_adjacency.cpp 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <test_common.h>
  2. #include <igl/tet_tet_adjacency.h>
  3. #include <igl/readMESH.h>
  4. #include <iostream>
  5. class tet_tet_adjacency : public ::testing::TestWithParam<std::string> {};
  6. TEST_P(tet_tet_adjacency, dot)
  7. {
  8. Eigen::MatrixXd V;
  9. Eigen::MatrixXi F, T, TT,TTi;
  10. // Load example mesh: GetParam() will be name of mesh file
  11. igl::readMESH(test_common::data_path(GetParam()), V, T, F);
  12. igl::tet_tet_adjacency(T, TT, TTi);
  13. ASSERT_EQ(T.rows(), TT.rows());
  14. ASSERT_EQ(T.rows(), TTi.rows());
  15. ASSERT_EQ(T.cols(),TT.cols());
  16. ASSERT_EQ(T.cols(),TTi.cols());
  17. for(int t = 0;t<T.rows();t++)
  18. {
  19. for(int c = 0; c<4 ;c++)
  20. {
  21. if(TT(t, c) >= 0)
  22. {
  23. ASSERT_LT(TT(t, c), T.rows());
  24. ASSERT_GE(TTi(t, c), 0);
  25. ASSERT_LT(TTi(t, c), 4);
  26. ASSERT_EQ(TT(TT(t, c), TTi(t,c)) , t);
  27. }
  28. }
  29. }
  30. }
  31. INSTANTIATE_TEST_CASE_P
  32. (
  33. tet_meshes,
  34. tet_tet_adjacency,
  35. ::testing::ValuesIn(test_common::tet_meshes()),
  36. test_common::string_test_name
  37. );