2
0
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:
Jan Laupetin
2025-12-23 12:49:49 +01:00
parent a1693b2eb8
commit 5f04decacc
11 changed files with 102 additions and 6 deletions

View File

@@ -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;
}