[PATCH] msvcrt/tests: Be more explicit about unsupported sscanf("%hhd").
Signed-off-by: Serge Gautherie <winehq-git_serge_180711(a)gautherie.fr> --- dlls/msvcrt/tests/scanf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/tests/scanf.c b/dlls/msvcrt/tests/scanf.c index 57d9cc0..179eff7 100644 --- a/dlls/msvcrt/tests/scanf.c +++ b/dlls/msvcrt/tests/scanf.c @@ -207,9 +207,16 @@ static void test_sscanf( void ) result = 0xdeadbeef; strcpy(buffer,"12345678"); + ret = p_sscanf(buffer, "%d", &result); + ok(ret == 1, "Wrong number of arguments read: %d\n", ret); + /* int */ + ok(result == 0x00bc614e, "Wrong number read (%08x)\n", result); + + result = 0xdeadbeef; ret = p_sscanf(buffer, "%hd", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); - ok(result == 0xdead614e, "Wrong number read (%x)\n", result); + /* int, truncated to short */ + ok(result == 0xdead614e, "Wrong number read (%08x)\n", result); result = 0xdeadbeef; strcpy(buffer,"12345678"); @@ -238,7 +245,8 @@ static void test_sscanf( void ) result = 0xdeadbeef; ret = p_sscanf(buffer, "%hhd", &result); ok(ret == 1, "Wrong number of arguments read: %d\n", ret); - ok(result == 0xbc614e, "Wrong number read (%x)\n", result); + /* int, NOT truncated to char: pseudo-overflow! msvcrt sscanf() does not support 'hh', so ignores it. */ + ok(result == 0x00bc614e, "Wrong number read (%08x)\n", result); strcpy(buffer,"12345678901234"); ret = p_sscanf(buffer, "%lld", &result64); -- 2.10.0.windows.1
Hi Serge, Taking in account it's a 4-lines test I don't think it needs comments. The test code looks easy to read/understand. Thanks, Piotr
participants (2)
-
Piotr Caban -
Serge Gautherie