@@ -412,6 +412,7 @@ int stdlib_sscanf(void *arg)
412
412
long long long_long_output , expected_long_long_output , long_long_length ;
413
413
size_t size_output , expected_size_output ;
414
414
char text [128 ], text2 [128 ];
415
+ unsigned int r = 0 , g = 0 , b = 0 ;
415
416
416
417
expected_output = output = 123 ;
417
418
expected_result = -1 ;
@@ -447,6 +448,17 @@ int stdlib_sscanf(void *arg)
447
448
SDLTest_AssertCheck (expected_result == result , "Check return value, expected: %i, got: %i" , expected_result , result );
448
449
SDLTest_AssertCheck (length == 1 , "Check length, expected: 1, got: %i" , length );
449
450
451
+ expected_result = 3 ;
452
+ result = SDL_sscanf ("#026" , "#%1x%1x%1x" , & r , & g , & b );
453
+ SDLTest_AssertPass ("Call to SDL_sscanf(\"#026\", \"#%%1x%%1x%%1x\", &r, &g, &b)" );
454
+ expected_output = 0 ;
455
+ SDLTest_AssertCheck (r == expected_output , "Check output for r, expected: %i, got: %i" , expected_output , r );
456
+ expected_output = 2 ;
457
+ SDLTest_AssertCheck (g == expected_output , "Check output for g, expected: %i, got: %i" , expected_output , g );
458
+ expected_output = 6 ;
459
+ SDLTest_AssertCheck (b == expected_output , "Check output for b, expected: %i, got: %i" , expected_output , b );
460
+ SDLTest_AssertCheck (expected_result == result , "Check return value, expected: %i, got: %i" , expected_result , result );
461
+
450
462
#define SIZED_TEST_CASE (type , var , printf_specifier , scanf_specifier ) \
451
463
var##_output = 123; \
452
464
var##_length = 0; \
0 commit comments