mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-12-13 13:28:08 +00:00
Added a test case for snprintf of 0.0
This verifies regressions in https://github.com/libsdl-org/SDL/issues/4795
This commit is contained in:
parent
3acb172531
commit
cdb4d8f22f
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user