From 90658975147bb83e61cd51a2b448babfc399f03b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 18 Jun 2022 06:53:05 -0700 Subject: [PATCH] Added test for digit count in sscanf, e.g. "%1x" --- test/testautomation_stdlib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c index 4c978fa9b..1956d737d 100644 --- a/test/testautomation_stdlib.c +++ b/test/testautomation_stdlib.c @@ -319,6 +319,14 @@ stdlib_sscanf(void *arg) SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); + output = 123; + expected_output = 0xa; + expected_result = 1; + result = SDL_sscanf("aa", "%1x", &output); + SDLTest_AssertPass("Call to SDL_sscanf(\"aa\", \"%%1x\", &output)"); + SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); + SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); + return TEST_COMPLETED; }