From 48a2315122078c9f4ed1b00a30068b5a8e3f6ce0 Mon Sep 17 00:00:00 2001 From: Adam Heinermann Date: Sat, 15 Nov 2025 14:36:44 -0800 Subject: [PATCH] feat(test): support more storm.dll versions --- CONTRIBUTING.md | 6 ++++-- test/CMakeLists.txt | 5 ++++- test/String.cpp | 12 +++++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e72e2fd..054b4a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,5 +27,7 @@ To use a different version of Storm.dll, use the following arguments in the cmak | Arguments | Games | |-----------|-------| |`-DWHOA_STORMDLL_VERSION=2016`| Starcraft 1.17 | -|`-DWHOA_STORMDLL_VERSION=2009`| Starcraft 1.16.1 | -|`-DWHOA_STORMDLL_VERSION=2003`| Starcraft 1.10 ~ 1.16.0, Diablo II 1.10 ~ 1.13d | +|`-DWHOA_STORMDLL_VERSION=2007`| Starcraft 1.15.0 ~ 1.16.1 | +|`-DWHOA_STORMDLL_VERSION=2003`| Starcraft 1.10 ~ 1.14.0, Diablo II 1.10 ~ 1.13d | +|`-DWHOA_STORMDLL_VERSION=2000`| Diablo 1.09, Starcraft 1.08 ~ Starcraft 1.09b, Diablo II 1.06 ~ Diablo II 1.09d, Warcraft II: BNE 2.02.1 | +|`-DWHOA_STORMDLL_VERSION=1999`| Diablo 1.08, Diablo II 1.0 ~ Diablo II 1.05b | diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index efa2c2f..0ae0b45 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,8 +9,11 @@ if(WHOA_TEST_STORMDLL) Region.cpp String.cpp Test.cpp - Unicode.cpp ) + + if(WHOA_STORMDLL_VERSION GREATER_EQUAL 2003) + list(APPEND TEST_SOURCES Unicode.cpp) + endif() else() file(GLOB TEST_SOURCES "*.cpp" diff --git a/test/String.cpp b/test/String.cpp index dbab386..359beed 100644 --- a/test/String.cpp +++ b/test/String.cpp @@ -454,6 +454,7 @@ TEST_CASE("SStrHashHT", "[string]") { } #endif +#if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2000 TEST_CASE("SStrHash64", "[string]") { #if defined(WHOA_SSTRHASH64_SUBTRACTS) SECTION("hashes strings with case insensitivity") { @@ -627,6 +628,7 @@ TEST_CASE("SStrHash64", "[string]") { CHECK(hash == seed); } } +#endif TEST_CASE("SStrLen", "[string]") { SECTION("calculates string length correctly") { @@ -638,6 +640,7 @@ TEST_CASE("SStrLen", "[string]") { } } +#if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2000 TEST_CASE("SStrLower", "[string]") { SECTION("rewrites uppercase string to lowercase correctly") { char string[] = "FOOBAR"; @@ -661,6 +664,7 @@ TEST_CASE("SStrLower", "[string]") { } } +// In older versions this doesn't have a return value TEST_CASE("SStrPack", "[string]") { SECTION("truncates dest correctly when first byte in source is null") { char dest[10] = {}; @@ -706,6 +710,7 @@ TEST_CASE("SStrPack", "[string]") { } } +// In older versions this doesn't have a return value TEST_CASE("SStrPrintf", "[string]") { SECTION("fills dest with formatted string") { char dest[100] = {}; @@ -797,8 +802,9 @@ TEST_CASE("SStrVPrintf", "[string]") { REQUIRE(!SStrCmp(dest, "")); } } +#endif -#if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2009 +#if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2007 TEST_CASE("SStrStr", "[string]") { char string[] = "foobar"; @@ -1020,6 +1026,7 @@ TEST_CASE("SStrTokenize", "[string]") { } #if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2016 +// In older versions these are broken TEST_CASE("SStrToDouble", "[string]") { SECTION("converts empty string to double") { auto result = SStrToDouble(""); @@ -1098,6 +1105,7 @@ TEST_CASE("SStrToDouble", "[string]") { } } +// In older versions these are broken TEST_CASE("SStrToFloat", "[string]") { SECTION("converts empty string to float") { auto result = SStrToFloat(""); @@ -1269,6 +1277,7 @@ TEST_CASE("SStrToUnsigned", "[string]") { } } +#if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2000 TEST_CASE("SStrUpper", "[string]") { SECTION("rewrites lowercase string to uppercase correctly") { char string[] = "foobar"; @@ -1291,3 +1300,4 @@ TEST_CASE("SStrUpper", "[string]") { REQUIRE(!SStrCmp(string, "")); } } +#endif