소스 검색

Remove hard coded paths from TestHelper class

- removed hardcoded OS specific test locations, since they are now detected by the project itself
- adjusted README.md file description for running tests, which is now more simple
Patrick-Christopher Mattulat 3 년 전
부모
커밋
efd4ca359a
2개의 변경된 파일7개의 추가작업 그리고 30개의 파일을 삭제
  1. 2 3
      README.md
  2. 5 27
      test/TestHelper.hpp

+ 2 - 3
README.md

@@ -118,6 +118,5 @@ target_link_libraries(... "path/to/this/library/../libls_std_YYYY.MAJOR.MINOR.dl
 
 ### Testing ###
 
-This project contains unit tests to accomplish test coverage.  
-To run those unit tests you have to adjust __TestHelper__ class by adding your personal test folder path to __getTestFolderLocation__ method.  
-There you have to adjust __location__ variable based on the operating system you're using.
+This project contains unit tests to provide test coverage.  
+To run those tests you have to build this project with option __LS_STD_BUILD_WITH_TESTS__ set to __ON__.

+ 5 - 27
test/TestHelper.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-15
- * Changed:         2021-04-23
+ * Changed:         2021-09-26
  *
  * */
 
@@ -11,6 +11,7 @@
 #define TEST_HELPER_HPP
 
 #include <string>
+#include <ls_std/ls_std.hpp>
 
 class TestHelper
 {
@@ -21,36 +22,13 @@ class TestHelper
 
     static std::string getResourcesFolderLocation()
     {
-      std::string location{};
-
-      #ifdef _WIN32
-      location = TestHelper::getTestFolderLocation() + R"(resources\)";
-      #endif
-      #ifdef unix
-      location = TestHelper::getTestFolderLocation() + R"(resources/)";
-      #endif
-      #ifdef __APPLE__
-      location = TestHelper::getTestFolderLocation() + R"(resources/)";
-      #endif
-
-      return location;
+      return TestHelper::getTestFolderLocation() + "resources" + ls_std::FilePathSeparator::get();
     }
 
     static std::string getTestFolderLocation()
     {
-      std::string location{};
-
-      #ifdef _WIN32
-      location = R"(C:\Users\drums\CLionProjects\lynar-studios-standard-library\test\)";
-      #endif
-      #ifdef unix
-      location = R"(/home/patrick/CLionProjects/lynar-studios-standard-library/test/)";
-      #endif
-      #ifdef __APPLE__
-      location = R"(/Users/patrickmattulat/CLionProjects/lynar-studios-standard-library/test/)";
-      #endif
-
-      return location;
+      ls_std::File buildDirectory{ls_std::File::getWorkingDirectory()};
+      return buildDirectory.getParent() + "test" + ls_std::FilePathSeparator::get();
     }
 };