mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 16:59:08 +00:00
feat(test): add options for other versions of storm.dll
This commit is contained in:
parent
737728b9e8
commit
5190c49019
4 changed files with 23 additions and 6 deletions
|
|
@ -80,7 +80,13 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WHOA_TEST_STORMDLL)
|
if(WHOA_TEST_STORMDLL)
|
||||||
|
# Doesn't build squall, but still builds the tests to run against a real Storm.dll
|
||||||
add_definitions(-DWHOA_TEST_STORMDLL)
|
add_definitions(-DWHOA_TEST_STORMDLL)
|
||||||
|
if(WHOA_STORMDLL_VERSION)
|
||||||
|
add_definitions(-DWHOA_STORMDLL_VERSION=${WHOA_STORMDLL_VERSION})
|
||||||
|
else()
|
||||||
|
add_definitions(-DWHOA_STORMDLL_VERSION=2016)
|
||||||
|
endif()
|
||||||
add_subdirectory(test/stormdll)
|
add_subdirectory(test/stormdll)
|
||||||
else()
|
else()
|
||||||
add_subdirectory(storm)
|
add_subdirectory(storm)
|
||||||
|
|
|
||||||
|
|
@ -21,3 +21,11 @@ Only runnable on Windows. Allows running tests against the original `storm.dll`
|
||||||
3. `cmake --build .`
|
3. `cmake --build .`
|
||||||
4. Copy `storm.dll` from your Starcraft 1.17 installation folder to the same directory as `StormTest.exe`.
|
4. Copy `storm.dll` from your Starcraft 1.17 installation folder to the same directory as `StormTest.exe`.
|
||||||
5. Run `StormTest.exe` from the command line.
|
5. Run `StormTest.exe` from the command line.
|
||||||
|
|
||||||
|
To use a different version of Storm.dll, use the following arguments in the cmake command:
|
||||||
|
|
||||||
|
| 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 |
|
||||||
|
|
|
||||||
|
|
@ -809,14 +809,13 @@ TEST_CASE("SRgnGetBoundingRecti", "[region]") {
|
||||||
CHECK_THAT(result, MatchesRecti({ 0, 0, 0, 0 }));
|
CHECK_THAT(result, MatchesRecti({ 0, 0, 0, 0 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("returns invalid rect when using an invalid region object") {
|
SECTION("can be called when using an invalid region object") {
|
||||||
HSRGN inval = reinterpret_cast<HSRGN>(1234);
|
HSRGN inval = reinterpret_cast<HSRGN>(1234);
|
||||||
|
|
||||||
SRgnGetBoundingRecti(inval, &result);
|
// Casting huge float values to int is inconsistent between compilers,
|
||||||
// Casting huge float values to int is inconsistent between compilers
|
// compiler versions, and even between compile and runtime with the same compiler.
|
||||||
// It is also inconsistent between compile and runtime with the same compiler
|
// Since this behaviour is undefined and outcomes differ greatly, don't even bother testing the value.
|
||||||
// So don't even bother comparing with a value
|
CHECK_NOTHROW(SRgnGetBoundingRecti(inval, &result));
|
||||||
CHECK_THAT(result, !MatchesRecti({ 0, 0, 0, 0 }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("returns the dimensions of 1 rect (pass-through)") {
|
SECTION("returns the dimensions of 1 rect (pass-through)") {
|
||||||
|
|
|
||||||
|
|
@ -543,6 +543,7 @@ TEST_CASE("SStrVPrintf", "[string]") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2009
|
||||||
TEST_CASE("SStrStr", "[string]") {
|
TEST_CASE("SStrStr", "[string]") {
|
||||||
char string[] = "foobar";
|
char string[] = "foobar";
|
||||||
|
|
||||||
|
|
@ -688,6 +689,7 @@ TEST_CASE("SStrStrI const", "[string]") {
|
||||||
REQUIRE(substring == nullptr);
|
REQUIRE(substring == nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_CASE("SStrTokenize", "[string]") {
|
TEST_CASE("SStrTokenize", "[string]") {
|
||||||
SECTION("finds all tokens in comma-delimited string") {
|
SECTION("finds all tokens in comma-delimited string") {
|
||||||
|
|
@ -762,6 +764,7 @@ TEST_CASE("SStrTokenize", "[string]") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(WHOA_STORMDLL_VERSION) || WHOA_STORMDLL_VERSION >= 2016
|
||||||
TEST_CASE("SStrToDouble", "[string]") {
|
TEST_CASE("SStrToDouble", "[string]") {
|
||||||
SECTION("converts empty string to double") {
|
SECTION("converts empty string to double") {
|
||||||
auto result = SStrToDouble("");
|
auto result = SStrToDouble("");
|
||||||
|
|
@ -920,6 +923,7 @@ TEST_CASE("SStrToFloat", "[string]") {
|
||||||
REQUIRE(SStrToFloat("-1.79769e+310") == -HUGE_VALF);
|
REQUIRE(SStrToFloat("-1.79769e+310") == -HUGE_VALF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_CASE("SStrToInt", "[string]") {
|
TEST_CASE("SStrToInt", "[string]") {
|
||||||
SECTION("converts empty string to int") {
|
SECTION("converts empty string to int") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue