58#define CHECKPTR(func) p##func = (void*)GetProcAddress(hOleaut32, #func); \
59 if (!p##func) { win_skip("function " # func " not available, not testing it\n"); return; }
67#define EQ_DOUBLE(a,b) (fabs((a)-(b)) / (1.0+fabs(a)+fabs(b)) < 1e-14)
68#define EQ_FLOAT(a,b) (fabs((a)-(b)) / (1.0+fabs(a)+fabs(b)) < 1e-7)
70#define SKIPTESTS(a) if((a > VT_CLSID+10) && (a < VT_BSTR_BLOB-10)) continue
73#define V_EMPTY(v) V_I4(v)
74#define V_NULL(v) V_I4(v)
78#define I1_MIN ((-I1_MAX)-1)
82#define I2_MIN ((-I2_MAX)-1)
85#define I4_MAX 0x7fffffff
86#define I4_MIN ((-I4_MAX)-1)
87#define UI4_MAX 0xffffffff
89#define I8_MAX (((LONGLONG)I4_MAX << 32) | UI4_MAX)
90#define I8_MIN ((-I8_MAX)-1)
91#define UI8_MAX (((ULONGLONG)UI4_MAX << 32) | UI4_MAX)
93#define DATE_MAX 2958465
94#define DATE_MIN -657434
100#define DEFINE_EXPECT(func) \
101 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
103#define SET_EXPECT(func) \
104 do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
106#define CHECK_EXPECT2(func) \
108 ok(expect_ ##func, "unexpected call " #func "\n"); \
109 called_ ## func = TRUE; \
112#define CHECK_EXPECT(func) \
114 CHECK_EXPECT2(func); \
115 expect_ ## func = FALSE; \
118#define CHECK_CALLED(func) \
120 ok(called_ ## func, "expected " #func "\n"); \
121 expect_ ## func = called_ ## func = FALSE; \
158 IDispatch_AddRef(iface);
166 ok(0,
"Unexpected call\n");
172 ok(0,
"Unexpected call\n");
179 ok(0,
"Unexpected call\n");
195 ok(dispid == DISPID_VALUE,
"got dispid %d\n", dispid);
206 ok(ei ==
NULL,
"got %p\n", ei);
207 ok(arg_err ==
NULL,
"got %p\n", arg_err);
267 IRecordInfo_AddRef(iface);
293 ok(0,
"unexpected call\n");
309 ok(
src == (
void*)0xdeadbeef,
"wrong src pointer %p\n",
src);
315 ok(0,
"unexpected call\n");
321 ok(0,
"unexpected call\n");
335 ok(0,
"unexpected call\n");
340 LPCOLESTR szFieldName,
VARIANT *pvarField)
342 ok(0,
"unexpected call\n");
347 LPCOLESTR szFieldName,
VARIANT *pvarField,
PVOID *ppvDataCArray)
349 ok(0,
"unexpected call\n");
354 LPCOLESTR szFieldName,
VARIANT *pvarField)
356 ok(0,
"unexpected call\n");
363 ok(0,
"unexpected call\n");
370 ok(0,
"unexpected call\n");
376 ok(0,
"unexpected call\n");
382 ok(0,
"unexpected call\n");
389 ok(0,
"unexpected call\n");
395 ok(0,
"unexpected call\n");
442 ok(
res ==
S_OK && bstr[0],
"Expected localized string for 'True'\n");
449 ok(
res ==
S_OK && bstr[0],
"Expected localized string for 'False'\n");
457 skip(
"No support for I8 and UI8 data types\n");
463 S(
U(*
dec)).scale = scl;
466 U1(*dec).Lo64 = lo64;
471 S(
U(*
dec)).scale = scl;
484#define CASE(vt) case VT_##vt: return #vt
523 CASE(STREAMED_OBJECT);
528 CASE(VERSIONED_STREAM);
537 return "VT_BSTR_BLOB/VT_ILLEGALMASKED/VT_TYPEMASK";
594#define CASE(vt) case VT_##vt: return (V_##vt(result) == V_##vt(expected))
671#define test_bstr_var(a,b) _test_bstr_var(__LINE__,a,b)
788 "VariantClear: Type set to %d, res %08x\n",
V_VT(&
v),
hres);
789 ok(
V_UI4(&
v) == ~0
u,
"VariantClear: Overwrote value\n");
813 ok(
hres == hExpected,
"VariantClear: expected 0x%X, got 0x%X for vt %d | 0x%X\n",
842 ok(i4 == 0x4321,
"i4 changed %08x\n", i4);
897 rec->pvRecord = (
void*)0xdeadbeef;
903 ok(rec->pvRecord ==
NULL,
"got %p\n", rec->pvRecord);
905 ok(recinfo->
ref == 1,
"got %d\n", recinfo->
ref);
930 memset(&vSrc, 0,
sizeof(vSrc));
941 "Copy(src==dst): expected 0x%X, got 0x%X for src==dest vt %d|0x%X\n",
949 memset(&vSrc, 0,
sizeof(vSrc));
960 memset(&vDst, 0,
sizeof(vDst));
969 "Copy(bad dst): expected 0x%X, got 0x%X for dest vt %d|0x%X\n",
973 "Copy(bad dst): expected vt = VT_UI1, got %d\n",
V_VT(&vDst));
986 memset(&vDst, 0,
sizeof(vDst));
989 memset(&vSrc, 0,
sizeof(vSrc));
999 "Copy(bad src): expected 0x%X, got 0x%X for src vt %d|0x%X\n",
1004 "Copy(bad src): expected vt = %d, got %d\n",
1012 memset(&vDst, 0,
sizeof(vDst));
1014 memset(&vSrc, 0,
sizeof(vSrc));
1017 ok(
hres ==
S_OK,
"Copy(NULL BSTR): Failed to copy a NULL BSTR\n");
1021 "Copy(NULL BSTR): should have non-NULL result\n");
1024 ok(*
V_BSTR(&vDst) == 0,
"Copy(NULL BSTR): result not empty\n");
1032 memset(&vDst, 0,
sizeof(vDst));
1036 rec = &
V_UNION(&vSrc, brecVal);
1038 rec->pvRecord = (
void*)0xdeadbeef;
1047 rec = &
V_UNION(&vDst, brecVal);
1048 ok(rec->pvRecord != (
void*)0xdeadbeef && rec->pvRecord !=
NULL,
"got %p\n", rec->pvRecord);
1091 memset(&vSrc, 0,
sizeof(vSrc));
1123 "CopyInd(src==dst): expected 0x%X, got 0x%X for src==dst vt %d|0x%X\n",
1129 memset(&vSrc, 0,
sizeof(vSrc));
1139 memset(&vDst, 0,
sizeof(vDst));
1150 "CopyInd(bad dst): expected 0x%X, got 0x%X for dst vt %d|0x%X\n",
1154 "CopyInd(bad dst): expected vt = VT_UI1, got %d\n",
V_VT(&vDst));
1168 memset(&vDst, 0,
sizeof(vDst));
1171 memset(&vSrc, 0,
sizeof(vSrc));
1204 "CopyInd(bad src): expected 0x%X, got 0x%X for src vt %d|0x%X\n",
1215 "CopyInd(bad src): expected dst vt = VT_EMPTY, got %d|0x%X\n",
1221 "CopyInd(bad src): expected dst vt = %d|0x%X, got %d|0x%X\n",
1232 V_UI1(&vRef) = 0x77;
1240 "CopyInd(deref): expected dst vt = VT_UI1, val 0x77, got %d|0x%X, 0x%2X\n",
1253 "CopyInd(deref): expected dst vt = VT_UI1, val 0x77, got %d|0x%X, 0x%2X\n",
1258 V_UI1(&vRef2) = 0x77;
1267 "CopyInd(ref->ref): expected E_INVALIDARG, got 0x%08x\n",
hres);
1281 memset( np, 255,
sizeof(*np) );
1301#define CONVERTN(str,dig,flags) hres = convert_str( str, dig, flags, &np, rgb, lcid )
1302#define CONVERT(str,flags) CONVERTN(str,sizeof(rgb),flags)
1303#define EXPECT(a,b,c,d,e,f) expect_NumFromStr( __LINE__, hres, &np, a, b, c, d, e, f )
1304#define EXPECTRGB(a,b) ok(rgb[a] == b, "Digit[%d], expected %d, got %d\n", a, b, rgb[a])
1305#define EXPECTFAIL ok(hres == (HRESULT)DISP_E_TYPEMISMATCH, "Call succeeded, hres = %08x\n", hres)
1306#define EXPECT2(a,b) EXPECTRGB(0,a); EXPECTRGB(1,b)
1742#define SETRGB(indx,val) if (!indx) memset(rgb, FAILDIG, sizeof(rgb)); rgb[indx] = val
1744#define CONVERT(a,b,c,d,e,f,bits) \
1745 np.cDig = (a); np.dwInFlags = (b); np.dwOutFlags = (c); np.cchUsed = (d); \
1746 np.nBaseShift = (e); np.nPwr10 = (f); hres = pVarNumFromParseNum(&np, rgb, bits, &vOut)
1748#define EXPECT_OVERFLOW ok(hres == (HRESULT)DISP_E_OVERFLOW, szFailOverflow, hres)
1749static const char *
szFailOk =
"Call failed, hres = %08x\n";
1750#define EXPECT_OK ok(hres == (HRESULT)S_OK, szFailOk, hres); \
1751 if (hres == (HRESULT)S_OK)
1752#define EXPECT_TYPE(typ) ok(V_VT(&vOut) == typ,"Expected Type = " #typ ", got %d\n", V_VT(&vOut))
1753#define EXPECT_I1(val) EXPECT_OK { EXPECT_TYPE(VT_I1); \
1754 ok(V_I1(&vOut) == val, "Expected i1 = %d, got %d\n", (signed char)val, V_I1(&vOut)); }
1755#define EXPECT_UI1(val) EXPECT_OK { EXPECT_TYPE(VT_UI1); \
1756 ok(V_UI1(&vOut) == val, "Expected ui1 = %d, got %d\n", (BYTE)val, V_UI1(&vOut)); }
1757#define EXPECT_I2(val) EXPECT_OK { EXPECT_TYPE(VT_I2); \
1758 ok(V_I2(&vOut) == val, "Expected i2 = %d, got %d\n", (SHORT)val, V_I2(&vOut)); }
1759#define EXPECT_UI2(val) EXPECT_OK { EXPECT_TYPE(VT_UI2); \
1760 ok(V_UI2(&vOut) == val, "Expected ui2 = %d, got %d\n", (USHORT)val, V_UI2(&vOut)); }
1761#define EXPECT_I4(val) EXPECT_OK { EXPECT_TYPE(VT_I4); \
1762 ok(V_I4(&vOut) == val, "Expected i4 = %d, got %d\n", (LONG)val, V_I4(&vOut)); }
1763#define EXPECT_UI4(val) EXPECT_OK { EXPECT_TYPE(VT_UI4); \
1764 ok(V_UI4(&vOut) == val, "Expected ui4 = %d, got %d\n", (ULONG)val, V_UI4(&vOut)); }
1765#define EXPECT_I8(high,low) EXPECT_OK { EXPECT_TYPE(VT_I8); \
1766 ok(V_I8(&vOut) == ((((ULONG64)(high))<<32)|(low)), "Expected i8 = %x%08x, got %x%08x\n", \
1767 (LONG)(high), (LONG)(low), (LONG)(V_I8(&vOut)>>32), (LONG)V_I8(&vOut) ); }
1768#define EXPECT_UI8(val) EXPECT_OK { EXPECT_TYPE(VT_UI8); \
1769 ok(V_UI8(&vOut) == val, "Expected ui8 = 0x%x%08x, got 0x%x%08x\n", \
1770 (DWORD)((ULONG64)val >> 32), (DWORD)(ULONG64)val, (DWORD)(V_UI8(&vOut) >> 32), (DWORD)V_UI8(&vOut)); }
1771#define EXPECT_R4(val) EXPECT_OK { EXPECT_TYPE(VT_R4); \
1772 ok(V_R4(&vOut) == val, "Expected r4 = %f, got %f\n", val, V_R4(&vOut)); }
1773#define EXPECT_R8(val) EXPECT_OK { EXPECT_TYPE(VT_R8); \
1774 ok(V_R8(&vOut) == val, "Expected r8 = %g, got %g\n", val, V_R8(&vOut)); }
1775#define CY_MULTIPLIER 10000
1776#define EXPECT_CY(val) EXPECT_OK { EXPECT_TYPE(VT_CY); \
1777 ok(V_CY(&vOut).int64 == (LONG64)(val * CY_MULTIPLIER), "Expected r8 = 0x%x%08x, got 0x%x%08x\n", \
1778 (DWORD)((LONG64)val >> 23), (DWORD)(LONG64)val, (DWORD)(V_CY(&vOut).int64 >>32), (DWORD)V_CY(&vOut).int64); }
1779#define EXPECT_DECIMAL(valHi, valMid, valLo) EXPECT_OK { EXPECT_TYPE(VT_DECIMAL); \
1780 ok((V_DECIMAL(&vOut).Hi32 == valHi) && (S1(U1(V_DECIMAL(&vOut))).Mid32 == valMid) && \
1781 (S1(U1(V_DECIMAL(&vOut))).Lo32 == valLo), \
1782 "Expected decimal = %x/0x%x%08x, got %x/0x%x%08x\n", valHi, valMid, valLo, \
1783 V_DECIMAL(&vOut).Hi32, S1(U1(V_DECIMAL(&vOut))).Mid32, S1(U1(V_DECIMAL(&vOut))).Lo32); }
1803#define INTEGER_VTBITS (VTBIT_I1|VTBIT_UI1|VTBIT_I2|VTBIT_UI2|VTBIT_I4|VTBIT_UI4|VTBIT_I8|VTBIT_UI8)
1964 memset(&ud, 0,
sizeof(ud));
1965 res = pVarUdateFromDate(dt,
flags, &ud);
1969 "%.16g expected res(%x) %d,%d,%d,%d,%d,%d,%d %d %d, got res(%x) %d,%d,%d,%d,%d,%d,%d %d %d\n",
1970 dt,
r,
d,
m,
y,
h, mn,
s, ms,
dw,
dy,
1974#define DT2UD(dt,flags,r,d,m,y,h,mn,s,ms,dw,dy) test_UdateFromDate(__LINE__,dt,flags,r,d,m,y,h,mn,s,ms,dw,dy)
1979 DT2UD(29221.0,0,
S_OK,1,1,1980,0,0,0,0,2,1);
1980 DT2UD(29222.0,0,
S_OK,2,1,1980,0,0,0,0,3,2);
1981 DT2UD(33238.0,0,
S_OK,31,12,1990,0,0,0,0,1,365);
1982 DT2UD(0.0,0,
S_OK,30,12,1899,0,0,0,0,6,364);
1983 DT2UD(-657434.0,0,
S_OK,1,1,100,0,0,0,0,5,1);
1984 DT2UD(-657435.0,0,
E_INVALIDARG,0,0,0,0,0,0,0,0,0);
1985 DT2UD(2958465.0,0,
S_OK,31,12,9999,0,0,0,0,5,365);
1986 DT2UD(2958466.0,0,
E_INVALIDARG,0,0,0,0,0,0,0,0,0);
1989 DT2UD(-657435.0,
VAR_VALIDDATE,
E_INVALIDARG,0,0,0,0,0,0,0,0,0);
1990 DT2UD(2958466.0,
VAR_VALIDDATE,
E_INVALIDARG,0,0,0,0,0,0,0,0,0);
1993 DT2UD(29221.25,0,
S_OK,1,1,1980,6,0,0,0,2,1);
1994 DT2UD(29221.33333333,0,
S_OK,1,1,1980,8,0,0,0,2,1);
1995 DT2UD(29221.5,0,
S_OK,1,1,1980,12,0,0,0,2,1);
1996 DT2UD(29221.9888884444,0,
S_OK,1,1,1980,23,44,0,0,2,1);
1997 DT2UD(29221.7508765432,0,
S_OK,1,1,1980,18,1,16,0,2,1);
2000 DT2UD(-5.25,0,
S_OK,25,12,1899,6,0,0,0,1,359);
2001 DT2UD(-5.9999884259259,0,
S_OK,25,12,1899,23,59,59,0,1,359);
2003 DT2UD(-4.0,0,
S_OK,26,12,1899,0,0,0,0,2,360);
2005 DT2UD(-0.25,0,
S_OK,30,12,1899,6,0,0,0,6,364);
2006 DT2UD(0.25,0,
S_OK,30,12,1899,6,0,0,0,6,364);
2028 "expected %x, %.16g, got %x, %.16g\n",
r, dt,
res,
out);
2030#define UD2T(d,m,y,h,mn,s,ms,dw,dy,flags,r,dt) test_DateFromUDate(__LINE__,d,m,y,h,mn,s,ms,dw,dy,flags,r,dt)
2035 UD2T(1,1,1980,0,0,0,0,2,1,0,
S_OK,29221.0);
2036 UD2T(2,1,1980,0,0,0,0,3,2,0,
S_OK,29222.0);
2037 UD2T(2,1,1980,0,0,0,0,4,5,0,
S_OK,29222.0);
2038 UD2T(31,12,1990,0,0,0,0,0,0,0,
S_OK,33238.0);
2039 UD2T(31,12,90,0,0,0,0,0,0,0,
S_OK,33238.0);
2040 UD2T(30,12,1899,0,0,0,0,6,364,0,
S_OK,0.0);
2041 UD2T(1,1,100,0,0,0,0,0,0,0,
S_OK,-657434.0);
2042 UD2T(31,12,9999,0,0,0,0,0,0,0,
S_OK,2958465.0);
2043 UD2T(1,1,10000,0,0,0,0,0,0,0,
E_INVALIDARG,0.0);
2044 UD2T(1,1,-10000,0,0,0,0,0,0,0,
E_INVALIDARG,0.0);
2046 UD2T(30,12,1899,0,0,0,0,0,0,0,
S_OK,0.0);
2047 UD2T(30,12,1899,0,0,0,999,0,0,0,
S_OK,0.0);
2049 UD2T(1,1,1980,18,1,16,0,2,1,0,
S_OK,29221.75087962963);
2050 UD2T(1,300,1980,18,1,16,0,2,1,0,
S_OK,38322.75087962963);
2051 UD2T(300,1,1980,18,1,16,0,2,1,0,
S_OK,29520.75087962963);
2052 UD2T(0,1,1980,42,1,16,0,2,1,0,
S_OK,29221.75087962963);
2053 UD2T(1,1,1980,17,61,16,0,2,1,0,
S_OK,29221.75087962963);
2054 UD2T(1,1,1980,18,0,76,0,2,1,0,
S_OK,29221.75087962963);
2055 UD2T(1,-300,1980,18,1,16,0,2,1,0,
S_OK,20059.75087962963);
2056 UD2T(-300,1,1980,18,1,16,0,2,1,0,
S_OK,28920.75087962963);
2057 UD2T(3,1,1980,-30,1,16,0,2,1,0,
S_OK,29221.75087962963);
2058 UD2T(1,1,1980,20,-119,16,0,2,1,0,
S_OK,29221.75087962963);
2059 UD2T(1,1,1980,18,3,-104,0,2,1,0,
S_OK,29221.75087962963);
2060 UD2T(1,12001,-1020,18,1,16,0,0,0,0,
S_OK,29221.75087962963);
2061 UD2T(1,-23,1982,18,1,16,0,0,0,0,
S_OK,29221.75087962963);
2062 UD2T(-59,3,1980,18,1,16,0,0,0,0,
S_OK,29221.75087962963);
2063 UD2T(1,1,0,0,0,0,0,0,0,0,
S_OK,36526);
2064 UD2T(0,0,1980,0,0,0,0,0,0,0,
S_OK,29189);
2065 UD2T(0,1,1980,0,0,0,0,2,1,0,
S_OK,29220.0);
2066 UD2T(-1,1,1980,18,1,16,0,0,0,0,
S_OK,29219.75087962963);
2067 UD2T(1,1,-1,18,1,16,0,0,0,0,
S_OK,36161.75087962963);
2068 UD2T(1,-1,1980,18,1,16,0,0,0,0,
S_OK,29160.7508796296);
2069 UD2T(1,13,1980,0,0,0,0,2,1,0,
S_OK,29587.0);
2072 UD2T(25,12,1899,6,0,0,0,1,359,0,
S_OK,-5.25);
2073 UD2T(25,12,1899,23,59,59,0,1,359,0,
S_OK,-5.9999884259259);
2075 UD2T(26,12,1899,0,0,0,0,2,360,0,
S_OK,-4.0);
2078 UD2T(30,12,1899,6,0,0,0,6,364,0,
S_OK,0.25);
2080 UD2T(1,1,1980,18,1,16,0,2,1,
VAR_TIMEVALUEONLY,
S_OK,0.7508796296296296);
2081 UD2T(1,1,1980,18,1,16,0,2,1,
VAR_DATEVALUEONLY,
S_OK,29221.0);
2082 UD2T(25,12,1899,6,0,0,0,1,359,
VAR_TIMEVALUEONLY,
S_OK,0.25);
2083 UD2T(25,12,1899,6,0,0,0,1,359,
VAR_DATEVALUEONLY,
S_OK,-5.0);
2084 UD2T(1,-1,1980,18,1,16,0,0,0,
VAR_TIMEVALUEONLY|
VAR_DATEVALUEONLY,
S_OK,0.7508796296296296);
2102 res = pSystemTimeToVariantTime(&st, &
out);
2104 "expected %d, %.16g, got %d, %.16g\n",
r, dt,
res,
out);
2106#define ST2DT(d,m,y,h,mn,s,ms,r,dt) test_st2dt(__LINE__,d,m,y,h,mn,s,ms,r,dt)
2131 memset(&st, 0,
sizeof(st));
2132 res = pVariantTimeToSystemTime(dt, &st);
2137 "%.16g expected %d, %d,%d,%d,%d,%d,%d,%d, got %d, %d,%d,%d,%d,%d,%d,%d\n",
2138 dt,
r,
d,
m,
y,
h, mn,
s, ms,
res, st.
wDay, st.
wMonth,
2142#define DT2ST(dt,r,d,m,y,h,mn,s,ms) test_dt2st(__LINE__,dt,r,d,m,y,h,mn,s,ms)
2147 DT2ST(29221.0,1,1,1,1980,0,0,0,0);
2148 DT2ST(29222.0,1,2,1,1980,0,0,0,0);
2151#define MKDOSDATE(d,m,y) ((d & 0x1f) | ((m & 0xf) << 5) | (((y-1980) & 0x7f) << 9))
2152#define MKDOSTIME(h,m,s) (((s>>1) & 0x1f) | ((m & 0x3f) << 5) | ((h & 0x1f) << 11))
2157 unsigned short dosDate, dosTime;
2164 res = pDosDateTimeToVariantTime(dosDate, dosTime, &
out);
2166 "expected %d, %.16g, got %d, %.16g\n",
r, dt,
res,
out);
2168#define DOS2DT(d,m,y,h,mn,s,r,dt) test_dos2dt(__LINE__,d,m,y,h,mn,s,r,dt)
2175 DOS2DT(1,1,1980,0,0,0,1,29221.0);
2176 DOS2DT(31,12,2099,0,0,0,1,73050.0);
2178 DOS2DT(31,12,2100,0,0,0,0,0.0);
2180 DOS2DT(0,1,1980,0,0,0,1,29220.0);
2181 DOS2DT(1,0,1980,0,0,0,1,29190.0);
2182 DOS2DT(0,0,1980,0,0,0,1,29189.0);
2184 DOS2DT(29,2,1981,0,0,0,1,29646.0);
2185 DOS2DT(30,2,1981,0,0,0,1,29647.0);
2187 DOS2DT(29,2,1980,0,0,0,1,29280.0);
2189 DOS2DT(2,13,1980,0,0,0,0,0.0);
2192 DOS2DT(1,1,1980,0,0,29,1,29221.00032407407);
2193 DOS2DT(1,1,1980,0,0,31,1,29221.00034722222);
2194 DOS2DT(1,1,1980,0,59,0,1,29221.04097222222);
2195 DOS2DT(1,1,1980,0,60,0,0,0.0);
2196 DOS2DT(1,1,1980,0,0,60,0,0.0);
2197 DOS2DT(1,1,1980,23,0,0,1,29221.95833333333);
2198 DOS2DT(1,1,1980,24,0,0,0,0.0);
2200 DOS2DT(1,1,1980,0,0,1,1,29221.0);
2201 DOS2DT(2,1,1980,0,0,0,1,29222.0);
2202 DOS2DT(2,1,1980,0,0,0,1,29222.0);
2203 DOS2DT(31,12,1990,0,0,0,1,33238.0);
2204 DOS2DT(31,12,90,0,0,0,1,40543.0);
2205 DOS2DT(30,12,1899,0,0,0,1,46751.0);
2206 DOS2DT(1,1,100,0,0,0,1,43831.0);
2207 DOS2DT(31,12,9999,0,0,0,1,59901.0);
2208 DOS2DT(1,1,10000,0,0,0,1,59902.0);
2209 DOS2DT(1,1,-10000,0,0,0,1,48214.0);
2211 DOS2DT(30,12,1899,0,0,0,1,46751.0);
2212 DOS2DT(30,12,1899,0,0,1,1,46751.0);
2214 DOS2DT(1,1,1980,18,1,16,1,29221.75087962963);
2215 DOS2DT(1,300,1980,18,1,16,1,29556.75087962963);
2216 DOS2DT(300,1,1980,18,1,16,1,29232.75087962963);
2217 DOS2DT(0,1,1980,42,1,16,1,29220.4175462963);
2218 DOS2DT(1,1,1980,17,61,16,0,0.0);
2219 DOS2DT(1,1,1980,18,0,76,1,29221.75013888889);
2220 DOS2DT(1,-300,1980,18,1,16,1,29312.75087962963);
2221 DOS2DT(-300,1,1980,18,1,16,1,29240.75087962963);
2222 DOS2DT(3,1,1980,-30,1,16,1,29223.08421296296);
2223 DOS2DT(1,1,1980,20,-119,16,1,29221.83976851852);
2224 DOS2DT(1,1,1980,18,3,-104,1,29221.75236111111);
2225 DOS2DT(1,12001,-1020,18,1,16,1,55519.75087962963);
2226 DOS2DT(1,-23,1982,18,1,16,1,30195.75087962963);
2227 DOS2DT(-59,3,1980,18,1,16,1,29285.75087962963);
2228 DOS2DT(1,1,0,0,0,0,1,54058.0);
2229 DOS2DT(0,0,1980,0,0,0,1,29189.0);
2230 DOS2DT(0,1,1980,0,0,0,1,29220.0);
2231 DOS2DT(-1,1,1980,18,1,16,1,29251.75087962963);
2232 DOS2DT(1,1,-1,18,1,16,1,53693.75087962963);
2233 DOS2DT(1,-1,1980,18,1,16,0,0);
2239 unsigned short dosDate, dosTime, expDosDate, expDosTime;
2242 dosTime = dosDate = 0;
2245 res = pVariantTimeToDosDateTime(dt, &dosDate, &dosTime);
2246 ok_(__FILE__,
line)(
r ==
res && (!
r || (dosTime == expDosTime && dosDate == expDosDate)),
2247 "%g: expected %d,%d(%d/%d/%d),%d(%d:%d:%d) got %d,%d(%d/%d/%d),%d(%d:%d:%d)\n",
2248 dt,
r, expDosDate, expDosDate & 0x1f,
2249 (expDosDate >> 5) & 0xf, 1980 + (expDosDate >> 9),
2250 expDosTime, expDosTime >> 11, (expDosTime >> 5) & 0x3f,
2251 (expDosTime & 0x1f),
2252 res, dosDate, dosDate & 0x1f, (dosDate >> 5) & 0xf,
2253 1980 + (dosDate >> 9), dosTime, dosTime >> 11,
2254 (dosTime >> 5) & 0x3f, (dosTime & 0x1f));
2256#define DT2DOS(dt,r,d,m,y,h,mn,s) test_dt2dos(__LINE__,dt,r,d,m,y,h,mn,s)
2263 DT2DOS(29221.0,1,1,1,1980,0,0,0);
2264 DT2DOS(73050.0,1,31,12,2099,0,0,0);
2265 DT2DOS(29220.0,0,0,0,0,0,0,0);
2266 DT2DOS(73415.0,0,0,0,0,0,0,0);
2269 DT2DOS(29221.00032407407,1,1,1,1980,0,0,29);
2270 DT2DOS(29221.00034722222,1,1,1,1980,0,0,31);
2271 DT2DOS(29221.04097222222,1,1,1,1980,0,59,0);
2272 DT2DOS(29221.95833333333,1,1,1,1980,23,0,0);
2277#define VARABS(vt,val,rvt,rval) \
2278 V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
2279 V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
2280 test_var_call1( __LINE__, pVarAbs, &v, &exp )
2284 static WCHAR szNum[] = {
'-',
'1',
'.',
'1',
'\0' };
2308 hres = pVarAbs(&
v,&vDst);
2328 ok(
hres == hExpected,
"VarAbs: expected 0x%X, got 0x%X for vt %d | 0x%X\n",
2352 V_CY(&
v).int64 = -10000;
2353 memset(&vDst,0,
sizeof(vDst));
2354 hres = pVarAbs(&
v,&vDst);
2356 "VarAbs(CY): expected 0x0 got 0x%X\n",
hres);
2360 trace(
"Skipping VarAbs(BSTR) as decimal separator is '%s'\n",
buff);
2367 memset(&vDst,0,
sizeof(vDst));
2368 hres = pVarAbs(&
v,&vDst);
2370 "VarAbs: expected 0x0,%d,%g, got 0x%X,%d,%g\n",
VT_R8, 1.1,
hres,
V_VT(&vDst),
V_R8(&vDst));
2375#define VARNOT(vt,val,rvt,rval) \
2376 V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
2377 V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
2378 test_var_call1( __LINE__, pVarNot, &v, &exp )
2382 static const WCHAR szNum0[] = {
'0',
'\0' };
2383 static const WCHAR szNum1[] = {
'1',
'\0' };
2384 static const WCHAR szFalse[] = {
'#',
'F',
'A',
'L',
'S',
'E',
'#',
'\0' };
2385 static const WCHAR szTrue[] = {
'#',
'T',
'R',
'U',
'E',
'#',
'\0' };
2434 hres = pVarNot(&
v,&vDst);
2435 ok(
hres == hExpected,
"VarNot: expected 0x%X, got 0x%X vt %d|0x%X\n",
2483 S(
U(*pdec)).sign = DECIMAL_NEG;
2484 S(
U(*pdec)).scale = 0;
2486 S1(
U1(*pdec)).Mid32 = 0;
2487 S1(
U1(*pdec)).Lo32 = 1;
2502#define VARSUB(vt1,val1,vt2,val2,rvt,rval) \
2503 V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
2504 V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
2505 V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
2506 test_var_call2( __LINE__, pVarSub, &left, &right, &exp )
2529 VARTYPE leftvt, rightvt, resvt;
2540 expectedhres =
S_OK;
2623 else if (leftvt ==
VT_CY || rightvt ==
VT_CY)
2625 else if (leftvt ==
VT_R8 || rightvt ==
VT_R8)
2629 }
else if (leftvt ==
VT_R4 || rightvt ==
VT_R4) {
2636 else if (leftvt ==
VT_I8 || rightvt ==
VT_I8)
2638 else if (leftvt ==
VT_I4 || rightvt ==
VT_I4)
2640 else if (leftvt ==
VT_I2 || rightvt ==
VT_I2 ||
2655 "VarSub: %d|0x%X, %d|0x%X: Expected failure 0x%X, "
2656 "got 0x%X, expected vt %d got vt %d\n",
2666 VARSUB(I2,-13,I4,5,I4,-18);
2667 VARSUB(I4,-13,I4,5,I4,-18);
2696 "VarSub: expected coerced type VT_R8, got %s!\n",
vtstr(
V_VT(&
result)));
2698 "VarSub: BSTR + BSTR, expected %f got %f\n", 0.0,
V_R8(&
result));
2716 "VarSub: expected coerced type VT_CY, got %s!\n",
vtstr(
V_VT(&
result)));
2722 "VarSub: expected coerced type VT_DECIMAL, got %s!\n",
vtstr(
V_VT(&
result)));
2739 ok_(__FILE__,
line)(
hres == expres,
"wrong result %x/%x\n",
hres, expres );
2745#define VARMOD(vt1,vt2,val1,val2,rvt,rval) \
2746 V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
2747 V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
2748 V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
2749 test_var_call2( __LINE__, pVarMod, &left, &right, &exp )
2751#define VARMOD2(vt1,vt2,val1,val2,rvt,rval,hexpected) \
2752 V_VT(&left) = VT_##vt1; V_I4(&left) = val1; \
2753 V_VT(&right) = VT_##vt2; V_I4(&right) = val2; \
2754 V_VT(&exp) = VT_##rvt; V_I4(&exp) = rval; \
2755 test_Mod( __LINE__, &left, &right, &exp, hexpected )
2762 static const WCHAR szNum0[] = {
'1',
'2',
'5',
'\0'};
2763 static const WCHAR szNum1[] = {
'1',
'0',
'\0'};
2765 BOOL lFound, rFound;
2767 BSTR strNum0, strNum1;
2772 VARMOD(I1,I1,100,10,I4,0);
2773 VARMOD(I1,UI1,100,10,I4,0);
2774 VARMOD(I1,I2,100,10,I4,0);
2775 VARMOD(I1,UI2,100,10,I4,0);
2776 VARMOD(I1,I4,100,10,I4,0);
2777 VARMOD(I1,UI4,100,10,I4,0);
2782 VARMOD(UI1,I1,100,10,I4,0);
2783 VARMOD(UI1,UI1,100,10,UI1,0);
2784 VARMOD(UI1,I2,100,10,I2,0);
2785 VARMOD(UI1,UI2,100,10,I4,0);
2786 VARMOD(UI1,I4,100,10,I4,0);
2787 VARMOD(UI1,UI4,100,10,I4,0);
2792 VARMOD(I2,I1,100,10,I4,0);
2793 VARMOD(I2,UI1,100,10,I2,0);
2794 VARMOD(I2,I2,100,10,I2,0);
2795 VARMOD(I2,UI2,100,10,I4,0);
2796 VARMOD(I2,I4,100,10,I4,0);
2797 VARMOD(I2,UI4,100,10,I4,0);
2802 VARMOD(I4,I1,100,10,I4,0);
2803 VARMOD(I4,UI1,100,10,I4,0);
2804 VARMOD(I4,I2,100,10,I4,0);
2805 VARMOD(I4,UI2,100,10,I4,0);
2806 VARMOD(I4,I4,100,10,I4,0);
2807 VARMOD(I4,UI4,100,10,I4,0);
2811 VARMOD(UI4,I1,100,10,I4,0);
2812 VARMOD(UI4,UI1,100,10,I4,0);
2813 VARMOD(UI4,I2,100,10,I4,0);
2814 VARMOD(UI4,UI2,100,10,I4,0);
2815 VARMOD(UI4,I4,100,10,I4,0);
2816 VARMOD(UI4,UI4,100,10,I4,0);
2876 VARMOD(I1,I8,100,10,I8,0);
2877 VARMOD(UI1,I8,100,10,I8,0);
2878 VARMOD(I2,I8,100,10,I8,0);
2879 VARMOD(I4,I8,100,10,I8,0);
2880 VARMOD(UI4,I8,100,10,I8,0);
2886 VARMOD(I8,I1,100,10,I8,0);
2887 VARMOD(I8,UI1,100,10,I8,0);
2888 VARMOD(I8,I2,100,10,I8,0);
2889 VARMOD(I8,UI2,100,10,I8,0);
2890 VARMOD(I8,I4,100,10,I8,0);
2891 VARMOD(I8,UI4,100,10,I8,0);
2894 VARMOD(I8,I8,100,10,I8,0);
2997 }
else if((
r ==
VT_EMPTY) && lFound && lValid)
3021 }
else if((
l ==
VT_NULL) && rFound)
3027 }
else if((
r ==
VT_RECORD) && lValid && lFound)
3033 }
else if((
l ==
VT_CY) && !rFound)
3036 }
else if(lFound && !rFound)
3039 }
else if(!lFound && rFound)
3042 }
else if((
r ==
VT_NULL) && lFound && lValid)
3051 }
else if(!lFound && !rFound)
3060 V_CY(&
v1).int64 = 1000000;
3105 "VarMod: expected 0x%x, got 0x%X for l type of %d, r type of %d,\n", hexpected,
hres,
l,
r);
3113 VARMOD(I4,I4,-1,-1,I4,0);
3147 V_CY(&
v1).int64 = 100000;
3148 V_CY(&
v2).int64 = 100000;
3151 "VarMod: expected 0x%x,%d,%d, got 0x%X,%d,%d\n",
S_OK,
VT_I4, 0,
hres,
V_VT(&vDst),
V_I4(&vDst));
3156 V_CY(&
v2).int64 = 100000;
3159 "VarMod: expected 0x%x,%d,%d, got 0x%X,%d,%d\n",
S_OK,
VT_I4, 0,
hres,
V_VT(&vDst),
V_I4(&vDst));
3168 "VarMod: expected 0x%x,%d,%d, got 0x%X,%d,%d\n",
S_OK,
VT_I4, 0,
hres,
V_VT(&vDst),
V_I4(&vDst));
3176 "VarMod: expected 0x%x,%d,%d, got 0x%X,%d,%d\n",
S_OK,
VT_I4, 0,
hres,
V_VT(&vDst),
V_I4(&vDst));
3184 V_CY(&
v2).int64 = 100000;
3189 "VarMod: expected 0x%x,%d,%d, got 0x%X,%d,%d\n",
DISP_E_TYPEMISMATCH,
VT_EMPTY, 1231,
hres,
V_VT(&vDst),
V_I4(&vDst));
3238#define VARFIX(vt,val,rvt,rval) \
3239 V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
3240 V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
3241 test_var_call1( __LINE__, pVarFix, &v, &exp )
3245 static const WCHAR szNumMinus1[] = {
'-',
'1',
'\0' };
3282 hres = pVarFix(&
v,&vDst);
3285 "VarFix: expected failure, got 0x%X vt %d|0x%X\n",
3288 ok(
hres ==
S_OK,
"VarFix: expected S_OK, got 0x%X vt %d|0x%X\n",
3315 hres = pVarFix(&
v,&vDst);
3317 "VarFix: expected 0x0,%d,0 got 0x%X,%d,%d\n",
VT_EMPTY,
3321 hres = pVarFix(&
v,&vDst);
3326 S(
U(*pdec)).sign = DECIMAL_NEG;
3327 S(
U(*pdec)).scale = 0;
3329 S1(
U1(*pdec)).Mid32 = 0;
3330 S1(
U1(*pdec)).Lo32 = 1;
3331 hres = pVarFix(&
v,&vDst);
3333 "VarFix: expected 0x0,%d,identical, got 0x%X,%d\n",
VT_DECIMAL,
3339 pcy->
int64 = -10000;
3340 hres = pVarFix(&
v,&vDst);
3342 "VarFix: VT_CY wrong, hres=0x%X\n",
hres);
3345 pcy->
int64 = -16000;
3346 hres = pVarFix(&
v,&vDst);
3348 "VarFix: VT_CY wrong, hres=0x%X\n",
hres);