Added a test case for snprintf of 0.0 This verifies regressions in https://github.com/libsdl-org/SDL/issues/4795
diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c
index 9ea1964..608d92f 100644
--- a/test/testautomation_stdlib.c
+++ b/test/testautomation_stdlib.c
@@ -64,6 +64,14 @@ stdlib_snprintf(void *arg)
SDLTest_AssertPass("Call to SDL_snprintf(NULL, 0, \"%%s\", \"foo\")");
SDLTest_AssertCheck(result == 3, "Check result value, expected: 3, got: %d", result);
+ result = SDL_snprintf(text, sizeof(text), "%f", 0.0);
+ predicted = SDL_snprintf(NULL, 0, "%f", 0.0);
+ expected = "0.000000";
+ SDLTest_AssertPass("Call to SDL_snprintf(\"%%f\", 0.0)");
+ SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text);
+ SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int) SDL_strlen(text), result);
+ SDLTest_AssertCheck(predicted == result, "Check predicted value, expected: %d, got: %d", result, predicted);
+
result = SDL_snprintf(text, sizeof(text), "%f", 1.0);
predicted = SDL_snprintf(NULL, 0, "%f", 1.0);
expected = "1.000000";