sfizz/tests/MainT.cpp

31 lines
751 B
C++
Raw Permalink Normal View History

2020-06-02 16:04:21 +02:00
#include "sfizz/SIMDHelpers.h"
#define CATCH_CONFIG_RUNNER
#include "catch2/catch.hpp"
2021-03-18 00:42:04 +01:00
#include <ghc/fs_std.hpp>
static bool moveToTestsDirectory(const fs::path& searchedPath);
2020-06-02 16:04:21 +02:00
int main(int argc, char* argv[])
{
2021-03-18 00:42:04 +01:00
if (!moveToTestsDirectory(fs::u8path("tests/TestFiles"))) {
std::cerr << "Failed to locate test files\n";
return 1;
}
2020-06-02 16:04:21 +02:00
int result = Catch::Session().run(argc, argv);
return result;
}
2021-03-18 00:42:04 +01:00
static bool moveToTestsDirectory(const fs::path& searchedPath)
{
while (!fs::exists(searchedPath)) {
fs::path cwdPath = fs::current_path();
fs::path newPath = cwdPath.parent_path();
if (cwdPath == newPath)
return false;
fs::current_path(newPath);
}
return true;
}