Commit 90658975147bb83e61cd51a2b448babfc399f03b

Sam Lantinga 2022-06-18T06:53:05

Added test for digit count in sscanf, e.g. "%1x"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c
index 4c978fa..1956d73 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;
 }