From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/oleaut32/tests/vartest.c | 162 ++++++++++++---------------------- 1 file changed, 54 insertions(+), 108 deletions(-)
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 4751070827c..4a60dfcbfef 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -42,13 +42,6 @@
static HMODULE hOleaut32;
-static HRESULT (WINAPI *pVarUdateFromDate)(DATE,ULONG,UDATE*); -static HRESULT (WINAPI *pVarDateFromUdate)(UDATE*,ULONG,DATE*); -static INT (WINAPI *pSystemTimeToVariantTime)(LPSYSTEMTIME,double*); -static INT (WINAPI *pVariantTimeToSystemTime)(double,LPSYSTEMTIME); -static INT (WINAPI *pDosDateTimeToVariantTime)(USHORT,USHORT,double*); -static INT (WINAPI *pVariantTimeToDosDateTime)(double,USHORT*,USHORT *); - static const WCHAR sz12[] = {'1','2','\0'}; /* the strings are localized */ static WCHAR sz12_false[32]; @@ -1261,8 +1254,6 @@ static void test_VariantCopyInd(void) "CopyInd(ref->ref): expected E_INVALIDARG, got 0x%08lx\n", hres); }
-static HRESULT (WINAPI *pVarParseNumFromStr)(const OLECHAR*,LCID,ULONG,NUMPARSE*,BYTE*); - /* Macros for converting and testing the result of VarParseNumFromStr */ #define FAILDIG 255
@@ -1273,7 +1264,7 @@ static HRESULT wconvert_str( const OLECHAR *str, INT dig, ULONG npflags, memset( np, 255, sizeof(*np) ); np->cDig = dig; np->dwInFlags = npflags; - return pVarParseNumFromStr( str, lcid, flags, np, rgb); + return VarParseNumFromStr( str, lcid, flags, np, rgb); }
static HRESULT convert_str( const char *str, INT dig, ULONG flags, @@ -1321,8 +1312,6 @@ static void test_VarParseNumFromStrEn(void)
/** No flags **/
- CHECKPTR(VarParseNumFromStr); - /* Consume an empty string */ CONVERT("", 0); EXPECTFAIL; @@ -1967,8 +1956,6 @@ static void test_VarParseNumFromStrFr(void) OLECHAR spaces[] = L" \xa0\f\n\r\t\v"; /* man isspace() */ int i;
- CHECKPTR(VarParseNumFromStr); - /** White spaces **/
for (i = 0; i < ARRAY_SIZE(spaces)-1; i++) @@ -2198,8 +2185,6 @@ static void test_VarParseNumFromStrMisc(void) BYTE rgb[128]; OLECHAR currency[8], t1000[8], mont1000[8], dec[8], mondec[8];
- CHECKPTR(VarParseNumFromStr); - /* Customize the regional settings to perform extra tests */
if (GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, currency, ARRAY_SIZE(currency)) && @@ -2498,14 +2483,12 @@ static void test_VarParseNumFromStrMisc(void) EXPECTFAIL; }
-static HRESULT (WINAPI *pVarNumFromParseNum)(NUMPARSE*,BYTE*,ULONG,VARIANT*); - /* Macros for converting and testing the result of VarNumFromParseNum */ #define SETRGB(indx,val) if (!indx) memset(rgb, FAILDIG, sizeof(rgb)); rgb[indx] = val #undef CONVERT #define CONVERT(a,b,c,d,e,f,bits) \ np.cDig = (a); np.dwInFlags = (b); np.dwOutFlags = (c); np.cchUsed = (d); \ - np.nBaseShift = (e); np.nPwr10 = (f); hres = pVarNumFromParseNum(&np, rgb, bits, &vOut) + np.nBaseShift = (e); np.nPwr10 = (f); hres = VarNumFromParseNum(&np, rgb, bits, &vOut) static const char *szFailOverflow = "Expected overflow, hres = %08x\n"; #define EXPECT_OVERFLOW ok(hres == DISP_E_OVERFLOW, szFailOverflow, hres) static const char *szFailOk = "Call failed, hres = %08x\n"; @@ -2549,8 +2532,6 @@ static void test_VarNumFromParseNum(void) BYTE rgb[128]; VARIANT vOut;
- CHECKPTR(VarNumFromParseNum); - /* Convert the number 1 to different types */ SETRGB(0, 1); CONVERT(1,0,0,1,0,0, VTBIT_I1); EXPECT_I1(1); SETRGB(0, 1); CONVERT(1,0,0,1,0,0, VTBIT_UI1); EXPECT_UI1(1); @@ -2722,7 +2703,7 @@ static void test_UdateFromDate( int line, DATE dt, ULONG flags, HRESULT r, WORD HRESULT res;
memset(&ud, 0, sizeof(ud)); - res = pVarUdateFromDate(dt, flags, &ud); + res = VarUdateFromDate(dt, flags, &ud); ok_(__FILE__,line)(r == res && (res != S_OK || (ud.st.wYear == y && ud.st.wMonth == m && ud.st.wDay == d && ud.st.wHour == h && ud.st.wMinute == mn && ud.st.wSecond == s && ud.st.wMilliseconds == ms && ud.st.wDayOfWeek == dw && ud.wDayOfYear == dy)), @@ -2735,7 +2716,6 @@ static void test_UdateFromDate( int line, DATE dt, ULONG flags, HRESULT r, WORD
static void test_VarUdateFromDate(void) { - CHECKPTR(VarUdateFromDate); DT2UD(29221.0,0,S_OK,1,1,1980,0,0,0,0,2,1); /* 1 Jan 1980 */ DT2UD(29222.0,0,S_OK,2,1,1980,0,0,0,0,3,2); /* 2 Jan 1980 */ DT2UD(33238.0,0,S_OK,31,12,1990,0,0,0,0,1,365); /* 31 Dec 1990 */ @@ -2783,7 +2763,7 @@ static void test_DateFromUDate( int line, WORD d, WORD m, WORD y, WORD h, WORD m ud.st.wMilliseconds = ms; ud.st.wDayOfWeek = dw; ud.wDayOfYear = dy; - res = pVarDateFromUdate(&ud, flags, &out); + res = VarDateFromUdate(&ud, flags, &out); ok_(__FILE__,line)(r == res && (r != S_OK || EQ_DOUBLE(out, dt)), "expected %lx, %.16g, got %lx, %.16g\n", r, dt, res, out); } @@ -2791,7 +2771,6 @@ static void test_DateFromUDate( int line, WORD d, WORD m, WORD y, WORD h, WORD m
static void test_VarDateFromUdate(void) { - CHECKPTR(VarDateFromUdate); UD2T(1,1,1980,0,0,0,0,2,1,0,S_OK,29221.0); /* 1 Jan 1980 */ UD2T(2,1,1980,0,0,0,0,3,2,0,S_OK,29222.0); /* 2 Jan 1980 */ UD2T(2,1,1980,0,0,0,0,4,5,0,S_OK,29222.0); /* 2 Jan 1980 */ @@ -2859,7 +2838,7 @@ static void test_st2dt(int line, WORD d, WORD m, WORD y, WORD h, WORD mn, st.wSecond = s; st.wMilliseconds = ms; st.wDayOfWeek = 0; - res = pSystemTimeToVariantTime(&st, &out); + res = SystemTimeToVariantTime(&st, &out); ok_(__FILE__,line)(r == res, "expected %d, got %d\n", r, res); if (r && res) ok_(__FILE__,line)(EQ_DOUBLE(out, dt) || (dt2 && broken(EQ_DOUBLE(out, dt2))), @@ -2869,7 +2848,6 @@ static void test_st2dt(int line, WORD d, WORD m, WORD y, WORD h, WORD mn,
static void test_SystemTimeToVariantTime(void) { - CHECKPTR(SystemTimeToVariantTime); ST2DT(1,1,1980,0,0,0,0,TRUE,29221.0,0.0); ST2DT(2,1,1980,0,0,0,0,TRUE,29222.0,0.0); ST2DT(0,1,1980,0,0,0,0,TRUE,29220.0,0.0); /* Rolls back to 31 Dec 1899 */ @@ -2898,7 +2876,7 @@ static void test_dt2st(int line, double dt, INT r, WORD d, WORD m, WORD y, INT res;
memset(&st, 0, sizeof(st)); - res = pVariantTimeToSystemTime(dt, &st); + res = VariantTimeToSystemTime(dt, &st); ok_(__FILE__,line)(r == res && (!r || (st.wYear == y && st.wMonth == m && st.wDay == d && st.wHour == h && st.wMinute == mn && @@ -2912,9 +2890,8 @@ static void test_dt2st(int line, double dt, INT r, WORD d, WORD m, WORD y,
static void test_VariantTimeToSystemTime(void) { - CHECKPTR(VariantTimeToSystemTime); - DT2ST(29221.0,1,1,1,1980,0,0,0,0); - DT2ST(29222.0,1,2,1,1980,0,0,0,0); + DT2ST(29221.0,1,1,1,1980,0,0,0,0); + DT2ST(29222.0,1,2,1,1980,0,0,0,0); }
#define MKDOSDATE(d,m,y) ((d & 0x1f) | ((m & 0xf) << 5) | (((y-1980) & 0x7f) << 9)) @@ -2930,7 +2907,7 @@ static void test_dos2dt(int line, WORD d, WORD m, WORD y, WORD h, WORD mn, out = 0.0; dosDate = MKDOSDATE(d, m, y); dosTime = MKDOSTIME(h, mn, s); - res = pDosDateTimeToVariantTime(dosDate, dosTime, &out); + res = DosDateTimeToVariantTime(dosDate, dosTime, &out); ok_(__FILE__,line)(r == res && (!r || EQ_DOUBLE(out, dt)), "expected %d, %.16g, got %d, %.16g\n", r, dt, res, out); } @@ -2938,8 +2915,6 @@ static void test_dos2dt(int line, WORD d, WORD m, WORD y, WORD h, WORD mn,
static void test_DosDateTimeToVariantTime(void) { - CHECKPTR(DosDateTimeToVariantTime); - /* Date */ DOS2DT(1,1,1980,0,0,0,1,29221.0); /* 1/1/1980 */ DOS2DT(31,12,2099,0,0,0,1,73050.0); /* 31/12/2099 */ @@ -3011,7 +2986,7 @@ static void test_dt2dos(int line, double dt, INT r, WORD d, WORD m, WORD y, dosTime = dosDate = 0; expDosDate = MKDOSDATE(d,m,y); expDosTime = MKDOSTIME(h,mn,s); - res = pVariantTimeToDosDateTime(dt, &dosDate, &dosTime); + res = VariantTimeToDosDateTime(dt, &dosDate, &dosTime); ok_(__FILE__,line)(r == res && (!r || (dosTime == expDosTime && dosDate == expDosDate)), "%g: expected %d,%d(%d/%d/%d),%d(%d:%d:%d) got %d,%d(%d/%d/%d),%d(%d:%d:%d)\n", dt, r, expDosDate, expDosDate & 0x1f, @@ -3026,8 +3001,6 @@ static void test_dt2dos(int line, double dt, INT r, WORD d, WORD m, WORD y,
static void test_VariantTimeToDosDateTime(void) { - CHECKPTR(VariantTimeToDosDateTime); - /* Date */ DT2DOS(29221.0,1,1,1,1980,0,0,0); /* 1/1/1980 */ DT2DOS(73050.0,1,31,12,2099,0,0,0); /* 31/12/2099 */ @@ -4377,15 +4350,13 @@ static void test_VarNeg(void) "VarNeg: VT_CY wrong, hres=0x%lX\n", hres); }
-static HRESULT (WINAPI *pVarRound)(LPVARIANT,int,LPVARIANT); - static void test_Round( int line, VARIANT *arg, int deci, VARIANT *expected ) { VARIANT result; HRESULT hres;
memset( &result, 0, sizeof(result) ); - hres = pVarRound( arg, deci, &result ); + hres = VarRound( arg, deci, &result ); ok_(__FILE__,line)( hres == S_OK, "wrong result %lx\n", hres ); if (hres == S_OK) ok_(__FILE__,line)( is_expected_variant( &result, expected ), @@ -4433,8 +4404,6 @@ static void test_VarRound(void) char buff[8]; int i;
- CHECKPTR(VarRound); - /* first check valid integer types */ VARROUND(BOOL,VARIANT_TRUE,0,I2,-1); VARROUND(BOOL,VARIANT_FALSE,0,I2,0); @@ -4498,13 +4467,13 @@ static void test_VarRound(void) VARROUND(R8,-1.23456,4,R8,-1.2346);
V_VT(&v) = VT_EMPTY; - hres = pVarRound(&v,0,&vDst); + hres = VarRound(&v,0,&vDst); ok(hres == S_OK && V_VT(&vDst) == VT_I2 && V_I2(&vDst) == 0, "VarRound: expected 0x0,%d,0 got 0x%lX,%d,%d\n", VT_EMPTY, hres, V_VT(&vDst), V_I2(&vDst));
V_VT(&v) = VT_NULL; - hres = pVarRound(&v,0,&vDst); + hres = VarRound(&v,0,&vDst); ok(hres == S_OK && V_VT(&vDst) == VT_NULL, "VarRound: expected 0x0,%d got 0x%lX,%d\n", VT_NULL, hres, V_VT(&vDst));
@@ -4522,7 +4491,7 @@ static void test_VarRound(void) pdec->Mid32 = ptr->source.Mid32; pdec->Lo32 = ptr->source.Lo32; VariantInit(&vDst); - hres = pVarRound(&v, ptr->dec, &vDst); + hres = VarRound(&v, ptr->dec, &vDst); ok(hres == S_OK, "%d: got 0x%08lx\n", i, hres); if (hres == S_OK) { @@ -4541,10 +4510,9 @@ static void test_VarRound(void) /* VT_CY */ V_VT(&v) = VT_CY; pcy->int64 = 10000; - hres = pVarRound(&v,0,&vDst); + hres = VarRound(&v,0,&vDst); ok(hres == S_OK && V_VT(&vDst) == VT_CY && V_CY(&vDst).int64 == 10000, "VarRound: VT_CY wrong, hres=0x%lX\n", hres); - }
static HRESULT (WINAPI *pVarXor)(LPVARIANT,LPVARIANT,LPVARIANT); @@ -6524,9 +6492,6 @@ static void test_VarAdd(void) SysFreeString(rbstr); }
-static HRESULT (WINAPI *pVarCmp)(LPVARIANT,LPVARIANT,LCID,ULONG); -static HRESULT (WINAPI *pVarCat)(LPVARIANT,LPVARIANT,LPVARIANT); - static void test_VarCat(void) { LCID lcid; @@ -6545,8 +6510,6 @@ static void test_VarCat(void) int cmp; DummyDispatch dispatch;
- CHECKPTR(VarCat); - /* Set date format for testing */ lcid = LOCALE_USER_DEFAULT; GetLocaleInfoA(lcid,LOCALE_SSHORTDATE,orig_date_format,128); @@ -6663,7 +6626,7 @@ static void test_VarCat(void) V_I8(&right) = 0; }
- hres = pVarCat(&left, &right, &result); + hres = VarCat(&left, &right, &result);
/* Determine the error code for the vt combination */ ok(hres == expected_error_num, @@ -6690,11 +6653,10 @@ static void test_VarCat(void) V_BSTR(&left) = SysAllocString(sz12); V_BSTR(&right) = SysAllocString(sz34); V_BSTR(&expected) = SysAllocString(sz1234); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ, - "VarCat: VT_BSTR concat with VT_BSTR failed to return correct result\n"); + ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, + "VarCat: VT_BSTR concat with VT_BSTR failed to return correct result\n");
VariantClear(&left); VariantClear(&right); @@ -6704,7 +6666,7 @@ static void test_VarCat(void) V_VT(&left) = VT_ERROR; V_VT(&right) = VT_BSTR; V_BSTR(&right) = SysAllocString(sz1234); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == DISP_E_TYPEMISMATCH, "VarCat should have returned DISP_E_TYPEMISMATCH instead of 0x%08lx\n", hres); ok(V_VT(&result) == VT_EMPTY, "VarCat: VT_ERROR concat with VT_BSTR should have returned VT_EMPTY\n"); @@ -6716,7 +6678,7 @@ static void test_VarCat(void) V_VT(&left) = VT_BSTR; V_VT(&right) = VT_ERROR; V_BSTR(&left) = SysAllocString(sz1234); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == DISP_E_TYPEMISMATCH, "VarCat should have returned DISP_E_TYPEMISMATCH instead of 0x%08lx\n", hres); ok(V_VT(&result) == VT_EMPTY, "VarCat: VT_BSTR concat with VT_ERROR should have returned VT_EMPTY\n"); @@ -6733,14 +6695,11 @@ static void test_VarCat(void) V_INT(&left) = 12; V_BOOL(&right) = TRUE; V_BSTR(&expected) = SysAllocString(sz12_true); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - { - hres = pVarCmp(&result,&expected,lcid,0); - ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", - hres, variantstr(&result), variantstr(&expected)); - } + hres = VarCmp(&result, &expected, lcid, 0); + ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", + hres, variantstr(&result), variantstr(&expected));
VariantClear(&left); VariantClear(&right); @@ -6753,14 +6712,11 @@ static void test_VarCat(void) V_INT(&left) = 12; V_BOOL(&right) = FALSE; V_BSTR(&expected) = SysAllocString(sz12_false); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - { - hres = pVarCmp(&result,&expected,lcid,0); - ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", - hres, variantstr(&result), variantstr(&expected)); - } + hres = VarCmp(&result, &expected, lcid, 0); + ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", + hres, variantstr(&result), variantstr(&expected));
VariantClear(&left); VariantClear(&right); @@ -6774,11 +6730,10 @@ static void test_VarCat(void) V_INT(&left) = 12; V_INT(&right) = 34; V_BSTR(&expected) = SysAllocString(sz1234); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ, - "VarCat: NUMBER concat with NUMBER returned incorrect result\n"); + ok(VarCmp(&result, &expected, lcid, 0) == VARCMP_EQ, + "VarCat: NUMBER concat with NUMBER returned incorrect result\n");
VariantClear(&left); VariantClear(&right); @@ -6789,11 +6744,10 @@ static void test_VarCat(void) V_VT(&right) = VT_BSTR; V_INT(&left) = 12; V_BSTR(&right) = SysAllocString(sz34); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ, - "VarCat: NUMBER concat with VT_BSTR, incorrect result\n"); + ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, + "VarCat: NUMBER concat with VT_BSTR, incorrect result\n");
VariantClear(&left); VariantClear(&right); @@ -6803,11 +6757,10 @@ static void test_VarCat(void) V_VT(&right) = VT_INT; V_BSTR(&left) = SysAllocString(sz12); V_INT(&right) = 34; - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ, - "VarCat: VT_BSTR concat with NUMBER, incorrect result\n"); + ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, + "VarCat: VT_BSTR concat with NUMBER, incorrect result\n");
VariantClear(&left); VariantClear(&right); @@ -6823,11 +6776,10 @@ static void test_VarCat(void) V_DATE(&right) = 29494.0; V_BSTR(&expected)= SysAllocString(sz12_date); V_BSTR(&expected_broken)= SysAllocString(sz12_date_broken); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ || - broken(pVarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */ + ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ || + broken(VarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */ "VarCat: VT_BSTR concat with VT_DATE returned incorrect result\n");
VariantClear(&left); @@ -6844,12 +6796,11 @@ static void test_VarCat(void) V_BSTR(&right) = SysAllocString(sz12); V_BSTR(&expected)= SysAllocString(date_sz12); V_BSTR(&expected_broken)= SysAllocString(date_sz12_broken); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - ok(pVarCmp(&result,&expected,lcid,0) == VARCMP_EQ || - broken(pVarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */ - "VarCat: VT_DATE concat with VT_BSTR returned incorrect result\n"); + ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ || + broken(VarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */ + "VarCat: VT_DATE concat with VT_BSTR returned incorrect result\n");
VariantClear(&left); VariantClear(&right); @@ -6864,11 +6815,10 @@ static void test_VarCat(void) V_BSTR(&left) = SysAllocString(sz_empty); V_BSTR(&right) = SysAllocString(sz_empty); V_BSTR(&expected)= SysAllocString(sz_empty); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - if (pVarCmp) - ok(pVarCmp(&result,&left,lcid,0) == VARCMP_EQ, - "VarCat: EMPTY concat with EMPTY did not return empty VT_BSTR\n"); + ok(VarCmp(&result,&left,lcid,0) == VARCMP_EQ, + "VarCat: EMPTY concat with EMPTY did not return empty VT_BSTR\n");
/* Restore original date format settings */ SetLocaleInfoA(lcid,LOCALE_SSHORTDATE,orig_date_format); @@ -6916,7 +6866,7 @@ static void test_VarCat(void) V_VT(&left) = VT_BSTR; V_BSTR(&left) = SysAllocString(sz12); SET_EXPECT(dispatch_invoke); - hres = pVarCat(&left,&right,&result); + hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); CHECK_CALLED(dispatch_invoke); ok(!lstrcmpW(V_BSTR(&result), L"1234"), "got %s\n", wine_dbgstr_w(V_BSTR(&result))); @@ -6958,7 +6908,7 @@ static void test_VarCat(void) V_BOOL(&left) = VARIANT_TRUE; V_VT(&right) = VT_BSTR; V_BSTR(&right) = SysAllocStringLen(NULL,0); - hres = pVarCat(&left, &right, &result); + hres = VarCat(&left, &right, &result); ok(hres == S_OK, "VarCat failed: %08lx\n", hres); VariantClear(&right);
@@ -6967,13 +6917,13 @@ static void test_VarCat(void) if(!cmp) { V_VT(&right) = VT_BOOL; V_BOOL(&right) = 100; - hres = pVarCat(&left, &right, &result); + hres = VarCat(&left, &right, &result); ok(hres == S_OK, "VarCat failed: %08lx\n", hres); test_bstr_var(&result, L"TrueTrue"); VariantClear(&result);
V_BOOL(&right) = VARIANT_FALSE; - hres = pVarCat(&left, &right, &result); + hres = VarCat(&left, &right, &result); ok(hres == S_OK, "VarCat failed: %08lx\n", hres); test_bstr_var(&result, L"TrueFalse"); VariantClear(&result); @@ -7663,9 +7613,7 @@ static void test_cmp( int line, LCID lcid, UINT flags, VARIANT *left, VARIANT *r { HRESULT hres;
- CHECKPTR(VarCmp); - - hres = pVarCmp(left,right,lcid,flags); + hres = VarCmp(left,right,lcid,flags); ok_(__FILE__,line)(hres == result, "VarCmp(%s,%s): expected 0x%lx, got hres=0x%lx\n", variantstr(left), variantstr(right), result, hres ); } @@ -7719,8 +7667,6 @@ static void test_VarCmp(void) BSTR bstrhuh, bstrempty, bstr0, bstr1, bstr7, bstr42, bstr1neg, bstr666neg; BSTR bstr2cents, bstr1few;
- CHECKPTR(VarCmp); - lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT); bstrempty = SysAllocString(szempty); bstrhuh = SysAllocString(szhuh); @@ -7804,7 +7750,7 @@ static void test_VarCmp(void) else if (leftvt == VT_EMPTY && rightvt == VT_BSTR) expect = VARCMP_LT;
- hres = pVarCmp(&left, &right, LOCALE_USER_DEFAULT, 0); + hres = VarCmp(&left, &right, LOCALE_USER_DEFAULT, 0); if (bFail) { ok(hres == DISP_E_TYPEMISMATCH || hres == DISP_E_BADVARTYPE, "VarCmp: %d|0x%X, %d|0x%X: Expected failure, got 0x%lX\n",
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/oleaut32/tests/vartest.c | 119 +++++++++++++--------------------- 1 file changed, 46 insertions(+), 73 deletions(-)
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 4a60dfcbfef..325b4ad270c 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -3267,8 +3267,8 @@ static void test_VarSub(void)
CHECKPTR(VarSub);
- lbstr = SysAllocString(sz12); - rbstr = SysAllocString(sz12); + lbstr = SysAllocString(L"12"); + rbstr = SysAllocString(L"12");
VariantInit(&left); VariantInit(&right); @@ -3519,8 +3519,6 @@ static void test_VarMod(void) VARIANT v1, v2, vDst, left, right, exp; HRESULT hres; HRESULT hexpected = 0; - static const WCHAR szNum0[] = {'1','2','5','\0'}; - static const WCHAR szNum1[] = {'1','0','\0'}; int l, r; BOOL lFound, rFound; BOOL lValid; @@ -3620,8 +3618,8 @@ static void test_VarMod(void) VARMOD(DATE,R8,100,10,I4,0); VARMOD(DATE,DATE,100,10,I4,0);
- strNum0 = SysAllocString(szNum0); - strNum1 = SysAllocString(szNum1); + strNum0 = SysAllocString(L"125"); + strNum1 = SysAllocString(L"10"); VARMOD(BSTR,BSTR,strNum0,strNum1,I4,5); VARMOD(BSTR,I1,strNum0,10,I4,5); VARMOD(BSTR,I2,strNum0,10,I4,5); @@ -4004,7 +4002,6 @@ static HRESULT (WINAPI *pVarFix)(LPVARIANT,LPVARIANT);
static void test_VarFix(void) { - static const WCHAR szNumMinus1[] = {'-','1','\0' }; HRESULT hres; VARIANT v, exp, vDst; DECIMAL *pdec = &V_DECIMAL(&v); @@ -4071,7 +4068,7 @@ static void test_VarFix(void) /* DATE & R8 round as for R4 */ VARFIX(DATE,-1,DATE,-1); VARFIX(R8,-1,R8,-1); - VARFIX(BSTR,(BSTR)szNumMinus1,R8,-1); + VARFIX(BSTR,(BSTR)L"-1",R8,-1);
V_VT(&v) = VT_EMPTY; hres = pVarFix(&v,&vDst); @@ -4119,7 +4116,6 @@ static HRESULT (WINAPI *pVarInt)(LPVARIANT,LPVARIANT);
static void test_VarInt(void) { - static const WCHAR szNumMinus1[] = {'-','1','\0' }; HRESULT hres; VARIANT v, exp, vDst; DECIMAL *pdec = &V_DECIMAL(&v); @@ -4186,7 +4182,7 @@ static void test_VarInt(void) /* DATE & R8 round as for R4 */ VARINT(DATE,-1,DATE,-1); VARINT(R8,-1,R8,-1); - VARINT(BSTR,(BSTR)szNumMinus1,R8,-1); + VARINT(BSTR,(BSTR)L"-1",R8,-1);
V_VT(&v) = VT_EMPTY; hres = pVarInt(&v,&vDst); @@ -4235,8 +4231,6 @@ static HRESULT (WINAPI *pVarNeg)(LPVARIANT,LPVARIANT);
static void test_VarNeg(void) { - static const WCHAR szNumMinus1[] = {'-','1','\0' }; - static const WCHAR szNum1[] = {'1','\0' }; HRESULT hres; VARIANT v, exp, vDst; DECIMAL *pdec = &V_DECIMAL(&v); @@ -4310,8 +4304,8 @@ static void test_VarNeg(void) VARNEG(DATE,-1,DATE,1); VARNEG(R8,1,R8,-1); VARNEG(R8,-1,R8,1); - VARNEG(BSTR,(BSTR)szNumMinus1,R8,1); - VARNEG(BSTR,(BSTR)szNum1,R8,-1); + VARNEG(BSTR,(BSTR)L"-1",R8,1); + VARNEG(BSTR,(BSTR)L"1",R8,-1);
V_VT(&v) = VT_EMPTY; hres = pVarNeg(&v,&vDst); @@ -6147,8 +6141,8 @@ static void test_VarMul(void)
CHECKPTR(VarMul);
- lbstr = SysAllocString(sz12); - rbstr = SysAllocString(sz12); + lbstr = SysAllocString(L"12"); + rbstr = SysAllocString(L"12");
/* Test all possible flag/vt combinations & the resulting vt type */ for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++) @@ -6318,8 +6312,8 @@ static void test_VarAdd(void)
CHECKPTR(VarAdd);
- lbstr = SysAllocString(sz12); - rbstr = SysAllocString(sz12); + lbstr = SysAllocString(L"12"); + rbstr = SysAllocString(L"12");
/* Test all possible flag/vt combinations & the resulting vt type */ for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++) @@ -6496,13 +6490,6 @@ static void test_VarCat(void) { LCID lcid; VARIANT left, right, result, expected, expected_broken; - static const WCHAR sz34[] = {'3','4','\0'}; - static const WCHAR sz1234[] = {'1','2','3','4','\0'}; - static const WCHAR date_sz12[] = {'9','/','3','0','/','1','9','8','0','1','2','\0'}; - static const WCHAR date_sz12_broken[] = {'9','/','3','0','/','8','0','1','2','\0'}; - static const WCHAR sz12_date[] = {'1','2','9','/','3','0','/','1','9','8','0','\0'}; - static const WCHAR sz12_date_broken[] = {'1','2','9','/','3','0','/','8','0','\0'}; - static const WCHAR sz_empty[] = {'\0'}; CHAR orig_date_format[128]; VARTYPE leftvt, rightvt, resultvt; HRESULT hres; @@ -6606,7 +6593,7 @@ static void test_VarCat(void)
switch (leftvt) { case VT_BSTR: - V_BSTR(&left) = SysAllocString(sz_empty); break; + V_BSTR(&left) = SysAllocString(L""); break; case VT_DATE: V_DATE(&left) = 0.0; break; case VT_DECIMAL: @@ -6617,7 +6604,7 @@ static void test_VarCat(void)
switch (rightvt) { case VT_BSTR: - V_BSTR(&right) = SysAllocString(sz_empty); break; + V_BSTR(&right) = SysAllocString(L""); break; case VT_DATE: V_DATE(&right) = 0.0; break; case VT_DECIMAL: @@ -6650,9 +6637,9 @@ static void test_VarCat(void) V_VT(&left) = VT_BSTR; V_VT(&right) = VT_BSTR; V_VT(&expected) = VT_BSTR; - V_BSTR(&left) = SysAllocString(sz12); - V_BSTR(&right) = SysAllocString(sz34); - V_BSTR(&expected) = SysAllocString(sz1234); + V_BSTR(&left) = SysAllocString(L"12"); + V_BSTR(&right) = SysAllocString(L"34"); + V_BSTR(&expected) = SysAllocString(L"1234"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, @@ -6665,7 +6652,7 @@ static void test_VarCat(void) /* Test if expression is VT_ERROR */ V_VT(&left) = VT_ERROR; V_VT(&right) = VT_BSTR; - V_BSTR(&right) = SysAllocString(sz1234); + V_BSTR(&right) = SysAllocString(L"1234"); hres = VarCat(&left,&right,&result); ok(hres == DISP_E_TYPEMISMATCH, "VarCat should have returned DISP_E_TYPEMISMATCH instead of 0x%08lx\n", hres); ok(V_VT(&result) == VT_EMPTY, @@ -6677,7 +6664,7 @@ static void test_VarCat(void)
V_VT(&left) = VT_BSTR; V_VT(&right) = VT_ERROR; - V_BSTR(&left) = SysAllocString(sz1234); + V_BSTR(&left) = SysAllocString(L"1234"); hres = VarCat(&left,&right,&result); ok(hres == DISP_E_TYPEMISMATCH, "VarCat should have returned DISP_E_TYPEMISMATCH instead of 0x%08lx\n", hres); ok(V_VT(&result) == VT_EMPTY, @@ -6729,7 +6716,7 @@ static void test_VarCat(void) V_VT(&expected) = VT_BSTR; V_INT(&left) = 12; V_INT(&right) = 34; - V_BSTR(&expected) = SysAllocString(sz1234); + V_BSTR(&expected) = SysAllocString(L"1234"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); ok(VarCmp(&result, &expected, lcid, 0) == VARCMP_EQ, @@ -6743,7 +6730,7 @@ static void test_VarCat(void) V_VT(&left) = VT_INT; V_VT(&right) = VT_BSTR; V_INT(&left) = 12; - V_BSTR(&right) = SysAllocString(sz34); + V_BSTR(&right) = SysAllocString(L"34"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, @@ -6755,7 +6742,7 @@ static void test_VarCat(void)
V_VT(&left) = VT_BSTR; V_VT(&right) = VT_INT; - V_BSTR(&left) = SysAllocString(sz12); + V_BSTR(&left) = SysAllocString(L"12"); V_INT(&right) = 34; hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); @@ -6772,10 +6759,10 @@ static void test_VarCat(void) V_VT(&right) = VT_DATE; V_VT(&expected) = VT_BSTR; V_VT(&expected_broken) = VT_BSTR; - V_BSTR(&left) = SysAllocString(sz12); + V_BSTR(&left) = SysAllocString(L"12"); V_DATE(&right) = 29494.0; - V_BSTR(&expected)= SysAllocString(sz12_date); - V_BSTR(&expected_broken)= SysAllocString(sz12_date_broken); + V_BSTR(&expected)= SysAllocString(L"129/30/1980"); + V_BSTR(&expected_broken)= SysAllocString(L"129/30/80"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ || @@ -6793,9 +6780,9 @@ static void test_VarCat(void) V_VT(&expected) = VT_BSTR; V_VT(&expected_broken) = VT_BSTR; V_DATE(&left) = 29494.0; - V_BSTR(&right) = SysAllocString(sz12); - V_BSTR(&expected)= SysAllocString(date_sz12); - V_BSTR(&expected_broken)= SysAllocString(date_sz12_broken); + V_BSTR(&right) = SysAllocString(L"12"); + V_BSTR(&expected) = SysAllocString(L"9/30/198012"); + V_BSTR(&expected_broken) = SysAllocString(L"9/30/8012"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ || @@ -6812,9 +6799,9 @@ static void test_VarCat(void) V_VT(&left) = VT_BSTR; V_VT(&right) = VT_BSTR; V_VT(&expected) = VT_BSTR; - V_BSTR(&left) = SysAllocString(sz_empty); - V_BSTR(&right) = SysAllocString(sz_empty); - V_BSTR(&expected)= SysAllocString(sz_empty); + V_BSTR(&left) = SysAllocString(L""); + V_BSTR(&right) = SysAllocString(L""); + V_BSTR(&expected)= SysAllocString(L""); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); ok(VarCmp(&result,&left,lcid,0) == VARCMP_EQ, @@ -6864,7 +6851,7 @@ static void test_VarCat(void) V_DISPATCH(&right) = &dispatch.IDispatch_iface;
V_VT(&left) = VT_BSTR; - V_BSTR(&left) = SysAllocString(sz12); + V_BSTR(&left) = SysAllocString(L"12"); SET_EXPECT(dispatch_invoke); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); @@ -7654,30 +7641,20 @@ static void test_VarCmp(void) LCID lcid; HRESULT hres; DECIMAL dec; - static const WCHAR szhuh[] = {'h','u','h','?','\0'}; - static const WCHAR sz2cents[] = {'2','c','e','n','t','s','\0'}; - static const WCHAR szempty[] = {'\0'}; - static const WCHAR sz0[] = {'0','\0'}; - static const WCHAR sz1[] = {'1','\0'}; - static const WCHAR sz7[] = {'7','\0'}; - static const WCHAR sz42[] = {'4','2','\0'}; - static const WCHAR sz1neg[] = {'-','1','\0'}; - static const WCHAR sz666neg[] = {'-','6','6','6','\0'}; - static const WCHAR sz1few[] = {'1','.','0','0','0','0','0','0','0','1','\0'}; BSTR bstrhuh, bstrempty, bstr0, bstr1, bstr7, bstr42, bstr1neg, bstr666neg; BSTR bstr2cents, bstr1few;
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT); - bstrempty = SysAllocString(szempty); - bstrhuh = SysAllocString(szhuh); - bstr2cents = SysAllocString(sz2cents); - bstr0 = SysAllocString(sz0); - bstr1 = SysAllocString(sz1); - bstr7 = SysAllocString(sz7); - bstr42 = SysAllocString(sz42); - bstr1neg = SysAllocString(sz1neg); - bstr666neg = SysAllocString(sz666neg); - bstr1few = SysAllocString(sz1few); + bstrempty = SysAllocString(L""); + bstrhuh = SysAllocString(L"huh?"); + bstr2cents = SysAllocString(L"2cents"); + bstr0 = SysAllocString(L"0"); + bstr1 = SysAllocString(L"1"); + bstr7 = SysAllocString(L"7"); + bstr42 = SysAllocString(L"42"); + bstr1neg = SysAllocString(L"-1"); + bstr666neg = SysAllocString(L"-666"); + bstr1few = SysAllocString(L"1.00000001");
/* Test all possible flag/vt combinations & the resulting vt type */ for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++) @@ -7903,8 +7880,6 @@ static HRESULT (WINAPI *pVarPow)(LPVARIANT,LPVARIANT,LPVARIANT);
static void test_VarPow(void) { - static const WCHAR str2[] = { '2','\0' }; - static const WCHAR str3[] = { '3','\0' }; VARIANT left, right, exp, result, cy, dec; BSTR num2_str, num3_str; VARTYPE i; @@ -7912,8 +7887,8 @@ static void test_VarPow(void)
CHECKPTR(VarPow);
- num2_str = SysAllocString(str2); - num3_str = SysAllocString(str3); + num2_str = SysAllocString(L"2"); + num3_str = SysAllocString(L"3");
/* Test all possible flag/vt combinations & the resulting vt type */ for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++) @@ -8799,8 +8774,6 @@ static HRESULT (WINAPI *pVarIdiv)(LPVARIANT,LPVARIANT,LPVARIANT);
static void test_VarIdiv(void) { - static const WCHAR str1[] = { '1','\0' }; - static const WCHAR str2[] = { '2','\0' }; VARIANT left, right, exp, result, cy, dec; BSTR num1_str, num2_str; VARTYPE i; @@ -8808,8 +8781,8 @@ static void test_VarIdiv(void)
CHECKPTR(VarIdiv);
- num1_str = SysAllocString(str1); - num2_str = SysAllocString(str2); + num1_str = SysAllocString(L"1"); + num2_str = SysAllocString(L"2");
/* Test all possible flag/vt combinations & the resulting vt type */ for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++)
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/oleaut32/tests/vartest.c | 240 ++++++++++------------------------ 1 file changed, 67 insertions(+), 173 deletions(-)
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 325b4ad270c..bf52d4b1363 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -30,7 +30,6 @@ #include "windef.h" #include "winbase.h" #include "winsock2.h" -#include "wine/test.h" #include "winuser.h" #include "wingdi.h" #include "winnls.h" @@ -40,6 +39,8 @@ #include "wtypes.h" #include "oleauto.h"
+#include "wine/test.h" + static HMODULE hOleaut32;
static const WCHAR sz12[] = {'1','2','\0'}; @@ -468,113 +469,6 @@ static void setdec64(DECIMAL* dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG mid32, dec->Lo32 = lo32; }
-/* return the string text of a given variant type */ -static char vtstr_buffer[16][256]; -static int vtstr_current=0; -static const char *vtstr(int x) -{ - switch(x) { -#define CASE(vt) case VT_##vt: return #vt - CASE(EMPTY); - CASE(NULL); - CASE(I2); - CASE(I4); - CASE(R4); - CASE(R8); - CASE(CY); - CASE(DATE); - CASE(BSTR); - CASE(DISPATCH); - CASE(ERROR); - CASE(BOOL); - CASE(VARIANT); - CASE(UNKNOWN); - CASE(DECIMAL); - CASE(I1); - CASE(UI1); - CASE(UI2); - CASE(UI4); - CASE(I8); - CASE(UI8); - CASE(INT); - CASE(UINT); - CASE(VOID); - CASE(HRESULT); - CASE(PTR); - CASE(SAFEARRAY); - CASE(CARRAY); - CASE(USERDEFINED); - CASE(LPSTR); - CASE(LPWSTR); - CASE(RECORD); - CASE(INT_PTR); - CASE(UINT_PTR); - CASE(FILETIME); - CASE(BLOB); - CASE(STREAM); - CASE(STORAGE); - CASE(STREAMED_OBJECT); - CASE(STORED_OBJECT); - CASE(BLOB_OBJECT); - CASE(CF); - CASE(CLSID); - CASE(VERSIONED_STREAM); - CASE(VECTOR); - CASE(ARRAY); - CASE(BYREF); - CASE(RESERVED); - CASE(ILLEGAL); -#undef CASE - - case 0xfff: - return "VT_BSTR_BLOB/VT_ILLEGALMASKED/VT_TYPEMASK"; - - default: - vtstr_current %= ARRAY_SIZE(vtstr_buffer); - sprintf(vtstr_buffer[vtstr_current], "unknown variant type %d", x); - return vtstr_buffer[vtstr_current++]; - } -} - -static const char *variantstr( const VARIANT *var ) -{ - vtstr_current %= ARRAY_SIZE(vtstr_buffer); - switch(V_VT(var)) - { - case VT_I1: - sprintf( vtstr_buffer[vtstr_current], "VT_I1(%d)", V_I1(var) ); break; - case VT_I2: - sprintf( vtstr_buffer[vtstr_current], "VT_I2(%d)", V_I2(var) ); break; - case VT_I4: - sprintf( vtstr_buffer[vtstr_current], "VT_I4(%ld)", V_I4(var) ); break; - case VT_INT: - sprintf( vtstr_buffer[vtstr_current], "VT_INT(%d)", V_INT(var) ); break; - case VT_I8: - sprintf( vtstr_buffer[vtstr_current], "VT_I8(%I64x)", V_I8(var) ); break; - case VT_UI8: - sprintf( vtstr_buffer[vtstr_current], "VT_UI8(%I64x)", V_UI8(var) ); break; - case VT_R4: - sprintf( vtstr_buffer[vtstr_current], "VT_R4(%g)", V_R4(var) ); break; - case VT_R8: - sprintf( vtstr_buffer[vtstr_current], "VT_R8(%g)", V_R8(var) ); break; - case VT_UI1: - sprintf( vtstr_buffer[vtstr_current], "VT_UI1(%u)", V_UI1(var) ); break; - case VT_UI2: - sprintf( vtstr_buffer[vtstr_current], "VT_UI2(%u)", V_UI2(var) ); break; - case VT_UI4: - sprintf( vtstr_buffer[vtstr_current], "VT_UI4(%lu)", V_UI4(var) ); break; - case VT_UINT: - sprintf( vtstr_buffer[vtstr_current], "VT_UINT(%d)", V_UINT(var) ); break; - case VT_CY: - sprintf( vtstr_buffer[vtstr_current], "VT_CY(%lx%08lx)", V_CY(var).Hi, V_CY(var).Lo ); break; - case VT_DATE: - sprintf( vtstr_buffer[vtstr_current], "VT_DATE(%g)", V_DATE(var) ); break; - default: - return vtstr(V_VT(var)); - } - return vtstr_buffer[vtstr_current++]; -} - static BOOL is_expected_variant( const VARIANT *result, const VARIANT *expected ) { if (V_VT(result) != V_VT(expected)) return FALSE; @@ -611,7 +505,7 @@ static BOOL is_expected_variant( const VARIANT *result, const VARIANT *expected case VT_DECIMAL: return !memcmp( &V_DECIMAL(result), &V_DECIMAL(expected), sizeof(DECIMAL) ); default: - ok(0, "unhandled variant type %s\n",vtstr(V_VT(expected))); + ok(0, "unhandled variant type %s\n",wine_dbgstr_vt(V_VT(expected))); return FALSE; } } @@ -628,9 +522,9 @@ static void test_var_call1( int line, HRESULT (WINAPI *func)(LPVARIANT,LPVARIANT ok_(__FILE__,line)( hres == S_OK, "wrong result %lx\n", hres ); if (hres == S_OK) ok_(__FILE__,line)( is_expected_variant( &result, expected ), - "got %s expected %s\n", variantstr(&result), variantstr(expected) ); + "got %s expected %s\n", wine_dbgstr_variant(&result), wine_dbgstr_variant(expected) ); ok_(__FILE__,line)( is_expected_variant( arg, &old_arg ), "Modified argument %s / %s\n", - variantstr(&old_arg), variantstr(arg)); + wine_dbgstr_variant(&old_arg), wine_dbgstr_variant(arg)); VariantClear( &result ); }
@@ -646,11 +540,11 @@ static void test_var_call2( int line, HRESULT (WINAPI *func)(LPVARIANT,LPVARIANT ok_(__FILE__,line)( hres == S_OK, "wrong result %lx\n", hres ); if (hres == S_OK) ok_(__FILE__,line)( is_expected_variant( &result, expected ), - "got %s expected %s\n", variantstr(&result), variantstr(expected) ); + "got %s expected %s\n", wine_dbgstr_variant(&result), wine_dbgstr_variant(expected) ); ok_(__FILE__,line)( is_expected_variant( left, &old_left ), "Modified left argument %s / %s\n", - variantstr(&old_left), variantstr(left)); + wine_dbgstr_variant(&old_left), wine_dbgstr_variant(left)); ok_(__FILE__,line)( is_expected_variant( right, &old_right ), "Modified right argument %s / %s\n", - variantstr(&old_right), variantstr(right)); + wine_dbgstr_variant(&old_right), wine_dbgstr_variant(right)); VariantClear( &result ); }
@@ -3445,7 +3339,7 @@ static void test_VarSub(void) V_BSTR(&right) = rbstr; hres = pVarSub(&left, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, - "VarSub: expected coerced type VT_R8, got %s!\n", vtstr(V_VT(&result))); + "VarSub: expected coerced type VT_R8, got %s!\n", wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 0.0), "VarSub: BSTR + BSTR, expected %f got %f\n", 0.0, V_R8(&result));
@@ -3465,13 +3359,13 @@ static void test_VarSub(void)
hres = pVarSub(&cy, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_CY, - "VarSub: expected coerced type VT_CY, got %s!\n", vtstr(V_VT(&result))); + "VarSub: expected coerced type VT_CY, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromCy(V_CY(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, 4702.0), "VarSub: CY value %f, expected %f\n", r, 4720.0);
hres = pVarSub(&left, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, - "VarSub: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result))); + "VarSub: expected coerced type VT_DECIMAL, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromDec(&V_DECIMAL(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, -6.8), "VarSub: DECIMAL value %f, expected %f\n", r, -6.8);
@@ -3493,7 +3387,7 @@ static void test_Mod( int line, VARIANT *left, VARIANT *right, VARIANT *expected if (hres == S_OK) { ok_(__FILE__,line)( is_expected_variant( &result, expected ), - "got %s expected %s\n", variantstr(&result), variantstr(expected) ); + "got %s expected %s\n", wine_dbgstr_variant(&result), wine_dbgstr_variant(expected) ); } else { @@ -4354,7 +4248,7 @@ static void test_Round( int line, VARIANT *arg, int deci, VARIANT *expected ) ok_(__FILE__,line)( hres == S_OK, "wrong result %lx\n", hres ); if (hres == S_OK) ok_(__FILE__,line)( is_expected_variant( &result, expected ), - "got %s expected %s\n", variantstr(&result), variantstr(expected) ); + "got %s expected %s\n", wine_dbgstr_variant(&result), wine_dbgstr_variant(expected) ); } #define VARROUND(vt,val,deci,rvt,rval) \ V_VT(&v) = VT_##vt; V_##vt(&v) = val; \ @@ -6281,12 +6175,12 @@ static void test_VarMul(void) V_UI1(&right) = 9;
hres = pVarMul(&cy, &right, &result); - ok(hres == S_OK && V_VT(&result) == VT_CY, "VarMul: expected coerced type VT_CY, got %s!\n", vtstr(V_VT(&result))); + ok(hres == S_OK && V_VT(&result) == VT_CY, "VarMul: expected coerced type VT_CY, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromCy(V_CY(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, 42399.0), "VarMul: CY value %f, expected %f\n", r, 42399.0);
hres = pVarMul(&left, &dec, &result); - ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, "VarMul: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result))); + ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, "VarMul: expected coerced type VT_DECIMAL, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromDec(&V_DECIMAL(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, 46.2), "VarMul: DECIMAL value %f, expected %f\n", r, 46.2);
@@ -6452,7 +6346,7 @@ static void test_VarAdd(void) V_VT(&right) = VT_BSTR; V_BSTR(&right) = rbstr; hres = pVarAdd(&left, &right, &result); - ok(hres == S_OK && V_VT(&result) == VT_BSTR, "VarAdd: expected coerced type VT_BSTR, got %s!\n", vtstr(V_VT(&result))); + ok(hres == S_OK && V_VT(&result) == VT_BSTR, "VarAdd: expected coerced type VT_BSTR, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromStr(V_BSTR(&result), 0, 0, &r); ok(hres == S_OK && EQ_DOUBLE(r, 1212.0), "VarAdd: BSTR value %f, expected %f\n", r, 1212.0); VariantClear(&result); @@ -6472,12 +6366,12 @@ static void test_VarAdd(void) V_UI1(&right) = 9;
hres = pVarAdd(&cy, &right, &result); - ok(hres == S_OK && V_VT(&result) == VT_CY, "VarAdd: expected coerced type VT_CY, got %s!\n", vtstr(V_VT(&result))); + ok(hres == S_OK && V_VT(&result) == VT_CY, "VarAdd: expected coerced type VT_CY, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromCy(V_CY(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, 4720.0), "VarAdd: CY value %f, expected %f\n", r, 4720.0);
hres = pVarAdd(&left, &dec, &result); - ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, "VarAdd: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result))); + ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, "VarAdd: expected coerced type VT_DECIMAL, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromDec(&V_DECIMAL(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, -15.2), "VarAdd: DECIMAL value %f, expected %f\n", r, -15.2); VariantClear(&result); @@ -6686,7 +6580,7 @@ static void test_VarCat(void) ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); hres = VarCmp(&result, &expected, lcid, 0); ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", - hres, variantstr(&result), variantstr(&expected)); + hres, wine_dbgstr_variant(&result), wine_dbgstr_variant(&expected));
VariantClear(&left); VariantClear(&right); @@ -6703,7 +6597,7 @@ static void test_VarCat(void) ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); hres = VarCmp(&result, &expected, lcid, 0); ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", - hres, variantstr(&result), variantstr(&expected)); + hres, wine_dbgstr_variant(&result), wine_dbgstr_variant(&expected));
VariantClear(&left); VariantClear(&right); @@ -7035,13 +6929,13 @@ static void test_VarAnd(void) if (bFail) ok (hres == DISP_E_BADVARTYPE || hres == DISP_E_TYPEMISMATCH, "VarAnd: %s|0x%X, %s|0x%X: got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], - vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], + wine_dbgstr_vt(V_VT(&result)), hres); else ok (hres == S_OK && resvt == V_VT(&result), "VarAnd: %s|0x%X, %s|0x%X: expected vt %s hr 0x%lX, got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], vtstr(resvt), - S_OK, vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], wine_dbgstr_vt(resvt), + S_OK, wine_dbgstr_vt(V_VT(&result)), hres); } } } @@ -7602,7 +7496,7 @@ static void test_cmp( int line, LCID lcid, UINT flags, VARIANT *left, VARIANT *r
hres = VarCmp(left,right,lcid,flags); ok_(__FILE__,line)(hres == result, "VarCmp(%s,%s): expected 0x%lx, got hres=0x%lx\n", - variantstr(left), variantstr(right), result, hres ); + wine_dbgstr_variant(left), wine_dbgstr_variant(right), result, hres ); } static void test_cmpex( int line, LCID lcid, VARIANT *left, VARIANT *right, HRESULT res1, HRESULT res2, HRESULT res3, HRESULT res4 ) @@ -7955,13 +7849,13 @@ static void test_VarPow(void) if (bFail) ok (hres == DISP_E_BADVARTYPE || hres == DISP_E_TYPEMISMATCH, "VarPow: %s|0x%X, %s|0x%X: got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], - vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], + wine_dbgstr_vt(V_VT(&result)), hres); else ok (hres == S_OK && resvt == V_VT(&result), "VarPow: %s|0x%X, %s|0x%X: expected vt %s hr 0x%lX, got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], vtstr(resvt), - S_OK, vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], wine_dbgstr_vt(resvt), + S_OK, wine_dbgstr_vt(V_VT(&result)), hres); } } } @@ -8321,7 +8215,7 @@ static void test_VarPow(void) hres = pVarPow(&cy, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, "VARPOW: expected coerced hres 0x%lX type VT_R8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 4.0), "VARPOW: CY value %f, expected %f\n", V_R8(&result), 4.0);
@@ -8330,7 +8224,7 @@ static void test_VarPow(void) { ok(V_VT(&result) == VT_R8, "VARPOW: expected coerced hres 0x%lX type VT_R8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(EQ_DOUBLE(V_R8(&result), 4.0), "VARPOW: CY value %f, expected %f\n", V_R8(&result), 4.0); } @@ -8338,27 +8232,27 @@ static void test_VarPow(void) { ok(hres == DISP_E_BADVARTYPE && V_VT(&result) == VT_EMPTY, "VARPOW: expected coerced hres 0x%lX type VT_EMPTY, got hres 0x%lX type %s!\n", - DISP_E_BADVARTYPE, hres, vtstr(V_VT(&result))); + DISP_E_BADVARTYPE, hres, wine_dbgstr_vt(V_VT(&result))); }
hres = pVarPow(&left, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, "VARPOW: expected coerced hres 0x%lX type VT_R8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 10000.0), "VARPOW: CY value %f, expected %f\n", V_R8(&result), 10000.0);
hres = pVarPow(&left, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, "VARPOW: expected coerced hres 0x%lX type VT_R8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result),10000.0), "VARPOW: DECIMAL value %f, expected %f\n", V_R8(&result), 10000.0);
hres = pVarPow(&dec, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, "VARPOW: expected coerced hres 0x%lX type VT_R8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 4.0), "VARPOW: DECIMAL value %f, expected %f\n", V_R8(&result), 4.0);
@@ -8367,7 +8261,7 @@ static void test_VarPow(void) { ok(V_VT(&result) == VT_R8, "VARPOW: expected coerced hres 0x%lX type VT_R8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(EQ_DOUBLE(V_R8(&result), 4.0), "VARPOW: DECIMAL value %f, expected %f\n", V_R8(&result), 4.0); } @@ -8375,7 +8269,7 @@ static void test_VarPow(void) { ok(hres == DISP_E_BADVARTYPE && V_VT(&result) == VT_EMPTY, "VARPOW: expected coerced hres 0x%lX type VT_EMPTY, got hres 0x%lX type %s!\n", - DISP_E_BADVARTYPE, hres, vtstr(V_VT(&result))); + DISP_E_BADVARTYPE, hres, wine_dbgstr_vt(V_VT(&result))); }
SysFreeString(num2_str); @@ -8527,13 +8421,13 @@ static void test_VarDiv(void) ok (hres == DISP_E_BADVARTYPE || hres == DISP_E_TYPEMISMATCH || hres == DISP_E_OVERFLOW || hres == DISP_E_DIVBYZERO, "VarDiv: %s|0x%X, %s|0x%X: got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], - vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], + wine_dbgstr_vt(V_VT(&result)), hres); else ok (hres == S_OK && resvt == V_VT(&result), "VarDiv: %s|0x%X, %s|0x%X: expected vt %s hr 0x%lX, got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], vtstr(resvt), - S_OK, vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], wine_dbgstr_vt(resvt), + S_OK, wine_dbgstr_vt(V_VT(&result)), hres); } } } @@ -8701,37 +8595,37 @@ static void test_VarDiv(void)
hres = pVarDiv(&cy, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, - "VARDIV: expected coerced type VT_R8, got %s!\n", vtstr(V_VT(&result))); + "VARDIV: expected coerced type VT_R8, got %s!\n", wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 1.0), "VARDIV: CY value %f, expected %f\n", V_R8(&result), 1.0);
hres = pVarDiv(&cy, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, - "VARDIV: expected coerced type VT_R8, got %s!\n", vtstr(V_VT(&result))); + "VARDIV: expected coerced type VT_R8, got %s!\n", wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 5000.0), "VARDIV: CY value %f, expected %f\n", V_R8(&result), 5000.0);
hres = pVarDiv(&left, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_R8, - "VARDIV: expected coerced type VT_R8, got %s!\n", vtstr(V_VT(&result))); + "VARDIV: expected coerced type VT_R8, got %s!\n", wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && EQ_DOUBLE(V_R8(&result), 0.01), "VARDIV: CY value %f, expected %f\n", V_R8(&result), 0.01);
hres = pVarDiv(&left, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, - "VARDIV: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result))); + "VARDIV: expected coerced type VT_DECIMAL, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromDec(&V_DECIMAL(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, 50.0), "VARDIV: DECIMAL value %f, expected %f\n", r, 50.0);
hres = pVarDiv(&dec, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, - "VARDIV: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result))); + "VARDIV: expected coerced type VT_DECIMAL, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromDec(&V_DECIMAL(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, 1.0), "VARDIV: DECIMAL value %f, expected %f\n", r, 1.0);
hres = pVarDiv(&dec, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, - "VARDIV: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result))); + "VARDIV: expected coerced type VT_DECIMAL, got %s!\n", wine_dbgstr_vt(V_VT(&result))); hres = VarR8FromDec(&V_DECIMAL(&result), &r); ok(hres == S_OK && EQ_DOUBLE(r, 1.0), "VARDIV: DECIMAL value %f, expected %f\n", r, 1.0);
@@ -8902,13 +8796,13 @@ static void test_VarIdiv(void) ok (hres == DISP_E_BADVARTYPE || hres == DISP_E_TYPEMISMATCH || hres == DISP_E_DIVBYZERO, "VarIdiv: %s|0x%X, %s|0x%X: got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], - vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], + wine_dbgstr_vt(V_VT(&result)), hres); else ok (hres == S_OK && resvt == V_VT(&result), "VarIdiv: %s|0x%X, %s|0x%X: expected vt %s hr 0x%lX, got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], vtstr(resvt), - S_OK, vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], wine_dbgstr_vt(resvt), + S_OK, wine_dbgstr_vt(V_VT(&result)), hres); } } } @@ -9251,7 +9145,7 @@ static void test_VarIdiv(void) hres = pVarIdiv(&cy, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIDIV: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == 1, "VARIDIV: CY value %ld, expected %d\n", V_I4(&result), 1);
@@ -9260,7 +9154,7 @@ static void test_VarIdiv(void) hres = pVarIdiv(&cy, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_I8, "VARIDIV: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == 5000, "VARIDIV: CY value %#I64x, expected %#x\n", V_I8(&result), 5000); @@ -9269,21 +9163,21 @@ static void test_VarIdiv(void) hres = pVarIdiv(&left, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIDIV: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == 0, "VARIDIV: CY value %ld, expected %d\n", V_I4(&result), 0);
hres = pVarIdiv(&left, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIDIV: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == 50, "VARIDIV: DECIMAL value %ld, expected %d\n", V_I4(&result), 50);
hres = pVarIdiv(&dec, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIDIV: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == 1, "VARIDIV: DECIMAL value %ld, expected %d\n", V_I4(&result), 1);
@@ -9292,7 +9186,7 @@ static void test_VarIdiv(void) hres = pVarIdiv(&dec, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_I8, "VARIDIV: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == 1, "VARIDIV: DECIMAL value %I64d, expected %d\n", V_I8(&result), 1); @@ -9467,13 +9361,13 @@ static void test_VarImp(void) if (bFail) ok (hres == DISP_E_BADVARTYPE || hres == DISP_E_TYPEMISMATCH, "VarImp: %s|0x%X, %s|0x%X: got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], - vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], + wine_dbgstr_vt(V_VT(&result)), hres); else ok (hres == S_OK && resvt == V_VT(&result), "VarImp: %s|0x%X, %s|0x%X: expected vt %s hr 0x%lX, got vt %s hr 0x%lX\n", - vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], vtstr(resvt), - S_OK, vtstr(V_VT(&result)), hres); + wine_dbgstr_vt(leftvt), ExtraFlags[i], wine_dbgstr_vt(rightvt), ExtraFlags[i], wine_dbgstr_vt(resvt), + S_OK, wine_dbgstr_vt(V_VT(&result)), hres); } } } @@ -9831,7 +9725,7 @@ static void test_VarImp(void) hres = pVarImp(&cy, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIMP: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == -1, "VARIMP: CY value %ld, expected %d\n", V_I4(&result), -1);
@@ -9840,7 +9734,7 @@ static void test_VarImp(void) hres = pVarImp(&cy, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_I8, "VARIMP: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == -2, "VARIMP: CY value %I64d, expected %d\n", V_I8(&result), -2); @@ -9849,21 +9743,21 @@ static void test_VarImp(void) hres = pVarImp(&left, &cy, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIMP: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == -1, "VARIMP: CY value %ld, expected %d\n", V_I4(&result), -1);
hres = pVarImp(&left, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIMP: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == -1, "VARIMP: DECIMAL value %ld, expected %d\n", V_I4(&result), -1);
hres = pVarImp(&dec, &dec, &result); ok(hres == S_OK && V_VT(&result) == VT_I4, "VARIMP: expected coerced hres 0x%lX type VT_I4, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I4(&result) == -1, "VARIMP: DECIMAL value %ld, expected %d\n", V_I4(&result), -1);
@@ -9872,7 +9766,7 @@ static void test_VarImp(void) hres = pVarImp(&dec, &right, &result); ok(hres == S_OK && V_VT(&result) == VT_I8, "VARIMP: expected coerced hres 0x%lX type VT_I8, got hres 0x%lX type %s!\n", - S_OK, hres, vtstr(V_VT(&result))); + S_OK, hres, wine_dbgstr_vt(V_VT(&result))); ok(hres == S_OK && V_I8(&result) == -3, "VARIMP: DECIMAL value %#I64x, expected %d\n", V_I8(&result), -3);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/oleaut32/tests/vartest.c | 72 ++++++++++------------------------- 1 file changed, 20 insertions(+), 52 deletions(-)
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index bf52d4b1363..05872739c9e 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -6383,7 +6383,7 @@ static void test_VarAdd(void) static void test_VarCat(void) { LCID lcid; - VARIANT left, right, result, expected, expected_broken; + VARIANT left, right, result; CHAR orig_date_format[128]; VARTYPE leftvt, rightvt, resultvt; HRESULT hres; @@ -6399,7 +6399,6 @@ static void test_VarCat(void) VariantInit(&left); VariantInit(&right); VariantInit(&result); - VariantInit(&expected);
/* Check expected types for all combinations */ for (leftvt = 0; leftvt <= VT_BSTR_BLOB; leftvt++) @@ -6530,14 +6529,12 @@ static void test_VarCat(void) /* Test concat strings */ V_VT(&left) = VT_BSTR; V_VT(&right) = VT_BSTR; - V_VT(&expected) = VT_BSTR; V_BSTR(&left) = SysAllocString(L"12"); V_BSTR(&right) = SysAllocString(L"34"); - V_BSTR(&expected) = SysAllocString(L"1234"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, - "VarCat: VT_BSTR concat with VT_BSTR failed to return correct result\n"); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), L"1234"), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); @@ -6567,54 +6564,43 @@ static void test_VarCat(void) VariantClear(&left); VariantClear(&right); VariantClear(&result); - VariantClear(&expected);
/* Test combining boolean with number */ V_VT(&left) = VT_INT; V_VT(&right) = VT_BOOL; - V_VT(&expected) = VT_BSTR; V_INT(&left) = 12; V_BOOL(&right) = TRUE; - V_BSTR(&expected) = SysAllocString(sz12_true); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - hres = VarCmp(&result, &expected, lcid, 0); - ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", - hres, wine_dbgstr_variant(&result), wine_dbgstr_variant(&expected)); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), sz12_true), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); VariantClear(&result); - VariantClear(&expected);
V_VT(&left) = VT_INT; V_VT(&right) = VT_BOOL; - V_VT(&expected) = VT_BSTR; V_INT(&left) = 12; V_BOOL(&right) = FALSE; - V_BSTR(&expected) = SysAllocString(sz12_false); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - hres = VarCmp(&result, &expected, lcid, 0); - ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08lx for %s, %s\n", - hres, wine_dbgstr_variant(&result), wine_dbgstr_variant(&expected)); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), sz12_false), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); VariantClear(&result); - VariantClear(&expected);
/* Test when both expressions are numeric */ V_VT(&left) = VT_INT; V_VT(&right) = VT_INT; - V_VT(&expected) = VT_BSTR; V_INT(&left) = 12; V_INT(&right) = 34; - V_BSTR(&expected) = SysAllocString(L"1234"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - ok(VarCmp(&result, &expected, lcid, 0) == VARCMP_EQ, - "VarCat: NUMBER concat with NUMBER returned incorrect result\n"); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), L"1234"), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); @@ -6627,8 +6613,8 @@ static void test_VarCat(void) V_BSTR(&right) = SysAllocString(L"34"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, - "VarCat: NUMBER concat with VT_BSTR, incorrect result\n"); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), L"1234"), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); @@ -6640,66 +6626,49 @@ static void test_VarCat(void) V_INT(&right) = 34; hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ, - "VarCat: VT_BSTR concat with NUMBER, incorrect result\n"); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), L"1234"), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); VariantClear(&result); - VariantClear(&expected);
/* Test concat dates with strings */ V_VT(&left) = VT_BSTR; V_VT(&right) = VT_DATE; - V_VT(&expected) = VT_BSTR; - V_VT(&expected_broken) = VT_BSTR; V_BSTR(&left) = SysAllocString(L"12"); V_DATE(&right) = 29494.0; - V_BSTR(&expected)= SysAllocString(L"129/30/1980"); - V_BSTR(&expected_broken)= SysAllocString(L"129/30/80"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ || - broken(VarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */ - "VarCat: VT_BSTR concat with VT_DATE returned incorrect result\n"); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), L"129/30/1980"), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); VariantClear(&result); - VariantClear(&expected); - VariantClear(&expected_broken);
V_VT(&left) = VT_DATE; V_VT(&right) = VT_BSTR; - V_VT(&expected) = VT_BSTR; - V_VT(&expected_broken) = VT_BSTR; V_DATE(&left) = 29494.0; V_BSTR(&right) = SysAllocString(L"12"); - V_BSTR(&expected) = SysAllocString(L"9/30/198012"); - V_BSTR(&expected_broken) = SysAllocString(L"9/30/8012"); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - ok(VarCmp(&result,&expected,lcid,0) == VARCMP_EQ || - broken(VarCmp(&result,&expected_broken,lcid,0) == VARCMP_EQ), /* Some W98 and NT4 (intermittent) */ - "VarCat: VT_DATE concat with VT_BSTR returned incorrect result\n"); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), L"9/30/198012"), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
VariantClear(&left); VariantClear(&right); VariantClear(&result); - VariantClear(&expected); - VariantClear(&expected_broken);
/* Test of both expressions are empty */ V_VT(&left) = VT_BSTR; V_VT(&right) = VT_BSTR; - V_VT(&expected) = VT_BSTR; V_BSTR(&left) = SysAllocString(L""); V_BSTR(&right) = SysAllocString(L""); - V_BSTR(&expected)= SysAllocString(L""); hres = VarCat(&left,&right,&result); ok(hres == S_OK, "VarCat failed with error 0x%08lx\n", hres); - ok(VarCmp(&result,&left,lcid,0) == VARCMP_EQ, - "VarCat: EMPTY concat with EMPTY did not return empty VT_BSTR\n"); + ok(V_VT(&result) == VT_BSTR, "Unexpected return type %d.\n", V_VT(&result)); + ok(!wcscmp(V_BSTR(&result), L""), "Unexpected return value %s.\n", wine_dbgstr_w(V_BSTR(&result)));
/* Restore original date format settings */ SetLocaleInfoA(lcid,LOCALE_SSHORTDATE,orig_date_format); @@ -6707,7 +6676,6 @@ static void test_VarCat(void) VariantClear(&left); VariantClear(&right); VariantClear(&result); - VariantClear(&expected);
/* Dispatch conversion */ init_test_dispatch(VT_NULL, &dispatch); @@ -9808,7 +9776,7 @@ START_TEST(vartest) test_VarEqv(); test_VarMul(); test_VarAdd(); - test_VarCmp(); /* Before test_VarCat() which needs VarCmp() */ + test_VarCmp(); test_VarCat(); test_VarAnd(); test_VarDiv();