Create function getProcessPath and add unit test for it

Debugging: Relative and Absolute path alternatives
This commit is contained in:
Luis Díaz Más
2018-11-09 06:53:31 +01:00
parent 3009cc4c0c
commit 7485bb54d7
4 changed files with 67 additions and 4 deletions
+14
View File
@@ -153,3 +153,17 @@ TEST(AUri, parsesAndDecoreUrl)
Uri::Decode(uri);
}
TEST(getProcessPath, obtainPathOfUnitTestsExecutable)
{
#ifdef _WIN32
const std::string expectedName("bin");
#else
const std::string expectedName("bin");
#endif
const std::string path = getProcessPath();
ASSERT_FALSE(path.empty());
const size_t idxStart = path.size() - expectedName.size();
ASSERT_EQ(expectedName, path.substr(idxStart, expectedName.size()));
}