Browse Source

fix unit test for path_to_executable() on windows by taking into account that it has a '.exe' suffix.

Nico Brügel 6 years ago
parent
commit
1408bd36b0
1 changed files with 4 additions and 4 deletions
  1. 4 4
      tests/include/igl/path_to_executable.cpp

+ 4 - 4
tests/include/igl/path_to_executable.cpp

@@ -8,8 +8,8 @@ TEST_CASE("path_to_executable: example", "[igl]")
 {
 {
   std::string path_to_executable = igl::path_to_executable();
   std::string path_to_executable = igl::path_to_executable();
   REQUIRE(0 < path_to_executable.size());
   REQUIRE(0 < path_to_executable.size());
-  // check if path_to_executable ends with correct file name
-  std::string ending = "libigl_tests";
-  REQUIRE(ending.size() < path_to_executable.size());
-  REQUIRE(std::equal(ending.rbegin(), ending.rend(), path_to_executable.rbegin()));
+  // check if path_to_executable ends with correct file name, on windows .exe suffix is added.
+  std::string executable = "libigl_tests";
+  int pos = path_to_executable.length()-(executable.length() + 4/*".exe"*/);
+  REQUIRE( std::string::npos != path_to_executable.find(executable, pos));
 }
 }