Create path for TestbedFilesTest relative to build folder

This commit is contained in:
Jan Niklas Hasse 2019-03-12 13:38:06 +01:00
parent 0898bb217d
commit 3a2db01407
2 changed files with 5 additions and 4 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ build/
# Visual Studio Code
/.vscode/*cache*
/.ccls-cache/
/compile_commands.json

View File

@ -46,10 +46,9 @@ BOOST_AUTO_TEST_CASE(TestbedFilesTest)
// Load pointset from file
// Parse and tokenize data file
std::string line;
std::ifstream myfile(std::string("../testbed/data/") + filename);
if (!myfile.is_open()) {
myfile.open(std::string("testbed/data/") + filename);
}
const std::string src(__FILE__); // ../unittest/main.cpp
auto folder = src.substr(0, src.find_last_of('/')) + "/../testbed/data/";
std::ifstream myfile(folder + filename);
BOOST_REQUIRE(myfile.is_open());
while (!myfile.eof()) {
getline(myfile, line);