Fixed printf formatting for "%p" and added a unit test to check it
(cherry picked from commit c63aa9545e
)
This commit is contained in:
parent
2a946832ba
commit
1ab452fc57
2 changed files with 23 additions and 0 deletions
|
@ -175,6 +175,12 @@ int stdlib_snprintf(void *arg)
|
|||
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text);
|
||||
SDLTest_AssertCheck(result == 7, "Check result value, expected: 7, got: %d", result);
|
||||
|
||||
result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1234abcd);
|
||||
expected = "0x1234abcd";
|
||||
SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1234abcd)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text);
|
||||
SDLTest_AssertCheck(result == SDL_strlen(expected), "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue