guess_extension.cpp 715 B

1234567891011121314151617181920212223242526
  1. #include <test_common.h>
  2. #include <igl/guess_extension.h>
  3. #include <igl/pathinfo.h>
  4. #include <cstdio>
  5. TEST_CASE("guess_extension: all_meshes", "[igl]")
  6. {
  7. const auto test_case = [](const std::string &param)
  8. {
  9. Eigen::MatrixXd V;
  10. Eigen::MatrixXi F;
  11. std::string path(test_common::data_path(param));
  12. // Load example mesh: GetParam() will be name of mesh file
  13. std::string d,b,e,f;
  14. igl::pathinfo(path,d,b,e,f);
  15. // Convert extension to lower case
  16. std::transform(e.begin(), e.end(), e.begin(), ::tolower);
  17. FILE * fp = fopen(path.c_str(),"r");
  18. std::string guess = igl::guess_extension(fp);
  19. REQUIRE (e == guess);
  20. };
  21. test_common::run_test_cases(test_common::all_meshes(), test_case);
  22. }