mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 07:29:09 +00:00
stdlib: Use new parser for scanf %p specifier
This commit is contained in:
parent
e109aa09aa
commit
61bc856b04
2 changed files with 26 additions and 29 deletions
|
@ -726,6 +726,7 @@ static int SDLCALL stdlib_sscanf(void *arg)
|
|||
long long_output, expected_long_output;
|
||||
long long long_long_output, expected_long_long_output;
|
||||
size_t size_output, expected_size_output;
|
||||
uintptr_t uintptr_output, expected_uintptr_output;
|
||||
char text[128], text2[128];
|
||||
|
||||
expected_output = output = 123;
|
||||
|
@ -790,6 +791,15 @@ static int SDLCALL stdlib_sscanf(void *arg)
|
|||
SDLTest_AssertCheck(expected_size_output == size_output, "Check output, expected: %zu, got: %zu", expected_size_output, size_output);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
uintptr_output = 123;
|
||||
expected_uintptr_output = 0x1234567;
|
||||
expected_result = 1;
|
||||
result = SDL_snprintf(text, sizeof(text), "%p", expected_uintptr_output);
|
||||
result = SDL_sscanf(text, "%p", &uintptr_output);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"%s\", \"%%p\", &output)", text);
|
||||
SDLTest_AssertCheck(expected_uintptr_output == uintptr_output, "Check output, expected: %p, got: %p", expected_uintptr_output, uintptr_output);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 1;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc def", "%s", text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue