Skip to content

Commit

Permalink
Verify that the %p format specifier works for 64-bit pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 17, 2023
1 parent 34eb24e commit 403edf0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/testautomation_stdlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ static int stdlib_snprintf(void *arg)
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);

if (sizeof(void *) >= 8) {
result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1ba07bddf60L);
expected = "0x1ba07bddf60";
SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1ba07bddf60)");
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;
}

Expand Down

0 comments on commit 403edf0

Please sign in to comment.