mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-12-27 12:31:50 +00:00
chore: add simple iw3 system test
This commit is contained in:
@@ -24,4 +24,13 @@ namespace oat::paths
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::filesystem::path GetTempDirectory(const std::string& subDir)
|
||||
{
|
||||
auto result = fs::current_path() / "build" / ".tmp" / subDir;
|
||||
if (!fs::is_directory(result))
|
||||
fs::create_directories(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
} // namespace oat::paths
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
namespace oat::paths
|
||||
{
|
||||
std::filesystem::path GetSourceDirectory();
|
||||
std::filesystem::path GetTestDirectory();
|
||||
std::filesystem::path GetTempDirectory();
|
||||
std::filesystem::path GetTempDirectory(const std::string& subDir);
|
||||
} // namespace oat::paths
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <catch2/catch_session.hpp>
|
||||
#include <filesystem>
|
||||
#include <format>
|
||||
@@ -7,6 +9,9 @@ namespace fs = std::filesystem;
|
||||
|
||||
int main(const int argc, char* argv[])
|
||||
{
|
||||
con::init();
|
||||
con::set_log_level(con::LogLevel::DEBUG);
|
||||
|
||||
const fs::path absoluteBinDir(fs::canonical(argv[0]).parent_path());
|
||||
|
||||
const auto expectedLibDir = absoluteBinDir.parent_path().parent_path();
|
||||
@@ -15,24 +20,24 @@ int main(const int argc, char* argv[])
|
||||
|
||||
if (absoluteBinDir.filename() != "tests" || expectedLibDir.filename() != "lib" || expectedBuildDir.filename() != "build")
|
||||
{
|
||||
std::cerr << std::format("Expected test binary to be in the folder it was compiled into (build/lib/?/tests) but was {}\n", absoluteBinDir.string());
|
||||
std::cerr << "Please do not move test executable out of compilation folder\n";
|
||||
con::error("Expected test binary to be in the folder it was compiled into (build/lib/?/tests) but was {}", absoluteBinDir.string());
|
||||
con::error("Please do not move test executable out of compilation folder");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const auto expectedSrcDir = expectedRootDir / "src";
|
||||
if (!fs::is_directory(expectedSrcDir))
|
||||
{
|
||||
std::cerr << std::format("Expected source directory to exist in {}, but it did not\n", expectedSrcDir.string());
|
||||
std::cerr << "Please do not move test executable out of compilation folder\n";
|
||||
con::error("Expected source directory to exist in {}, but it did not", expectedSrcDir.string());
|
||||
con::error("Please do not move test executable out of compilation folder");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const auto expectedTestDir = expectedRootDir / "test";
|
||||
if (!fs::is_directory(expectedTestDir))
|
||||
{
|
||||
std::cerr << std::format("Expected test directory to exist in {}, but it did not\n", expectedTestDir.string());
|
||||
std::cerr << "Please do not move test executable out of compilation folder\n";
|
||||
con::error("Expected test directory to exist in {}, but it did not", expectedTestDir.string());
|
||||
con::error("Please do not move test executable out of compilation folder");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user