From 0fe942b80dd0b2cdac96de23673d6f9345271fdb Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Tue, 23 Dec 2025 16:26:40 +0100 Subject: [PATCH] chore: add simple system tests for remaining games --- test/SystemTests/Game/IW3/SimpleZoneIW3.cpp | 17 +++++ test/SystemTests/Game/IW4/SimpleZoneIW4.cpp | 62 +++++++++++++++++++ .../Game/IW4/simple/SimpleZone.txt | 1 + .../Game/IW4/simple/SimpleZoneIW4.zone | 4 ++ test/SystemTests/Game/IW5/SimpleZoneIW5.cpp | 62 +++++++++++++++++++ .../Game/IW5/simple/SimpleZone.txt | 1 + .../Game/IW5/simple/SimpleZoneIW5.zone | 4 ++ test/SystemTests/Game/T5/SimpleZoneT5.cpp | 62 +++++++++++++++++++ .../SystemTests/Game/T5/simple/SimpleZone.txt | 1 + .../Game/T5/simple/SimpleZoneT5.zone | 4 ++ test/SystemTests/Game/T6/SimpleZoneT6.cpp | 62 +++++++++++++++++++ .../SystemTests/Game/T6/simple/SimpleZone.txt | 1 + .../Game/T6/simple/SimpleZoneT6.zone | 4 ++ 13 files changed, 285 insertions(+) create mode 100644 test/SystemTests/Game/IW4/SimpleZoneIW4.cpp create mode 100644 test/SystemTests/Game/IW4/simple/SimpleZone.txt create mode 100644 test/SystemTests/Game/IW4/simple/SimpleZoneIW4.zone create mode 100644 test/SystemTests/Game/IW5/SimpleZoneIW5.cpp create mode 100644 test/SystemTests/Game/IW5/simple/SimpleZone.txt create mode 100644 test/SystemTests/Game/IW5/simple/SimpleZoneIW5.zone create mode 100644 test/SystemTests/Game/T5/SimpleZoneT5.cpp create mode 100644 test/SystemTests/Game/T5/simple/SimpleZone.txt create mode 100644 test/SystemTests/Game/T5/simple/SimpleZoneT5.zone create mode 100644 test/SystemTests/Game/T6/SimpleZoneT6.cpp create mode 100644 test/SystemTests/Game/T6/simple/SimpleZone.txt create mode 100644 test/SystemTests/Game/T6/simple/SimpleZoneT6.zone diff --git a/test/SystemTests/Game/IW3/SimpleZoneIW3.cpp b/test/SystemTests/Game/IW3/SimpleZoneIW3.cpp index f60ec550..45c11792 100644 --- a/test/SystemTests/Game/IW3/SimpleZoneIW3.cpp +++ b/test/SystemTests/Game/IW3/SimpleZoneIW3.cpp @@ -1,12 +1,16 @@ +#include "Game/IW3/GameAssetPoolIW3.h" #include "Linker.h" #include "OatTestPaths.h" #include "SystemTestsPaths.h" +#include "ZoneLoading.h" #include +#include #include #include #include +namespace fs = std::filesystem; using namespace std::literals; namespace @@ -41,5 +45,18 @@ namespace const auto linkerResult = linker->Start(); REQUIRE(linkerResult); + + const auto expectedZonePath = (fs::path(outputPath) / "SimpleZoneIW3.ff").string(); + auto maybeZone = ZoneLoading::LoadZone(expectedZonePath, std::nullopt); + REQUIRE(maybeZone); + + auto zone = std::move(*maybeZone); + auto pools = dynamic_cast(zone->m_pools.get()); + + REQUIRE(zone->m_game_id == GameId::IW3); + REQUIRE(zone->m_platform == GamePlatform::PC); + REQUIRE(zone->m_name == "SimpleZoneIW3"); + REQUIRE(pools->GetTotalAssetCount() == 1); + REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt")); } } // namespace diff --git a/test/SystemTests/Game/IW4/SimpleZoneIW4.cpp b/test/SystemTests/Game/IW4/SimpleZoneIW4.cpp new file mode 100644 index 00000000..0b732c94 --- /dev/null +++ b/test/SystemTests/Game/IW4/SimpleZoneIW4.cpp @@ -0,0 +1,62 @@ +#include "Game/IW4/GameAssetPoolIW4.h" +#include "Linker.h" +#include "OatTestPaths.h" +#include "SystemTestsPaths.h" +#include "ZoneLoading.h" + +#include +#include +#include +#include +#include + +namespace fs = std::filesystem; +using namespace std::literals; + +namespace +{ + TEST_CASE("Simple Zone(IW4)", "[iw4][system][simple]") + { + const auto assetSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/IW4/simple").string(); + const auto sourceSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/IW4/simple").string(); + const auto outputPath = oat::paths::GetTempDirectory("iw4_simple").string(); + + const char* argStrings[]{ + "SystemTests", // bin + "--verbose", + "--asset-search-path", + assetSearchPath.c_str(), + "--source-search-path", + sourceSearchPath.c_str(), + "--output-folder", + outputPath.c_str(), + "SimpleZoneIW4", + }; + + LinkerArgs args; + + bool shouldContinue = true; + const auto couldParseArgs = args.ParseArgs(std::extent_v, argStrings, shouldContinue); + + REQUIRE(couldParseArgs); + REQUIRE(shouldContinue); + + const auto linker = Linker::Create(std::move(args)); + const auto linkerResult = linker->Start(); + + REQUIRE(linkerResult); + + const auto expectedZonePath = (fs::path(outputPath) / "SimpleZoneIW4.ff").string(); + auto maybeZone = ZoneLoading::LoadZone(expectedZonePath, std::nullopt); + REQUIRE(maybeZone); + + auto zone = std::move(*maybeZone); + auto pools = dynamic_cast(zone->m_pools.get()); + + REQUIRE(zone->m_game_id == GameId::IW4); + REQUIRE(zone->m_platform == GamePlatform::PC); + REQUIRE(zone->m_name == "SimpleZoneIW4"); + REQUIRE(pools->GetTotalAssetCount() == 1); + REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt")); + } +} // namespace diff --git a/test/SystemTests/Game/IW4/simple/SimpleZone.txt b/test/SystemTests/Game/IW4/simple/SimpleZone.txt new file mode 100644 index 00000000..aea46cd0 --- /dev/null +++ b/test/SystemTests/Game/IW4/simple/SimpleZone.txt @@ -0,0 +1 @@ +This is a simple zone. diff --git a/test/SystemTests/Game/IW4/simple/SimpleZoneIW4.zone b/test/SystemTests/Game/IW4/simple/SimpleZoneIW4.zone new file mode 100644 index 00000000..bdb55ff4 --- /dev/null +++ b/test/SystemTests/Game/IW4/simple/SimpleZoneIW4.zone @@ -0,0 +1,4 @@ +>game,IW4 + +rawfile,SimpleZone.txt + diff --git a/test/SystemTests/Game/IW5/SimpleZoneIW5.cpp b/test/SystemTests/Game/IW5/SimpleZoneIW5.cpp new file mode 100644 index 00000000..57376800 --- /dev/null +++ b/test/SystemTests/Game/IW5/SimpleZoneIW5.cpp @@ -0,0 +1,62 @@ +#include "Game/IW5/GameAssetPoolIW5.h" +#include "Linker.h" +#include "OatTestPaths.h" +#include "SystemTestsPaths.h" +#include "ZoneLoading.h" + +#include +#include +#include +#include +#include + +namespace fs = std::filesystem; +using namespace std::literals; + +namespace +{ + TEST_CASE("Simple Zone(IW5)", "[iw5][system][simple]") + { + const auto assetSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/IW5/simple").string(); + const auto sourceSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/IW5/simple").string(); + const auto outputPath = oat::paths::GetTempDirectory("iw5_simple").string(); + + const char* argStrings[]{ + "SystemTests", // bin + "--verbose", + "--asset-search-path", + assetSearchPath.c_str(), + "--source-search-path", + sourceSearchPath.c_str(), + "--output-folder", + outputPath.c_str(), + "SimpleZoneIW5", + }; + + LinkerArgs args; + + bool shouldContinue = true; + const auto couldParseArgs = args.ParseArgs(std::extent_v, argStrings, shouldContinue); + + REQUIRE(couldParseArgs); + REQUIRE(shouldContinue); + + const auto linker = Linker::Create(std::move(args)); + const auto linkerResult = linker->Start(); + + REQUIRE(linkerResult); + + const auto expectedZonePath = (fs::path(outputPath) / "SimpleZoneIW5.ff").string(); + auto maybeZone = ZoneLoading::LoadZone(expectedZonePath, std::nullopt); + REQUIRE(maybeZone); + + auto zone = std::move(*maybeZone); + auto pools = dynamic_cast(zone->m_pools.get()); + + REQUIRE(zone->m_game_id == GameId::IW5); + REQUIRE(zone->m_platform == GamePlatform::PC); + REQUIRE(zone->m_name == "SimpleZoneIW5"); + REQUIRE(pools->GetTotalAssetCount() == 1); + REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt")); + } +} // namespace diff --git a/test/SystemTests/Game/IW5/simple/SimpleZone.txt b/test/SystemTests/Game/IW5/simple/SimpleZone.txt new file mode 100644 index 00000000..aea46cd0 --- /dev/null +++ b/test/SystemTests/Game/IW5/simple/SimpleZone.txt @@ -0,0 +1 @@ +This is a simple zone. diff --git a/test/SystemTests/Game/IW5/simple/SimpleZoneIW5.zone b/test/SystemTests/Game/IW5/simple/SimpleZoneIW5.zone new file mode 100644 index 00000000..0c35d8b6 --- /dev/null +++ b/test/SystemTests/Game/IW5/simple/SimpleZoneIW5.zone @@ -0,0 +1,4 @@ +>game,IW5 + +rawfile,SimpleZone.txt + diff --git a/test/SystemTests/Game/T5/SimpleZoneT5.cpp b/test/SystemTests/Game/T5/SimpleZoneT5.cpp new file mode 100644 index 00000000..790bb1aa --- /dev/null +++ b/test/SystemTests/Game/T5/SimpleZoneT5.cpp @@ -0,0 +1,62 @@ +#include "Game/T5/GameAssetPoolT5.h" +#include "Linker.h" +#include "OatTestPaths.h" +#include "SystemTestsPaths.h" +#include "ZoneLoading.h" + +#include +#include +#include +#include +#include + +namespace fs = std::filesystem; +using namespace std::literals; + +namespace +{ + TEST_CASE("Simple Zone(T5)", "[t5][system][simple]") + { + const auto assetSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/T5/simple").string(); + const auto sourceSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/T5/simple").string(); + const auto outputPath = oat::paths::GetTempDirectory("t5_simple").string(); + + const char* argStrings[]{ + "SystemTests", // bin + "--verbose", + "--asset-search-path", + assetSearchPath.c_str(), + "--source-search-path", + sourceSearchPath.c_str(), + "--output-folder", + outputPath.c_str(), + "SimpleZoneT5", + }; + + LinkerArgs args; + + bool shouldContinue = true; + const auto couldParseArgs = args.ParseArgs(std::extent_v, argStrings, shouldContinue); + + REQUIRE(couldParseArgs); + REQUIRE(shouldContinue); + + const auto linker = Linker::Create(std::move(args)); + const auto linkerResult = linker->Start(); + + REQUIRE(linkerResult); + + const auto expectedZonePath = (fs::path(outputPath) / "SimpleZoneT5.ff").string(); + auto maybeZone = ZoneLoading::LoadZone(expectedZonePath, std::nullopt); + REQUIRE(maybeZone); + + auto zone = std::move(*maybeZone); + auto pools = dynamic_cast(zone->m_pools.get()); + + REQUIRE(zone->m_game_id == GameId::T5); + REQUIRE(zone->m_platform == GamePlatform::PC); + REQUIRE(zone->m_name == "SimpleZoneT5"); + REQUIRE(pools->GetTotalAssetCount() == 1); + REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt")); + } +} // namespace diff --git a/test/SystemTests/Game/T5/simple/SimpleZone.txt b/test/SystemTests/Game/T5/simple/SimpleZone.txt new file mode 100644 index 00000000..aea46cd0 --- /dev/null +++ b/test/SystemTests/Game/T5/simple/SimpleZone.txt @@ -0,0 +1 @@ +This is a simple zone. diff --git a/test/SystemTests/Game/T5/simple/SimpleZoneT5.zone b/test/SystemTests/Game/T5/simple/SimpleZoneT5.zone new file mode 100644 index 00000000..705620e7 --- /dev/null +++ b/test/SystemTests/Game/T5/simple/SimpleZoneT5.zone @@ -0,0 +1,4 @@ +>game,T5 + +rawfile,SimpleZone.txt + diff --git a/test/SystemTests/Game/T6/SimpleZoneT6.cpp b/test/SystemTests/Game/T6/SimpleZoneT6.cpp new file mode 100644 index 00000000..3a45ca9d --- /dev/null +++ b/test/SystemTests/Game/T6/SimpleZoneT6.cpp @@ -0,0 +1,62 @@ +#include "Game/T6/GameAssetPoolT6.h" +#include "Linker.h" +#include "OatTestPaths.h" +#include "SystemTestsPaths.h" +#include "ZoneLoading.h" + +#include +#include +#include +#include +#include + +namespace fs = std::filesystem; +using namespace std::literals; + +namespace +{ + TEST_CASE("Simple Zone(T6)", "[t6][system][simple]") + { + const auto assetSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/T6/simple").string(); + const auto sourceSearchPath = (oat::paths::GetSystemTestsDirectory() / "Game/T6/simple").string(); + const auto outputPath = oat::paths::GetTempDirectory("t6_simple").string(); + + const char* argStrings[]{ + "SystemTests", // bin + "--verbose", + "--asset-search-path", + assetSearchPath.c_str(), + "--source-search-path", + sourceSearchPath.c_str(), + "--output-folder", + outputPath.c_str(), + "SimpleZoneT6", + }; + + LinkerArgs args; + + bool shouldContinue = true; + const auto couldParseArgs = args.ParseArgs(std::extent_v, argStrings, shouldContinue); + + REQUIRE(couldParseArgs); + REQUIRE(shouldContinue); + + const auto linker = Linker::Create(std::move(args)); + const auto linkerResult = linker->Start(); + + REQUIRE(linkerResult); + + const auto expectedZonePath = (fs::path(outputPath) / "SimpleZoneT6.ff").string(); + auto maybeZone = ZoneLoading::LoadZone(expectedZonePath, std::nullopt); + REQUIRE(maybeZone); + + auto zone = std::move(*maybeZone); + auto pools = dynamic_cast(zone->m_pools.get()); + + REQUIRE(zone->m_game_id == GameId::T6); + REQUIRE(zone->m_platform == GamePlatform::PC); + REQUIRE(zone->m_name == "SimpleZoneT6"); + REQUIRE(pools->GetTotalAssetCount() == 1); + REQUIRE(pools->m_raw_file->GetAsset("SimpleZone.txt")); + } +} // namespace diff --git a/test/SystemTests/Game/T6/simple/SimpleZone.txt b/test/SystemTests/Game/T6/simple/SimpleZone.txt new file mode 100644 index 00000000..aea46cd0 --- /dev/null +++ b/test/SystemTests/Game/T6/simple/SimpleZone.txt @@ -0,0 +1 @@ +This is a simple zone. diff --git a/test/SystemTests/Game/T6/simple/SimpleZoneT6.zone b/test/SystemTests/Game/T6/simple/SimpleZoneT6.zone new file mode 100644 index 00000000..1c075965 --- /dev/null +++ b/test/SystemTests/Game/T6/simple/SimpleZoneT6.zone @@ -0,0 +1,4 @@ +>game,T6 + +rawfile,SimpleZone.txt +