From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcp90/tests/ios.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcp90/tests/ios.c b/dlls/msvcp90/tests/ios.c index b17e8f88a4d..3a480c9574e 100644 --- a/dlls/msvcp90/tests/ios.c +++ b/dlls/msvcp90/tests/ios.c @@ -540,10 +540,12 @@ static void (*__thiscall p_locale_dtor)(locale *this); /* basic_string */ static basic_string_char* (__thiscall *p_basic_string_char_ctor_cstr)(basic_string_char*, const char*); static const char* (__thiscall *p_basic_string_char_cstr)(basic_string_char*); +static MSVCP_size_t (__thiscall *p_basic_string_char_length)(const basic_string_char*); static void (__thiscall *p_basic_string_char_dtor)(basic_string_char*);
static basic_string_wchar* (__thiscall *p_basic_string_wchar_ctor_cstr)(basic_string_wchar*, const wchar_t*); static const wchar_t* (__thiscall *p_basic_string_wchar_cstr)(basic_string_wchar*); +static MSVCP_size_t (__thiscall *p_basic_string_wchar_length)(const basic_string_wchar*); static void (__thiscall *p_basic_string_wchar_dtor)(basic_string_wchar*);
/* basic_istringstream */ @@ -795,6 +797,8 @@ static BOOL init(void) "??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD@Z"); SET(p_basic_string_char_cstr, "?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ"); + SET(p_basic_string_char_length, + "?length@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KXZ"); SET(p_basic_string_char_dtor, "??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ");
@@ -802,6 +806,8 @@ static BOOL init(void) "??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@PEB_W@Z"); SET(p_basic_string_wchar_cstr, "?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEB_WXZ"); + SET(p_basic_string_wchar_length, + "?length@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA_KXZ"); SET(p_basic_string_wchar_dtor, "??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@XZ");
@@ -948,6 +954,8 @@ static BOOL init(void) "??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z"); SET(p_basic_string_char_cstr, "?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ"); + SET(p_basic_string_char_length, + "?length@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ"); SET(p_basic_string_char_dtor, "??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ");
@@ -955,6 +963,8 @@ static BOOL init(void) "??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@PB_W@Z"); SET(p_basic_string_wchar_cstr, "?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPB_WXZ"); + SET(p_basic_string_wchar_length, + "?length@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ"); SET(p_basic_string_wchar_dtor, "??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@XZ");
@@ -1097,6 +1107,8 @@ static BOOL init(void) "??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z"); SET(p_basic_string_char_cstr, "?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ"); + SET(p_basic_string_char_length, + "?length@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ"); SET(p_basic_string_char_dtor, "??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ");
@@ -1104,6 +1116,8 @@ static BOOL init(void) "??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@PB_W@Z"); SET(p_basic_string_wchar_cstr, "?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPB_WXZ"); + SET(p_basic_string_wchar_length, + "?length@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ"); SET(p_basic_string_wchar_dtor, "??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@XZ");
@@ -1422,6 +1436,7 @@ static void test_num_put_put_double(void) const wchar_t *wstr; const char *str; wchar_t wide[64]; + MSVCP_size_t len; int i;
struct _test_num_get { @@ -1430,6 +1445,7 @@ static void test_num_put_put_double(void) streamsize prec; /* set to -1 for default */ IOSB_fmtflags fmtfl; /* FMTFLAG_scientific, FMTFLAG_fixed */ const char *str; + MSVCP_bool is_todo; } tests[] = { { 0.0, NULL, -1, 0, "0" },
@@ -1474,7 +1490,10 @@ static void test_num_put_put_double(void) { -1.23456789e9, NULL, 0, FMTFLAG_fixed, "-1234567890" }, { -1.23456789e9, NULL, 6, FMTFLAG_fixed, "-1234567890.000000" }, { -1.23456789e-9, NULL, 6, FMTFLAG_fixed, "-0.000000" }, - { -1.23456789e-9, NULL, 9, FMTFLAG_fixed, "-0.000000001" } + { -1.23456789e-9, NULL, 9, FMTFLAG_fixed, "-0.000000001" }, + + { -1.0, NULL, -1, 0, "-1" }, + { -1.0, NULL, -1, FMTFLAG_internal, "-1", TRUE }, };
for(i=0; i<ARRAY_SIZE(tests); i++) { @@ -1488,15 +1507,18 @@ static void test_num_put_put_double(void)
/* set format and precision only if specified, so we can try defaults */ if(tests[i].fmtfl) - call_func3(p_ios_base_setf_mask, &ss.basic_ios.base, tests[i].fmtfl, FMTFLAG_floatfield); + call_func3(p_ios_base_setf_mask, &ss.basic_ios.base, tests[i].fmtfl, FMTFLAG_mask); if(tests[i].prec != -1) call_func2(p_ios_base_precision_set, &ss.basic_ios.base, tests[i].prec); call_func2_ptr_dbl(p_basic_ostream_char_print_double, &ss.base.base2, tests[i].val);
call_func2(p_basic_stringstream_char_str_get, &ss, &pstr); str = call_func1(p_basic_string_char_cstr, &pstr); + len = (MSVCP_size_t)call_func1(p_basic_string_char_length, &pstr);
ok(!strcmp(tests[i].str, str), "wrong output, expected = %s found = %s\n", tests[i].str, str); + todo_wine_if(tests[i].is_todo) + ok(len == strlen(str), "wrong size, expected = %Iu found = %Iu\n", strlen(str), len); call_func1(p_basic_string_char_dtor, &pstr);
if(tests[i].lcl) @@ -1514,16 +1536,19 @@ static void test_num_put_put_double(void)
/* set format and precision only if specified, so we can try defaults */ if(tests[i].fmtfl) - call_func3(p_ios_base_setf_mask, &wss.basic_ios.base, tests[i].fmtfl, FMTFLAG_floatfield); + call_func3(p_ios_base_setf_mask, &wss.basic_ios.base, tests[i].fmtfl, FMTFLAG_mask); if(tests[i].prec != -1) call_func2(p_ios_base_precision_set, &wss.basic_ios.base, tests[i].prec); call_func2_ptr_dbl(p_basic_ostream_wchar_print_double, &wss.base.base2, tests[i].val);
call_func2(p_basic_stringstream_wchar_str_get, &wss, &pwstr); wstr = call_func1(p_basic_string_wchar_cstr, &pwstr); + len = (MSVCP_size_t)call_func1(p_basic_string_wchar_length, &pwstr);
AtoW(wide, tests[i].str, strlen(tests[i].str)); ok(!lstrcmpW(wide, wstr), "wrong output, expected = %s found = %s\n", tests[i].str, wine_dbgstr_w(wstr)); + todo_wine_if(tests[i].is_todo) + ok(len == lstrlenW(wstr), "wrong size, expected = %u found = %Iu\n", lstrlenW(wstr), len); call_func1(p_basic_string_wchar_dtor, &pwstr);
if(tests[i].lcl)
From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcp90/tests/ios.c | 89 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+)
diff --git a/dlls/msvcp90/tests/ios.c b/dlls/msvcp90/tests/ios.c index 3a480c9574e..9cd5a612ad9 100644 --- a/dlls/msvcp90/tests/ios.c +++ b/dlls/msvcp90/tests/ios.c @@ -518,6 +518,10 @@ static basic_ostream_char* (*__cdecl p_basic_ostream_char_print_complex_ldouble)
static basic_ostream_wchar* (*__thiscall p_basic_ostream_short_print_ushort)(basic_ostream_wchar*, unsigned short);
+static basic_ostream_char* (*__thiscall p_basic_ostream_char_print_int)(basic_ostream_char*, int); + +static basic_ostream_wchar* (*__thiscall p_basic_ostream_wchar_print_int)(basic_ostream_wchar*, int); + /* basic_ios */ static locale* (*__thiscall p_basic_ios_char_imbue)(basic_ios_char*, locale*, const locale*); static basic_ios_char* (*__thiscall p_basic_ios_char_ctor)(basic_ios_char*); @@ -765,6 +769,12 @@ static BOOL init(void) SET(p_basic_ostream_char_print_complex_ldouble, "??$?6ODU?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@AEBV?$complex@O@0@@Z");
+ SET(p_basic_ostream_char_print_int, + "??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@J@Z"); + + SET(p_basic_ostream_wchar_print_int, + "??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@J@Z"); + SET(p_ios_base__Init, "?_Init@ios_base@std@@IEAAXXZ"); SET(p_ios_base_rdstate, @@ -922,6 +932,12 @@ static BOOL init(void) SET(p_basic_ostream_char_print_complex_ldouble, "??$?6ODU?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$complex@O@0@@Z");
+ SET(p_basic_ostream_char_print_int, + "??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAAAAV01@J@Z"); + + SET(p_basic_ostream_wchar_print_int, + "??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAAAAV01@J@Z"); + SET(p_ios_base__Init, "?_Init@ios_base@std@@IAAXXZ"); SET(p_ios_base_rdstate, @@ -1075,6 +1091,12 @@ static BOOL init(void) SET(p_basic_ostream_char_print_complex_ldouble, "??$?6ODU?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$complex@O@0@@Z");
+ SET(p_basic_ostream_char_print_int, + "??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@J@Z"); + + SET(p_basic_ostream_wchar_print_int, + "??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@J@Z"); + SET(p_ios_base__Init, "?_Init@ios_base@std@@IAEXXZ"); SET(p_ios_base_rdstate, @@ -1559,6 +1581,72 @@ static void test_num_put_put_double(void) }
+static void test_num_put_put_int(void) +{ + basic_stringstream_wchar wss; + basic_stringstream_char ss; + basic_string_wchar pwstr; + basic_string_char pstr; + const wchar_t *wstr; + const char *str; + wchar_t wide[64]; + MSVCP_size_t len; + int i; + + struct _test_num_put { + int val; + IOSB_fmtflags fmtfl; + const char *str; + MSVCP_bool is_todo; + } tests[] = { + { 1, 0, "1" }, + { -1, 0, "-1" }, + { -1, FMTFLAG_internal, "-1", TRUE }, + }; + + for(i=0; i<ARRAY_SIZE(tests); i++) { + /* char version */ + call_func1(p_basic_stringstream_char_ctor, &ss); + + /* set format only if specified, so we can try defaults */ + if(tests[i].fmtfl) + call_func3(p_ios_base_setf_mask, &ss.basic_ios.base, tests[i].fmtfl, FMTFLAG_mask); + call_func2(p_basic_ostream_char_print_int, &ss.base.base2, tests[i].val); + + call_func2(p_basic_stringstream_char_str_get, &ss, &pstr); + str = call_func1(p_basic_string_char_cstr, &pstr); + len = (MSVCP_size_t)call_func1(p_basic_string_char_length, &pstr); + + ok(!strcmp(tests[i].str, str), "wrong output, expected = %s found = %s\n", tests[i].str, str); + todo_wine_if(tests[i].is_todo) + ok(len == strlen(str), "wrong size, expected = %Iu found = %Iu\n", strlen(str), len); + call_func1(p_basic_string_char_dtor, &pstr); + + call_func1(p_basic_stringstream_char_vbase_dtor, &ss); + + /* wchar_t version */ + call_func1(p_basic_stringstream_wchar_ctor, &wss); + + /* set format only if specified, so we can try defaults */ + if(tests[i].fmtfl) + call_func3(p_ios_base_setf_mask, &wss.basic_ios.base, tests[i].fmtfl, FMTFLAG_mask); + call_func2(p_basic_ostream_wchar_print_int, &wss.base.base2, tests[i].val); + + call_func2(p_basic_stringstream_wchar_str_get, &wss, &pwstr); + wstr = call_func1(p_basic_string_wchar_cstr, &pwstr); + len = (MSVCP_size_t)call_func1(p_basic_string_wchar_length, &pwstr); + + AtoW(wide, tests[i].str, strlen(tests[i].str)); + ok(!lstrcmpW(wide, wstr), "wrong output, expected = %s found = %s\n", tests[i].str, wine_dbgstr_w(wstr)); + todo_wine_if(tests[i].is_todo) + ok(len == lstrlenW(wstr), "wrong size, expected = %u found = %Iu\n", lstrlenW(wstr), len); + call_func1(p_basic_string_wchar_dtor, &pwstr); + + call_func1(p_basic_stringstream_wchar_vbase_dtor, &wss); + } +} + + static void test_istream_ipfx(void) { unsigned short testus, nextus; @@ -2529,6 +2617,7 @@ START_TEST(ios) test_num_get_get_uint64(); test_num_get_get_double(); test_num_put_put_double(); + test_num_put_put_int(); test_istream_ipfx(); test_istream_ignore(); test_istream_seekg();
From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcp90/locale.c | 4 ++++ dlls/msvcp90/tests/ios.c | 10 ++-------- 2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c index 28a0db9d3bd..25ce19dfef0 100644 --- a/dlls/msvcp90/locale.c +++ b/dlls/msvcp90/locale.c @@ -7828,6 +7828,7 @@ static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreamb if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) { num_put_char__Putc(this, &dest, dest, buf, 1); buf++; + count--; } if(adjustfield != FMTFLAG_left) { num_put_char__Rep(this, ret, dest, fill, pad); @@ -7913,6 +7914,7 @@ ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostrea if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) { num_put_char__Putc(this, &dest, dest, buf, 1); buf++; + count--; }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) { num_put_char__Putc(this, &dest, dest, buf, 2); buf += 2; @@ -8696,6 +8698,7 @@ static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_ if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) { num_put_wchar_wide_put(this, &dest, base, buf, 1); buf++; + count--; } if(adjustfield != FMTFLAG_left) { num_put_wchar__Rep(this, ret, dest, fill, pad); @@ -8789,6 +8792,7 @@ static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_ if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) { num_put_wchar_wide_put(this, &dest, base, buf, 1); buf++; + count--; }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) { num_put_wchar_wide_put(this, &dest, base, buf, 2); buf += 2; diff --git a/dlls/msvcp90/tests/ios.c b/dlls/msvcp90/tests/ios.c index 9cd5a612ad9..41c2cf10898 100644 --- a/dlls/msvcp90/tests/ios.c +++ b/dlls/msvcp90/tests/ios.c @@ -1467,7 +1467,6 @@ static void test_num_put_put_double(void) streamsize prec; /* set to -1 for default */ IOSB_fmtflags fmtfl; /* FMTFLAG_scientific, FMTFLAG_fixed */ const char *str; - MSVCP_bool is_todo; } tests[] = { { 0.0, NULL, -1, 0, "0" },
@@ -1515,7 +1514,7 @@ static void test_num_put_put_double(void) { -1.23456789e-9, NULL, 9, FMTFLAG_fixed, "-0.000000001" },
{ -1.0, NULL, -1, 0, "-1" }, - { -1.0, NULL, -1, FMTFLAG_internal, "-1", TRUE }, + { -1.0, NULL, -1, FMTFLAG_internal, "-1" }, };
for(i=0; i<ARRAY_SIZE(tests); i++) { @@ -1539,7 +1538,6 @@ static void test_num_put_put_double(void) len = (MSVCP_size_t)call_func1(p_basic_string_char_length, &pstr);
ok(!strcmp(tests[i].str, str), "wrong output, expected = %s found = %s\n", tests[i].str, str); - todo_wine_if(tests[i].is_todo) ok(len == strlen(str), "wrong size, expected = %Iu found = %Iu\n", strlen(str), len); call_func1(p_basic_string_char_dtor, &pstr);
@@ -1569,7 +1567,6 @@ static void test_num_put_put_double(void)
AtoW(wide, tests[i].str, strlen(tests[i].str)); ok(!lstrcmpW(wide, wstr), "wrong output, expected = %s found = %s\n", tests[i].str, wine_dbgstr_w(wstr)); - todo_wine_if(tests[i].is_todo) ok(len == lstrlenW(wstr), "wrong size, expected = %u found = %Iu\n", lstrlenW(wstr), len); call_func1(p_basic_string_wchar_dtor, &pwstr);
@@ -1597,11 +1594,10 @@ static void test_num_put_put_int(void) int val; IOSB_fmtflags fmtfl; const char *str; - MSVCP_bool is_todo; } tests[] = { { 1, 0, "1" }, { -1, 0, "-1" }, - { -1, FMTFLAG_internal, "-1", TRUE }, + { -1, FMTFLAG_internal, "-1" }, };
for(i=0; i<ARRAY_SIZE(tests); i++) { @@ -1618,7 +1614,6 @@ static void test_num_put_put_int(void) len = (MSVCP_size_t)call_func1(p_basic_string_char_length, &pstr);
ok(!strcmp(tests[i].str, str), "wrong output, expected = %s found = %s\n", tests[i].str, str); - todo_wine_if(tests[i].is_todo) ok(len == strlen(str), "wrong size, expected = %Iu found = %Iu\n", strlen(str), len); call_func1(p_basic_string_char_dtor, &pstr);
@@ -1638,7 +1633,6 @@ static void test_num_put_put_int(void)
AtoW(wide, tests[i].str, strlen(tests[i].str)); ok(!lstrcmpW(wide, wstr), "wrong output, expected = %s found = %s\n", tests[i].str, wine_dbgstr_w(wstr)); - todo_wine_if(tests[i].is_todo) ok(len == lstrlenW(wstr), "wrong size, expected = %u found = %Iu\n", lstrlenW(wstr), len); call_func1(p_basic_string_wchar_dtor, &pwstr);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=148883
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000000A400F4, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
Piotr Caban (@piotr) commented about dlls/msvcp90/locale.c:
if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) { num_put_char__Putc(this, &dest, dest, buf, 1); buf++;
}else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) { num_put_char__Putc(this, &dest, dest, buf, 2); buf += 2;count--;
It looks like `count` should also be adjusted in `0x` case.
This merge request was closed by Piotr Caban.
I have created !6641 that also fixes "0x" prefix. Thank you.
@piotr thanks. i had wanted to add some tests before making the change. submitted https://gitlab.winehq.org/wine/wine/-/merge_requests/6652