stuff-from-scratch/test/test_utils/TestUtils.h

28 lines
593 B
C
Raw Normal View History

2022-12-01 10:52:48 +00:00
#pragma once
#include <filesystem>
using Path = std::filesystem::path;
class TestUtils
{
public:
2022-12-06 18:02:43 +00:00
static Path getTestOutputDir(const std::string& testFileName = {})
2022-12-01 10:52:48 +00:00
{
2022-12-06 18:02:43 +00:00
if (!testFileName.empty())
{
const auto name = Path(testFileName).filename().stem();
return std::filesystem::current_path() / "test_output" / name;
}
else
{
return std::filesystem::current_path() / "test_output";
}
2022-12-01 10:52:48 +00:00
}
static Path getTestDataDir()
{
return std::filesystem::current_path() / "test_data";
}
};