ReactOS 0.4.15-dev-5893-g1bb4167
vartest.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include "windef.h"
#include "winbase.h"
#include "winsock2.h"
#include "wine/test.h"
#include "winuser.h"
#include "wingdi.h"
#include "winnls.h"
#include "winerror.h"
#include "winnt.h"
#include "wtypes.h"
#include "oleauto.h"
Include dependency graph for vartest.c:

Go to the source code of this file.

Classes

struct  DummyDispatch
 
struct  IRecordInfoImpl
 
struct  test_VariantClearImpl
 
struct  decimal_t
 
struct  decimal_round_t
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define CHECKPTR(func)
 
#define EQ_DOUBLE(a, b)   (fabs((a)-(b)) / (1.0+fabs(a)+fabs(b)) < 1e-14)
 
#define EQ_FLOAT(a, b)   (fabs((a)-(b)) / (1.0+fabs(a)+fabs(b)) < 1e-7)
 
#define SKIPTESTS(a)   if((a > VT_CLSID+10) && (a < VT_BSTR_BLOB-10)) continue
 
#define V_EMPTY(v)   V_I4(v)
 
#define V_NULL(v)   V_I4(v)
 
#define I1_MAX   0x7f
 
#define I1_MIN   ((-I1_MAX)-1)
 
#define UI1_MAX   0xff
 
#define UI1_MIN   0
 
#define I2_MAX   0x7fff
 
#define I2_MIN   ((-I2_MAX)-1)
 
#define UI2_MAX   0xffff
 
#define UI2_MIN   0
 
#define I4_MAX   0x7fffffff
 
#define I4_MIN   ((-I4_MAX)-1)
 
#define UI4_MAX   0xffffffff
 
#define UI4_MIN   0
 
#define I8_MAX   (((LONGLONG)I4_MAX << 32) | UI4_MAX)
 
#define I8_MIN   ((-I8_MAX)-1)
 
#define UI8_MAX   (((ULONGLONG)UI4_MAX << 32) | UI4_MAX)
 
#define UI8_MIN   0
 
#define DATE_MAX   2958465
 
#define DATE_MIN   -657434
 
#define R4_MAX   FLT_MAX
 
#define R4_MIN   FLT_MIN
 
#define R8_MAX   DBL_MAX
 
#define R8_MIN   DBL_MIN
 
#define DEFINE_EXPECT(func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)    do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func)
 
#define CASE(vt)   case VT_##vt: return #vt
 
#define CASE(vt)   case VT_##vt: return (V_##vt(result) == V_##vt(expected))
 
#define test_bstr_var(a, b)   _test_bstr_var(__LINE__,a,b)
 
#define FAILDIG   255
 
#define CONVERTN(str, dig, flags)   hres = convert_str( str, dig, flags, &np, rgb, lcid )
 
#define CONVERT(str, flags)   CONVERTN(str,sizeof(rgb),flags)
 
#define EXPECT(a, b, c, d, e, f)   expect_NumFromStr( __LINE__, hres, &np, a, b, c, d, e, f )
 
#define EXPECTRGB(a, b)   ok(rgb[a] == b, "Digit[%d], expected %d, got %d\n", a, b, rgb[a])
 
#define EXPECTFAIL   ok(hres == (HRESULT)DISP_E_TYPEMISMATCH, "Call succeeded, hres = %08x\n", hres)
 
#define EXPECT2(a, b)   EXPECTRGB(0,a); EXPECTRGB(1,b)
 
#define SETRGB(indx, val)   if (!indx) memset(rgb, FAILDIG, sizeof(rgb)); rgb[indx] = val
 
#define CONVERT(a, b, c, d, e, f, bits)
 
#define EXPECT_OVERFLOW   ok(hres == (HRESULT)DISP_E_OVERFLOW, szFailOverflow, hres)
 
#define EXPECT_OK
 
#define EXPECT_TYPE(typ)   ok(V_VT(&vOut) == typ,"Expected Type = " #typ ", got %d\n", V_VT(&vOut))
 
#define EXPECT_I1(val)
 
#define EXPECT_UI1(val)
 
#define EXPECT_I2(val)
 
#define EXPECT_UI2(val)
 
#define EXPECT_I4(val)
 
#define EXPECT_UI4(val)
 
#define EXPECT_I8(high, low)
 
#define EXPECT_UI8(val)
 
#define EXPECT_R4(val)
 
#define EXPECT_R8(val)
 
#define CY_MULTIPLIER   10000
 
#define EXPECT_CY(val)
 
#define EXPECT_DECIMAL(valHi, valMid, valLo)
 
#define INTEGER_VTBITS   (VTBIT_I1|VTBIT_UI1|VTBIT_I2|VTBIT_UI2|VTBIT_I4|VTBIT_UI4|VTBIT_I8|VTBIT_UI8)
 
#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)
 
#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)
 
#define ST2DT(d, m, y, h, mn, s, ms, r, dt)   test_st2dt(__LINE__,d,m,y,h,mn,s,ms,r,dt)
 
#define DT2ST(dt, r, d, m, y, h, mn, s, ms)   test_dt2st(__LINE__,dt,r,d,m,y,h,mn,s,ms)
 
#define MKDOSDATE(d, m, y)   ((d & 0x1f) | ((m & 0xf) << 5) | (((y-1980) & 0x7f) << 9))
 
#define MKDOSTIME(h, m, s)   (((s>>1) & 0x1f) | ((m & 0x3f) << 5) | ((h & 0x1f) << 11))
 
#define DOS2DT(d, m, y, h, mn, s, r, dt)   test_dos2dt(__LINE__,d,m,y,h,mn,s,r,dt)
 
#define DT2DOS(dt, r, d, m, y, h, mn, s)   test_dt2dos(__LINE__,dt,r,d,m,y,h,mn,s)
 
#define VARABS(vt, val, rvt, rval)
 
#define VARNOT(vt, val, rvt, rval)
 
#define VARSUB(vt1, val1, vt2, val2, rvt, rval)
 
#define VARMOD(vt1, vt2, val1, val2, rvt, rval)
 
#define VARMOD2(vt1, vt2, val1, val2, rvt, rval, hexpected)
 
#define VARFIX(vt, val, rvt, rval)
 
#define VARINT(vt, val, rvt, rval)
 
#define VARNEG(vt, val, rvt, rval)
 
#define VARROUND(vt, val, deci, rvt, rval)
 
#define VARXOR(vt1, val1, vt2, val2, rvt, rval)
 
#define VARXORCY(vt1, val1, val2, rvt, rval)
 
#define VAROR(vt1, val1, vt2, val2, rvt, rval)
 
#define VARORCY(vt1, val1, val2, rvt, rval)
 
#define VAREQV(vt1, val1, vt2, val2, rvt, rval)
 
#define VARMUL(vt1, val1, vt2, val2, rvt, rval)
 
#define VARADD(vt1, val1, vt2, val2, rvt, rval)
 
#define VARAND(vt1, val1, vt2, val2, rvt, rval)
 
#define VARANDCY(vt1, val1, val2, rvt, rval)
 
#define SKIPTESTAND(a)
 
#define _VARCMP(vt1, val1, vtfl1, vt2, val2, vtfl2, lcid, flags, result)
 
#define VARCMPEX(vt1, val1, vt2, val2, res1, res2, res3, res4)
 
#define VARCMP(vt1, val1, vt2, val2, result)    VARCMPEX(vt1,val1,vt2,val2,result,result,result,result)
 
#define V_NULL_   V_NULL
 
#define VT_NULL_   VT_NULL
 
#define VARPOW(vt1, val1, vt2, val2, rvt, rval)
 
#define SKIPTESTPOW(a)
 
#define VARDIV(vt1, val1, vt2, val2, rvt, rval)
 
#define SKIPTESTDIV(a)
 
#define VARIDIV(vt1, val1, vt2, val2, rvt, rval)
 
#define SKIPTESTIDIV(a)
 
#define VARIMP(vt1, val1, vt2, val2, rvt, rval)
 
#define SKIPTESTIMP(a)
 

Typedefs

typedef struct IRecordInfoImpl IRecordInfoImpl
 

Functions

static HRESULT (WINAPI *pVarUdateFromDate)(DATE
 
static UDATE *static DATE *static INT (WINAPI *pSystemTimeToVariantTime)(LPSYSTEMTIME
 
 DEFINE_EXPECT (dispatch_invoke)
 
static DummyDispatchimpl_from_IDispatch (IDispatch *iface)
 
static ULONG WINAPI DummyDispatch_AddRef (IDispatch *iface)
 
static ULONG WINAPI DummyDispatch_Release (IDispatch *iface)
 
static HRESULT WINAPI DummyDispatch_QueryInterface (IDispatch *iface, REFIID riid, void **ppvObject)
 
static HRESULT WINAPI DummyDispatch_GetTypeInfoCount (IDispatch *iface, UINT *pctinfo)
 
static HRESULT WINAPI DummyDispatch_GetTypeInfo (IDispatch *iface, UINT tinfo, LCID lcid, ITypeInfo **ti)
 
static HRESULT WINAPI DummyDispatch_GetIDsOfNames (IDispatch *iface, REFIID riid, LPOLESTR *names, UINT cnames, LCID lcid, DISPID *dispid)
 
static HRESULT WINAPI DummyDispatch_Invoke (IDispatch *iface, DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, UINT *arg_err)
 
static void init_test_dispatch (VARTYPE vt, DummyDispatch *dispatch)
 
static IRecordInfoImplimpl_from_IRecordInfo (IRecordInfo *iface)
 
static HRESULT WINAPI RecordInfo_QueryInterface (IRecordInfo *iface, REFIID riid, void **obj)
 
static ULONG WINAPI RecordInfo_AddRef (IRecordInfo *iface)
 
static ULONG WINAPI RecordInfo_Release (IRecordInfo *iface)
 
static HRESULT WINAPI RecordInfo_RecordInit (IRecordInfo *iface, PVOID pvNew)
 
static HRESULT WINAPI RecordInfo_RecordClear (IRecordInfo *iface, void *data)
 
static HRESULT WINAPI RecordInfo_RecordCopy (IRecordInfo *iface, void *src, void *dest)
 
static HRESULT WINAPI RecordInfo_GetGuid (IRecordInfo *iface, GUID *pguid)
 
static HRESULT WINAPI RecordInfo_GetName (IRecordInfo *iface, BSTR *pbstrName)
 
static HRESULT WINAPI RecordInfo_GetSize (IRecordInfo *iface, ULONG *size)
 
static HRESULT WINAPI RecordInfo_GetTypeInfo (IRecordInfo *iface, ITypeInfo **ppTypeInfo)
 
static HRESULT WINAPI RecordInfo_GetField (IRecordInfo *iface, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
 
static HRESULT WINAPI RecordInfo_GetFieldNoCopy (IRecordInfo *iface, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField, PVOID *ppvDataCArray)
 
static HRESULT WINAPI RecordInfo_PutField (IRecordInfo *iface, ULONG wFlags, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
 
static HRESULT WINAPI RecordInfo_PutFieldNoCopy (IRecordInfo *iface, ULONG wFlags, PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField)
 
static HRESULT WINAPI RecordInfo_GetFieldNames (IRecordInfo *iface, ULONG *pcNames, BSTR *rgBstrNames)
 
static BOOL WINAPI RecordInfo_IsMatchingType (IRecordInfo *iface, IRecordInfo *info2)
 
static PVOID WINAPI RecordInfo_RecordCreate (IRecordInfo *iface)
 
static HRESULT WINAPI RecordInfo_RecordCreateCopy (IRecordInfo *iface, PVOID pvSource, PVOID *ppvDest)
 
static HRESULT WINAPI RecordInfo_RecordDestroy (IRecordInfo *iface, PVOID pvRecord)
 
static IRecordInfoImplget_test_recordinfo (void)
 
static void init (void)
 
static void setdec (DECIMAL *dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG64 lo64)
 
static void setdec64 (DECIMAL *dec, BYTE scl, BYTE sgn, ULONG hi32, ULONG mid32, ULONG lo32)
 
static const charvtstr (int x)
 
static const charvariantstr (const VARIANT *var)
 
static BOOL is_expected_variant (const VARIANT *result, const VARIANT *expected)
 
static void test_var_call1 (int line, HRESULT(WINAPI *func)(LPVARIANT, LPVARIANT), VARIANT *arg, VARIANT *expected)
 
static void test_var_call2 (int line, HRESULT(WINAPI *func)(LPVARIANT, LPVARIANT, LPVARIANT), VARIANT *left, VARIANT *right, VARIANT *expected)
 
static int strcmp_wa (const WCHAR *strw, const char *stra)
 
static void _test_bstr_var (unsigned line, const VARIANT *v, const char *str)
 
static void test_VariantInit (void)
 
static BOOL IsValidVariantClearVT (VARTYPE vt, VARTYPE extraFlags)
 
static test_VariantClearImplimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI VC_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI VC_AddRef (LPUNKNOWN iface)
 
static ULONG WINAPI VC_Release (LPUNKNOWN iface)
 
static void test_VariantClear (void)
 
static void test_VariantCopy (void)
 
static BOOL IsValidVariantCopyIndVT (VARTYPE vt, VARTYPE extraFlags)
 
static void test_VariantCopyInd (void)
 
static HRESULT convert_str (const char *str, INT dig, ULONG flags, NUMPARSE *np, BYTE rgb[128], LCID lcid)
 
static void expect_NumFromStr (int line, HRESULT hres, NUMPARSE *np, INT a, ULONG b, ULONG c, INT d, INT e, INT f)
 
static void test_VarParseNumFromStr (void)
 
static void test_VarNumFromParseNum (void)
 
static void test_UdateFromDate (int line, DATE dt, ULONG flags, HRESULT r, WORD d, WORD m, WORD y, WORD h, WORD mn, WORD s, WORD ms, WORD dw, WORD dy)
 
static void test_VarUdateFromDate (void)
 
static void test_DateFromUDate (int line, WORD d, WORD m, WORD y, WORD h, WORD mn, WORD s, WORD ms, WORD dw, WORD dy, ULONG flags, HRESULT r, DATE dt)
 
static void test_VarDateFromUdate (void)
 
static void test_st2dt (int line, WORD d, WORD m, WORD y, WORD h, WORD mn, WORD s, WORD ms, INT r, double dt)
 
static void test_SystemTimeToVariantTime (void)
 
static void test_dt2st (int line, double dt, INT r, WORD d, WORD m, WORD y, WORD h, WORD mn, WORD s, WORD ms)
 
static void test_VariantTimeToSystemTime (void)
 
static void test_dos2dt (int line, WORD d, WORD m, WORD y, WORD h, WORD mn, WORD s, INT r, double dt)
 
static void test_DosDateTimeToVariantTime (void)
 
static void test_dt2dos (int line, double dt, INT r, WORD d, WORD m, WORD y, WORD h, WORD mn, WORD s)
 
static void test_VariantTimeToDosDateTime (void)
 
static void test_VarAbs (void)
 
static void test_VarNot (void)
 
static void test_VarSub (void)
 
static void test_Mod (int line, VARIANT *left, VARIANT *right, VARIANT *expected, HRESULT expres)
 
static void test_VarMod (void)
 
static void test_VarFix (void)
 
static void test_VarInt (void)
 
static void test_VarNeg (void)
 
static void test_Round (int line, VARIANT *arg, int deci, VARIANT *expected)
 
static void test_VarRound (void)
 
static void test_VarXor (void)
 
static void test_VarOr (void)
 
static void test_VarEqv (void)
 
static void test_VarMul (void)
 
static void test_VarAdd (void)
 
static void test_VarCat (void)
 
static void test_VarAnd (void)
 
static void test_cmp (int line, LCID lcid, UINT flags, VARIANT *left, VARIANT *right, HRESULT result)
 
static void test_cmpex (int line, LCID lcid, VARIANT *left, VARIANT *right, HRESULT res1, HRESULT res2, HRESULT res3, HRESULT res4)
 
static void test_VarCmp (void)
 
static void test_VarPow (void)
 
static void test_VarDiv (void)
 
static void test_VarIdiv (void)
 
static void test_VarImp (void)
 
 START_TEST (vartest)
 

Variables

static HMODULE hOleaut32
 
static ULONG
 
static UDATE *static DATE *static double *static LPSYSTEMTIME
 
static USHORT
 
static double *static USHORT USHORT *static const WCHAR sz12 [] = {'1','2','\0'}
 
static WCHAR sz12_false [32]
 
static WCHAR sz12_true [32]
 
static BOOL has_i8
 
static const IDispatchVtbl DummyDispatch_VTable
 
static const IRecordInfoVtbl RecordInfoVtbl
 
static char vtstr_buffer [16][256]
 
static int vtstr_current =0
 
static const VARTYPE ExtraFlags [16]
 
static const IUnknownVtbl test_VariantClear_vtbl
 
static test_VariantClearImpl test_myVariantClearImpl = {{&test_VariantClear_vtbl}, 1, 0}
 
static LCID
 
static const charszFailOverflow = "Expected overflow, hres = %08x\n"
 
static const charszFailOk = "Call failed, hres = %08x\n"
 
static LPVARIANT
 
static int
 
static const struct decimal_round_t decimal_round_data []
 

Macro Definition Documentation

◆ _VARCMP

#define _VARCMP (   vt1,
  val1,
  vtfl1,
  vt2,
  val2,
  vtfl2,
  lcid,
  flags,
  result 
)
Value:
V_##vt1(&left) = val1; V_VT(&left) = VT_##vt1 | vtfl1; \
V_##vt2(&right) = val2; V_VT(&right) = VT_##vt2 | vtfl2; \
test_cmp( __LINE__, lcid, flags, &left, &right, result )
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
#define V_VT(A)
Definition: oleauto.h:211

Definition at line 6899 of file vartest.c.

◆ CASE [1/2]

#define CASE (   vt)    case VT_##vt: return #vt

◆ CASE [2/2]

#define CASE (   vt)    case VT_##vt: return (V_##vt(result) == V_##vt(expected))

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define FALSE
Definition: types.h:117
GLenum func
Definition: glext.h:6028
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 118 of file vartest.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)

Definition at line 112 of file vartest.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define TRUE
Definition: types.h:120

Definition at line 106 of file vartest.c.

◆ CHECKPTR

#define CHECKPTR (   func)
Value:
if (!p##func) { win_skip("function " # func " not available, not testing it\n"); return; }
#define GetProcAddress(x, y)
Definition: compat.h:753
GLfloat GLfloat p
Definition: glext.h:8902
#define win_skip
Definition: test.h:160
static HMODULE hOleaut32
Definition: vartest.c:43

Definition at line 58 of file vartest.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file vartest.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 28 of file vartest.c.

◆ CONVERT [1/2]

#define CONVERT (   a,
  b,
  c,
  d,
  e,
  f,
  bits 
)
Value:
np.cDig = (a); np.dwInFlags = (b); np.dwOutFlags = (c); np.cchUsed = (d); \
np.nBaseShift = (e); np.nPwr10 = (f); hres = pVarNumFromParseNum(&np, rgb, bits, &vOut)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define f
Definition: ke_i.h:83
#define a
Definition: ke_i.h:78
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79
HRESULT hres
Definition: protocol.c:465
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3521

Definition at line 1744 of file vartest.c.

◆ CONVERT [2/2]

#define CONVERT (   str,
  flags 
)    CONVERTN(str,sizeof(rgb),flags)

Definition at line 1744 of file vartest.c.

◆ CONVERTN

#define CONVERTN (   str,
  dig,
  flags 
)    hres = convert_str( str, dig, flags, &np, rgb, lcid )

Definition at line 1301 of file vartest.c.

◆ CY_MULTIPLIER

#define CY_MULTIPLIER   10000

Definition at line 1775 of file vartest.c.

◆ DATE_MAX

#define DATE_MAX   2958465

Definition at line 93 of file vartest.c.

◆ DATE_MIN

#define DATE_MIN   -657434

Definition at line 94 of file vartest.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 100 of file vartest.c.

◆ DOS2DT

#define DOS2DT (   d,
  m,
  y,
  h,
  mn,
  s,
  r,
  dt 
)    test_dos2dt(__LINE__,d,m,y,h,mn,s,r,dt)

Definition at line 2168 of file vartest.c.

◆ DT2DOS

#define DT2DOS (   dt,
  r,
  d,
  m,
  y,
  h,
  mn,
  s 
)    test_dt2dos(__LINE__,dt,r,d,m,y,h,mn,s)

Definition at line 2256 of file vartest.c.

◆ DT2ST

#define DT2ST (   dt,
  r,
  d,
  m,
  y,
  h,
  mn,
  s,
  ms 
)    test_dt2st(__LINE__,dt,r,d,m,y,h,mn,s,ms)

Definition at line 2142 of file vartest.c.

◆ DT2UD

#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)

Definition at line 1974 of file vartest.c.

◆ EQ_DOUBLE

#define EQ_DOUBLE (   a,
  b 
)    (fabs((a)-(b)) / (1.0+fabs(a)+fabs(b)) < 1e-14)

Definition at line 67 of file vartest.c.

◆ EQ_FLOAT

#define EQ_FLOAT (   a,
  b 
)    (fabs((a)-(b)) / (1.0+fabs(a)+fabs(b)) < 1e-7)

Definition at line 68 of file vartest.c.

◆ EXPECT

#define EXPECT (   a,
  b,
  c,
  d,
  e,
  f 
)    expect_NumFromStr( __LINE__, hres, &np, a, b, c, d, e, f )

Definition at line 1303 of file vartest.c.

◆ EXPECT2

#define EXPECT2 (   a,
  b 
)    EXPECTRGB(0,a); EXPECTRGB(1,b)

Definition at line 1306 of file vartest.c.

◆ EXPECT_CY

#define EXPECT_CY (   val)
Value:
ok(V_CY(&vOut).int64 == (LONG64)(val * CY_MULTIPLIER), "Expected r8 = 0x%x%08x, got 0x%x%08x\n", \
(DWORD)((LONG64)val >> 23), (DWORD)(LONG64)val, (DWORD)(V_CY(&vOut).int64 >>32), (DWORD)V_CY(&vOut).int64); }
@ VT_CY
Definition: compat.h:2301
long long int64
Definition: platform.h:13
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLfloat * val
Definition: glext.h:7180
#define V_CY(A)
Definition: oleauto.h:229
int64_t LONG64
Definition: typedefs.h:68
#define EXPECT_TYPE(typ)
Definition: vartest.c:1752
#define CY_MULTIPLIER
Definition: vartest.c:1775
#define EXPECT_OK
Definition: vartest.c:1750

Definition at line 1776 of file vartest.c.

◆ EXPECT_DECIMAL

#define EXPECT_DECIMAL (   valHi,
  valMid,
  valLo 
)
Value:
ok((V_DECIMAL(&vOut).Hi32 == valHi) && (S1(U1(V_DECIMAL(&vOut))).Mid32 == valMid) && \
(S1(U1(V_DECIMAL(&vOut))).Lo32 == valLo), \
"Expected decimal = %x/0x%x%08x, got %x/0x%x%08x\n", valHi, valMid, valLo, \
V_DECIMAL(&vOut).Hi32, S1(U1(V_DECIMAL(&vOut))).Mid32, S1(U1(V_DECIMAL(&vOut))).Lo32); }
@ VT_DECIMAL
Definition: compat.h:2309
#define V_DECIMAL(A)
Definition: oleauto.h:236
#define U1(x)
Definition: test.h:199
#define S1(x)
Definition: test.h:218

Definition at line 1779 of file vartest.c.

◆ EXPECT_I1

#define EXPECT_I1 (   val)
Value:
ok(V_I1(&vOut) == val, "Expected i1 = %d, got %d\n", (signed char)val, V_I1(&vOut)); }
@ VT_I1
Definition: compat.h:2310
#define V_I1(A)
Definition: oleauto.h:243

Definition at line 1753 of file vartest.c.

◆ EXPECT_I2

#define EXPECT_I2 (   val)
Value:
ok(V_I2(&vOut) == val, "Expected i2 = %d, got %d\n", (SHORT)val, V_I2(&vOut)); }
@ VT_I2
Definition: compat.h:2297
#define V_I2(A)
Definition: oleauto.h:245
short SHORT
Definition: pedump.c:59

Definition at line 1757 of file vartest.c.

◆ EXPECT_I4

#define EXPECT_I4 (   val)
Value:
ok(V_I4(&vOut) == val, "Expected i4 = %d, got %d\n", (LONG)val, V_I4(&vOut)); }
@ VT_I4
Definition: compat.h:2298
#define V_I4(A)
Definition: oleauto.h:247
long LONG
Definition: pedump.c:60

Definition at line 1761 of file vartest.c.

◆ EXPECT_I8

#define EXPECT_I8 (   high,
  low 
)
Value:
ok(V_I8(&vOut) == ((((ULONG64)(high))<<32)|(low)), "Expected i8 = %x%08x, got %x%08x\n", \
(LONG)(high), (LONG)(low), (LONG)(V_I8(&vOut)>>32), (LONG)V_I8(&vOut) ); }
@ VT_I8
Definition: compat.h:2314
unsigned __int64 ULONG64
Definition: imports.h:198
#define V_I8(A)
Definition: oleauto.h:249

Definition at line 1765 of file vartest.c.

◆ EXPECT_OK

#define EXPECT_OK
Value:
if (hres == (HRESULT)S_OK)
#define ok(value,...)
Definition: atltest.h:57
#define S_OK
Definition: intsafe.h:52
static const char * szFailOk
Definition: vartest.c:1749

Definition at line 1750 of file vartest.c.

◆ EXPECT_OVERFLOW

#define EXPECT_OVERFLOW   ok(hres == (HRESULT)DISP_E_OVERFLOW, szFailOverflow, hres)

Definition at line 1748 of file vartest.c.

◆ EXPECT_R4

#define EXPECT_R4 (   val)
Value:
ok(V_R4(&vOut) == val, "Expected r4 = %f, got %f\n", val, V_R4(&vOut)); }
@ VT_R4
Definition: compat.h:2299
#define V_R4(A)
Definition: oleauto.h:260

Definition at line 1771 of file vartest.c.

◆ EXPECT_R8

#define EXPECT_R8 (   val)
Value:
ok(V_R8(&vOut) == val, "Expected r8 = %g, got %g\n", val, V_R8(&vOut)); }
@ VT_R8
Definition: compat.h:2300
#define V_R8(A)
Definition: oleauto.h:262

Definition at line 1773 of file vartest.c.

◆ EXPECT_TYPE

#define EXPECT_TYPE (   typ)    ok(V_VT(&vOut) == typ,"Expected Type = " #typ ", got %d\n", V_VT(&vOut))

Definition at line 1752 of file vartest.c.

◆ EXPECT_UI1

#define EXPECT_UI1 (   val)
Value:
ok(V_UI1(&vOut) == val, "Expected ui1 = %d, got %d\n", (BYTE)val, V_UI1(&vOut)); }
@ VT_UI1
Definition: compat.h:2311
#define V_UI1(A)
Definition: oleauto.h:266
unsigned char BYTE
Definition: xxhash.c:193

Definition at line 1755 of file vartest.c.

◆ EXPECT_UI2

#define EXPECT_UI2 (   val)
Value:
ok(V_UI2(&vOut) == val, "Expected ui2 = %d, got %d\n", (USHORT)val, V_UI2(&vOut)); }
@ VT_UI2
Definition: compat.h:2312
#define V_UI2(A)
Definition: oleauto.h:268
unsigned short USHORT
Definition: pedump.c:61

Definition at line 1759 of file vartest.c.

◆ EXPECT_UI4

#define EXPECT_UI4 (   val)
Value:
ok(V_UI4(&vOut) == val, "Expected ui4 = %d, got %d\n", (ULONG)val, V_UI4(&vOut)); }
@ VT_UI4
Definition: compat.h:2313
#define V_UI4(A)
Definition: oleauto.h:270
uint32_t ULONG
Definition: typedefs.h:59

Definition at line 1763 of file vartest.c.

◆ EXPECT_UI8

#define EXPECT_UI8 (   val)
Value:
ok(V_UI8(&vOut) == val, "Expected ui8 = 0x%x%08x, got 0x%x%08x\n", \
(DWORD)((ULONG64)val >> 32), (DWORD)(ULONG64)val, (DWORD)(V_UI8(&vOut) >> 32), (DWORD)V_UI8(&vOut)); }
@ VT_UI8
Definition: compat.h:2315
#define V_UI8(A)
Definition: oleauto.h:272

Definition at line 1768 of file vartest.c.

◆ EXPECTFAIL

#define EXPECTFAIL   ok(hres == (HRESULT)DISP_E_TYPEMISMATCH, "Call succeeded, hres = %08x\n", hres)

Definition at line 1305 of file vartest.c.

◆ EXPECTRGB

#define EXPECTRGB (   a,
  b 
)    ok(rgb[a] == b, "Digit[%d], expected %d, got %d\n", a, b, rgb[a])

Definition at line 1304 of file vartest.c.

◆ FAILDIG

#define FAILDIG   255

Definition at line 1273 of file vartest.c.

◆ I1_MAX

#define I1_MAX   0x7f

Definition at line 77 of file vartest.c.

◆ I1_MIN

#define I1_MIN   ((-I1_MAX)-1)

Definition at line 78 of file vartest.c.

◆ I2_MAX

#define I2_MAX   0x7fff

Definition at line 81 of file vartest.c.

◆ I2_MIN

#define I2_MIN   ((-I2_MAX)-1)

Definition at line 82 of file vartest.c.

◆ I4_MAX

#define I4_MAX   0x7fffffff

Definition at line 85 of file vartest.c.

◆ I4_MIN

#define I4_MIN   ((-I4_MAX)-1)

Definition at line 86 of file vartest.c.

◆ I8_MAX

#define I8_MAX   (((LONGLONG)I4_MAX << 32) | UI4_MAX)

Definition at line 89 of file vartest.c.

◆ I8_MIN

#define I8_MIN   ((-I8_MAX)-1)

Definition at line 90 of file vartest.c.

◆ INTEGER_VTBITS

◆ MKDOSDATE

#define MKDOSDATE (   d,
  m,
  y 
)    ((d & 0x1f) | ((m & 0xf) << 5) | (((y-1980) & 0x7f) << 9))

Definition at line 2151 of file vartest.c.

◆ MKDOSTIME

#define MKDOSTIME (   h,
  m,
  s 
)    (((s>>1) & 0x1f) | ((m & 0x3f) << 5) | ((h & 0x1f) << 11))

Definition at line 2152 of file vartest.c.

◆ R4_MAX

#define R4_MAX   FLT_MAX

Definition at line 95 of file vartest.c.

◆ R4_MIN

#define R4_MIN   FLT_MIN

Definition at line 96 of file vartest.c.

◆ R8_MAX

#define R8_MAX   DBL_MAX

Definition at line 97 of file vartest.c.

◆ R8_MIN

#define R8_MIN   DBL_MIN

Definition at line 98 of file vartest.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)     do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)

Definition at line 103 of file vartest.c.

◆ SETRGB

#define SETRGB (   indx,
  val 
)    if (!indx) memset(rgb, FAILDIG, sizeof(rgb)); rgb[indx] = val

Definition at line 1742 of file vartest.c.

◆ SKIPTESTAND

#define SKIPTESTAND (   a)
Value:
if (a == VT_ERROR || a == VT_VARIANT || \
a == VT_DISPATCH || a == VT_UNKNOWN || \
a > VT_UINT || a == 15 /*not defined*/) \
continue
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_ERROR
Definition: compat.h:2305
@ VT_VARIANT
Definition: compat.h:2307
@ VT_UINT
Definition: compat.h:2317
@ VT_DISPATCH
Definition: compat.h:2304
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Definition at line 6211 of file vartest.c.

◆ SKIPTESTDIV

#define SKIPTESTDIV (   a)
Value:
if (a == VT_ERROR || a == VT_VARIANT || \
a == VT_DISPATCH || a == VT_UNKNOWN || \
a == VT_RECORD || a > VT_UINT || \
a == VT_I1 || a == VT_UI8 || \
a == VT_INT || a == VT_UINT || \
a == VT_UI2 || a == VT_UI4 || \
a == 15 /*not defined*/) \
continue
@ VT_INT
Definition: compat.h:2316
@ VT_RECORD
Definition: compat.h:2326

Definition at line 7684 of file vartest.c.

◆ SKIPTESTIDIV

#define SKIPTESTIDIV (   a)
Value:
if (a == VT_ERROR || a == VT_VARIANT || \
a == VT_DISPATCH || a == VT_UNKNOWN || \
a == VT_RECORD || a > VT_UINT || \
a == 15 /*not defined*/) \
continue

Definition at line 8058 of file vartest.c.

◆ SKIPTESTIMP

#define SKIPTESTIMP (   a)
Value:
if (a == VT_ERROR || a == VT_VARIANT || \
a == VT_DISPATCH || a == VT_UNKNOWN || \
a == VT_RECORD || a > VT_UINT || \
a == 15 /*not defined*/) \
continue

Definition at line 8624 of file vartest.c.

◆ SKIPTESTPOW

#define SKIPTESTPOW (   a)
Value:
if (a == VT_ERROR || a == VT_VARIANT || \
a == VT_DISPATCH || a == VT_UNKNOWN || \
a == VT_RECORD || a > VT_UINT || \
a == 15 /*not defined*/) \
continue

Definition at line 7162 of file vartest.c.

◆ SKIPTESTS

#define SKIPTESTS (   a)    if((a > VT_CLSID+10) && (a < VT_BSTR_BLOB-10)) continue

Definition at line 70 of file vartest.c.

◆ ST2DT

#define ST2DT (   d,
  m,
  y,
  h,
  mn,
  s,
  ms,
  r,
  dt 
)    test_st2dt(__LINE__,d,m,y,h,mn,s,ms,r,dt)

Definition at line 2106 of file vartest.c.

◆ test_bstr_var

#define test_bstr_var (   a,
  b 
)    _test_bstr_var(__LINE__,a,b)

Definition at line 671 of file vartest.c.

◆ UD2T

#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)

Definition at line 2030 of file vartest.c.

◆ UI1_MAX

#define UI1_MAX   0xff

Definition at line 79 of file vartest.c.

◆ UI1_MIN

#define UI1_MIN   0

Definition at line 80 of file vartest.c.

◆ UI2_MAX

#define UI2_MAX   0xffff

Definition at line 83 of file vartest.c.

◆ UI2_MIN

#define UI2_MIN   0

Definition at line 84 of file vartest.c.

◆ UI4_MAX

#define UI4_MAX   0xffffffff

Definition at line 87 of file vartest.c.

◆ UI4_MIN

#define UI4_MIN   0

Definition at line 88 of file vartest.c.

◆ UI8_MAX

#define UI8_MAX   (((ULONGLONG)UI4_MAX << 32) | UI4_MAX)

Definition at line 91 of file vartest.c.

◆ UI8_MIN

#define UI8_MIN   0

Definition at line 92 of file vartest.c.

◆ V_EMPTY

#define V_EMPTY (   v)    V_I4(v)

Definition at line 73 of file vartest.c.

◆ V_NULL

#define V_NULL (   v)    V_I4(v)

Definition at line 74 of file vartest.c.

◆ V_NULL_

#define V_NULL_   V_NULL

Definition at line 6910 of file vartest.c.

◆ VARABS

#define VARABS (   vt,
  val,
  rvt,
  rval 
)
Value:
V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call1( __LINE__, pVarAbs, &v, &exp )
float rval
Definition: cylfrac.c:48
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:86
const GLdouble * v
Definition: gl.h:2040
DWORD exp
Definition: msg.c:16058

Definition at line 2277 of file vartest.c.

◆ VARADD

#define VARADD (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarAdd, &left, &right, &exp )

Definition at line 5548 of file vartest.c.

◆ VARAND

#define VARAND (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarAnd, &left, &right, &exp )

Definition at line 6198 of file vartest.c.

◆ VARANDCY

#define VARANDCY (   vt1,
  val1,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_CY; V_CY(&right).int64 = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarAnd, &left, &right, &exp )

Definition at line 6204 of file vartest.c.

◆ VARCMP

#define VARCMP (   vt1,
  val1,
  vt2,
  val2,
  result 
)     VARCMPEX(vt1,val1,vt2,val2,result,result,result,result)

Definition at line 6907 of file vartest.c.

◆ VARCMPEX

#define VARCMPEX (   vt1,
  val1,
  vt2,
  val2,
  res1,
  res2,
  res3,
  res4 
)
Value:
V_##vt1(&left) = val1; V_VT(&left) = VT_##vt1; \
V_##vt2(&right) = val2; V_VT(&right) = VT_##vt2; \
test_cmpex( __LINE__, lcid, &left, &right, res1, res2, res3, res4 )

Definition at line 6903 of file vartest.c.

◆ VARDIV

#define VARDIV (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarDiv, &left, &right, &exp )

Definition at line 7677 of file vartest.c.

◆ VAREQV

#define VAREQV (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarEqv, &left, &right, &exp )

Definition at line 5238 of file vartest.c.

◆ VARFIX

#define VARFIX (   vt,
  val,
  rvt,
  rval 
)
Value:
V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call1( __LINE__, pVarFix, &v, &exp )

Definition at line 3238 of file vartest.c.

◆ VARIDIV

#define VARIDIV (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarIdiv, &left, &right, &exp )

Definition at line 8051 of file vartest.c.

◆ VARIMP

#define VARIMP (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarImp, &left, &right, &exp )

Definition at line 8617 of file vartest.c.

◆ VARINT

#define VARINT (   vt,
  val,
  rvt,
  rval 
)
Value:
V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call1( __LINE__, pVarInt, &v, &exp )

Definition at line 3353 of file vartest.c.

◆ VARMOD

#define VARMOD (   vt1,
  vt2,
  val1,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarMod, &left, &right, &exp )

Definition at line 2745 of file vartest.c.

◆ VARMOD2

#define VARMOD2 (   vt1,
  vt2,
  val1,
  val2,
  rvt,
  rval,
  hexpected 
)
Value:
V_VT(&left) = VT_##vt1; V_I4(&left) = val1; \
V_VT(&right) = VT_##vt2; V_I4(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_I4(&exp) = rval; \
test_Mod( __LINE__, &left, &right, &exp, hexpected )

Definition at line 2751 of file vartest.c.

◆ VARMUL

#define VARMUL (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarMul, &left, &right, &exp )

Definition at line 5377 of file vartest.c.

◆ VARNEG

#define VARNEG (   vt,
  val,
  rvt,
  rval 
)
Value:
V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call1( __LINE__, pVarNeg, &v, &exp )

Definition at line 3469 of file vartest.c.

◆ VARNOT

#define VARNOT (   vt,
  val,
  rvt,
  rval 
)
Value:
V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call1( __LINE__, pVarNot, &v, &exp )

Definition at line 2375 of file vartest.c.

◆ VAROR

#define VAROR (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarOr, &left, &right, &exp )

Definition at line 4497 of file vartest.c.

◆ VARORCY

#define VARORCY (   vt1,
  val1,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_CY; V_CY(&right).int64 = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarOr, &left, &right, &exp )

Definition at line 4503 of file vartest.c.

◆ VARPOW

#define VARPOW (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarPow, &left, &right, &exp )

Definition at line 7155 of file vartest.c.

◆ VARROUND

#define VARROUND (   vt,
  val,
  deci,
  rvt,
  rval 
)
Value:
V_VT(&v) = VT_##vt; V_##vt(&v) = val; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_Round( __LINE__, &v, deci, &exp )

Definition at line 3605 of file vartest.c.

◆ VARSUB

#define VARSUB (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarSub, &left, &right, &exp )

Definition at line 2502 of file vartest.c.

◆ VARXOR

#define VARXOR (   vt1,
  val1,
  vt2,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_##vt2; V_##vt2(&right) = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarXor, &left, &right, &exp )

Definition at line 3763 of file vartest.c.

◆ VARXORCY

#define VARXORCY (   vt1,
  val1,
  val2,
  rvt,
  rval 
)
Value:
V_VT(&left) = VT_##vt1; V_##vt1(&left) = val1; \
V_VT(&right) = VT_CY; V_CY(&right).int64 = val2; \
V_VT(&exp) = VT_##rvt; V_##rvt(&exp) = rval; \
test_var_call2( __LINE__, pVarXor, &left, &right, &exp )

Definition at line 3769 of file vartest.c.

◆ VT_NULL_

#define VT_NULL_   VT_NULL

Definition at line 6911 of file vartest.c.

Typedef Documentation

◆ IRecordInfoImpl

Function Documentation

◆ _test_bstr_var()

static void _test_bstr_var ( unsigned  line,
const VARIANT v,
const char str 
)
static

Definition at line 672 of file vartest.c.

673{
674 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "unexpected vt=%d\n", V_VT(v));
675 if(V_VT(v) == VT_BSTR)
676 ok(!strcmp_wa(V_BSTR(v), str), "v=%s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), str);
677}
#define ok_(x1, x2)
Definition: atltest.h:61
@ VT_BSTR
Definition: compat.h:2303
#define wine_dbgstr_w
Definition: kernel32.h:34
#define V_BSTR(A)
Definition: oleauto.h:226
const WCHAR * str
Definition: parser.c:49
static int strcmp_wa(const WCHAR *strw, const char *stra)
Definition: vartest.c:664

◆ convert_str()

static HRESULT convert_str ( const char str,
INT  dig,
ULONG  flags,
NUMPARSE np,
BYTE  rgb[128],
LCID  lcid 
)
static

Definition at line 1275 of file vartest.c.

1277{
1278 OLECHAR buff[128];
1280 memset( rgb, FAILDIG, 128 );
1281 memset( np, 255, sizeof(*np) );
1282 np->cDig = dig;
1283 np->dwInFlags = flags;
1284 return pVarParseNumFromStr( buff, lcid, LOCALE_NOUSEROVERRIDE, np, rgb);
1285}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define CP_ACP
Definition: compat.h:109
WCHAR OLECHAR
Definition: compat.h:2292
#define MultiByteToWideChar
Definition: compat.h:110
static unsigned char buff[32768]
Definition: fatten.c:17
#define memset(x, y, z)
Definition: compat.h:39
ULONG dwInFlags
Definition: oleauto.h:728
INT cDig
Definition: oleauto.h:727
#define FAILDIG
Definition: vartest.c:1273
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19

◆ DEFINE_EXPECT()

DEFINE_EXPECT ( dispatch_invoke  )

◆ DummyDispatch_AddRef()

static ULONG WINAPI DummyDispatch_AddRef ( IDispatch iface)
static

Definition at line 138 of file vartest.c.

139{
140 return 2;
141}

◆ DummyDispatch_GetIDsOfNames()

static HRESULT WINAPI DummyDispatch_GetIDsOfNames ( IDispatch iface,
REFIID  riid,
LPOLESTR names,
UINT  cnames,
LCID  lcid,
DISPID dispid 
)
static

Definition at line 176 of file vartest.c.

178{
179 ok(0, "Unexpected call\n");
180 return E_NOTIMPL;
181}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DummyDispatch_GetTypeInfo()

static HRESULT WINAPI DummyDispatch_GetTypeInfo ( IDispatch iface,
UINT  tinfo,
LCID  lcid,
ITypeInfo **  ti 
)
static

Definition at line 170 of file vartest.c.

171{
172 ok(0, "Unexpected call\n");
173 return E_NOTIMPL;
174}

◆ DummyDispatch_GetTypeInfoCount()

static HRESULT WINAPI DummyDispatch_GetTypeInfoCount ( IDispatch iface,
UINT pctinfo 
)
static

Definition at line 164 of file vartest.c.

165{
166 ok(0, "Unexpected call\n");
167 return E_NOTIMPL;
168}

◆ DummyDispatch_Invoke()

static HRESULT WINAPI DummyDispatch_Invoke ( IDispatch iface,
DISPID  dispid,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  params,
VARIANT res,
EXCEPINFO *  ei,
UINT arg_err 
)
static

Definition at line 183 of file vartest.c.

190{
192
193 CHECK_EXPECT(dispatch_invoke);
194
195 ok(dispid == DISPID_VALUE, "got dispid %d\n", dispid);
196 ok(IsEqualIID(riid, &IID_NULL), "go riid %s\n", wine_dbgstr_guid(riid));
197 ok(wFlags == DISPATCH_PROPERTYGET, "Flags wrong\n");
198
199 ok(params->rgvarg == NULL, "got %p\n", params->rgvarg);
200 ok(params->rgdispidNamedArgs == NULL, "got %p\n", params->rgdispidNamedArgs);
201 ok(params->cArgs == 0, "got %d\n", params->cArgs);
202 ok(params->cNamedArgs == 0, "got %d\n", params->cNamedArgs);
203
204 ok(res != NULL, "got %p\n", res);
205 ok(V_VT(res) == VT_EMPTY, "got %d\n", V_VT(res));
206 ok(ei == NULL, "got %p\n", ei);
207 ok(arg_err == NULL, "got %p\n", arg_err);
208
209 if (FAILED(This->result))
210 return This->result;
211
212 V_VT(res) = This->vt;
213 if (This->vt == VT_UI1)
214 V_UI1(res) = 34;
215 else if (This->vt == VT_NULL)
216 {
217 V_VT(res) = VT_NULL;
218 V_BSTR(res) = NULL;
219 }
220 else
221 memset(res, 0, sizeof(*res));
222
223 return S_OK;
224}
#define NULL
Definition: types.h:112
@ VT_NULL
Definition: compat.h:2296
@ VT_EMPTY
Definition: compat.h:2295
GLuint res
Definition: glext.h:9613
GLenum const GLfloat * params
Definition: glext.h:5645
REFIID riid
Definition: atlbase.h:39
#define FAILED(hr)
Definition: intsafe.h:51
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define IID_NULL
Definition: guiddef.h:98
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define CHECK_EXPECT(func)
Definition: vartest.c:112
static DummyDispatch * impl_from_IDispatch(IDispatch *iface)
Definition: vartest.c:133
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531

◆ DummyDispatch_QueryInterface()

static HRESULT WINAPI DummyDispatch_QueryInterface ( IDispatch iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 148 of file vartest.c.

151{
152 *ppvObject = NULL;
153
156 {
157 *ppvObject = iface;
158 IDispatch_AddRef(iface);
159 }
160
161 return *ppvObject ? S_OK : E_NOINTERFACE;
162}
const GUID IID_IUnknown
const GUID IID_IDispatch
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ DummyDispatch_Release()

static ULONG WINAPI DummyDispatch_Release ( IDispatch iface)
static

Definition at line 143 of file vartest.c.

144{
145 return 1;
146}

◆ expect_NumFromStr()

static void expect_NumFromStr ( int  line,
HRESULT  hres,
NUMPARSE np,
INT  a,
ULONG  b,
ULONG  c,
INT  d,
INT  e,
INT  f 
)
static

Definition at line 1287 of file vartest.c.

1289{
1290 if (hres == (HRESULT)S_OK)
1291 {
1292 ok_(__FILE__,line)(np->cDig == a, "Expected cDig = %d, got %d\n", a, np->cDig);
1293 ok_(__FILE__,line)(np->dwInFlags == b, "Expected dwInFlags = 0x%x, got 0x%x\n", b, np->dwInFlags);
1294 ok_(__FILE__,line)(np->dwOutFlags == c, "Expected dwOutFlags = 0x%x, got 0x%x\n", c, np->dwOutFlags);
1295 ok_(__FILE__,line)(np->cchUsed == d, "Expected cchUsed = %d, got %d\n", d, np->cchUsed);
1296 ok_(__FILE__,line)(np->nBaseShift == e, "Expected nBaseShift = %d, got %d\n", e, np->nBaseShift);
1297 ok_(__FILE__,line)(np->nPwr10 == f, "Expected nPwr10 = %d, got %d\n", f, np->nPwr10);
1298 }
1299}
ULONG dwOutFlags
Definition: oleauto.h:729
INT nBaseShift
Definition: oleauto.h:731
INT cchUsed
Definition: oleauto.h:730
INT nPwr10
Definition: oleauto.h:732

◆ get_test_recordinfo()

static IRecordInfoImpl * get_test_recordinfo ( void  )
static

Definition at line 422 of file vartest.c.

423{
424 IRecordInfoImpl *rec;
425
426 rec = HeapAlloc(GetProcessHeap(), 0, sizeof(IRecordInfoImpl));
427 rec->IRecordInfo_iface.lpVtbl = &RecordInfoVtbl;
428 rec->ref = 1;
429 rec->recordclear = 0;
430 rec->getsize = 0;
431 rec->recordcopy = 0;
432
433 return rec;
434}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
IRecordInfo IRecordInfo_iface
Definition: recinfo.c:43
unsigned int recordcopy
Definition: safearray.c:82
unsigned int getsize
Definition: vartest.c:249
unsigned int recordclear
Definition: vartest.c:248
static const IRecordInfoVtbl RecordInfoVtbl
Definition: vartest.c:399

Referenced by test_VariantClear(), and test_VariantCopy().

◆ HRESULT()

static HRESULT ( WINAPI pVarUdateFromDate)
static

◆ impl_from_IDispatch()

static DummyDispatch * impl_from_IDispatch ( IDispatch iface)
inlinestatic

Definition at line 133 of file vartest.c.

134{
135 return CONTAINING_RECORD(iface, DummyDispatch, IDispatch_iface);
136}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by DummyDispatch_Invoke().

◆ impl_from_IRecordInfo()

static IRecordInfoImpl * impl_from_IRecordInfo ( IRecordInfo iface)
inlinestatic

Definition at line 254 of file vartest.c.

255{
256 return CONTAINING_RECORD(iface, IRecordInfoImpl, IRecordInfo_iface);
257}

Referenced by RecordInfo_AddRef(), RecordInfo_GetSize(), RecordInfo_RecordClear(), RecordInfo_RecordCopy(), and RecordInfo_Release().

◆ impl_from_IUnknown()

static test_VariantClearImpl * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 735 of file vartest.c.

736{
737 return CONTAINING_RECORD(iface, test_VariantClearImpl, IUnknown_iface);
738}

Referenced by VC_AddRef(), VC_QueryInterface(), and VC_Release().

◆ init()

static void init ( void  )
static

Definition at line 436 of file vartest.c.

437{
438 BSTR bstr;
439 HRESULT res;
440
441 res = VarBstrFromBool(VARIANT_TRUE, LANG_USER_DEFAULT, VAR_LOCALBOOL, &bstr);
442 ok(res == S_OK && bstr[0], "Expected localized string for 'True'\n");
443 /* lstrcpyW / lstrcatW do not work on win95 */
444 memcpy(sz12_true, sz12, sizeof(sz12));
445 if (bstr) memcpy(&sz12_true[2], bstr, SysStringByteLen(bstr) + sizeof(WCHAR));
446 SysFreeString(bstr);
447
448 res = VarBstrFromBool(VARIANT_FALSE, LANG_USER_DEFAULT, VAR_LOCALBOOL, &bstr);
449 ok(res == S_OK && bstr[0], "Expected localized string for 'False'\n");
450 memcpy(sz12_false, sz12, sizeof(sz12));
451 if (bstr) memcpy(&sz12_false[2], bstr, SysStringByteLen(bstr) + sizeof(WCHAR));
452 SysFreeString(bstr);
453
454 hOleaut32 = GetModuleHandleA("oleaut32.dll");
455 has_i8 = GetProcAddress(hOleaut32, "VarI8FromI1") != NULL;
456 if (!has_i8)
457 skip("No support for I8 and UI8 data types\n");
458}
#define skip(...)
Definition: atltest.h:64
OLECHAR * BSTR
Definition: compat.h:2293
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRESULT WINAPI VarBstrFromBool(VARIANT_BOOL boolIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
Definition: vartype.c:6852
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:215
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define VAR_LOCALBOOL
Definition: oleauto.h:330
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
static WCHAR sz12_true[32]
Definition: vartest.c:55
static BOOL has_i8
Definition: vartest.c:62
static double *static USHORT USHORT *static const WCHAR sz12[]
Definition: vartest.c:52
static WCHAR sz12_false[32]
Definition: vartest.c:54
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ init_test_dispatch()

static void init_test_dispatch ( VARTYPE  vt,
DummyDispatch dispatch 
)
static

Definition at line 237 of file vartest.c.

238{
239 dispatch->IDispatch_iface.lpVtbl = &DummyDispatch_VTable;
240 dispatch->vt = vt;
241 dispatch->result = S_OK;
242}
void dispatch(HANDLE hStopEvent)
Definition: dispatch.c:70
static const IDispatchVtbl DummyDispatch_VTable
Definition: vartest.c:226

Referenced by test_VarCat().

◆ INT()

static UDATE *static DATE *static INT ( WINAPI pSystemTimeToVariantTime)
static

◆ is_expected_variant()

static BOOL is_expected_variant ( const VARIANT result,
const VARIANT expected 
)
static

Definition at line 585 of file vartest.c.

586{
587 if (V_VT(result) != V_VT(expected)) return FALSE;
588 switch(V_VT(expected))
589 {
590 case VT_EMPTY:
591 case VT_NULL:
592 return TRUE;
593
594#define CASE(vt) case VT_##vt: return (V_##vt(result) == V_##vt(expected))
595 CASE(BOOL);
596 CASE(I1);
597 CASE(UI1);
598 CASE(I2);
599 CASE(UI2);
600 CASE(I4);
601 CASE(UI4);
602 CASE(I8);
603 CASE(UI8);
604 CASE(INT);
605 CASE(UINT);
606#undef CASE
607
608 case VT_DATE:
610 case VT_R4:
611 return EQ_FLOAT(V_R4(result), V_R4(expected));
612 case VT_R8:
613 return EQ_FLOAT(V_R8(result), V_R8(expected));
614 case VT_CY:
615 return (V_CY(result).int64 == V_CY(expected).int64);
616 case VT_BSTR:
617 return !lstrcmpW( V_BSTR(result), V_BSTR(expected) );
618 case VT_DECIMAL:
619 return !memcmp( &V_DECIMAL(result), &V_DECIMAL(expected), sizeof(DECIMAL) );
620 default:
621 ok(0, "unhandled variant type %s\n",vtstr(V_VT(expected)));
622 return FALSE;
623 }
624}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
@ VT_DATE
Definition: compat.h:2302
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
BOOL expected
Definition: store.c:2063
unsigned int UINT
Definition: ndis.h:50
#define V_DATE(A)
Definition: oleauto.h:231
int32_t INT
Definition: typedefs.h:58
#define CASE(vt)
#define EQ_FLOAT(a, b)
Definition: vartest.c:68
static const char * vtstr(int x)
Definition: vartest.c:481

Referenced by test_Mod(), test_Round(), test_var_call1(), and test_var_call2().

◆ IsValidVariantClearVT()

static BOOL IsValidVariantClearVT ( VARTYPE  vt,
VARTYPE  extraFlags 
)
static

Definition at line 710 of file vartest.c.

711{
712 BOOL ret = FALSE;
713
714 /* Only the following flags/types are valid */
715 if ((vt <= VT_LPWSTR || vt == VT_RECORD || vt == VT_CLSID) &&
716 vt != (VARTYPE)15 &&
717 (vt < (VARTYPE)24 || vt > (VARTYPE)31) &&
718 (!(extraFlags & (VT_BYREF|VT_ARRAY)) || vt > VT_NULL) &&
719 (extraFlags == 0 || extraFlags == VT_BYREF || extraFlags == VT_ARRAY ||
720 extraFlags == (VT_ARRAY|VT_BYREF)))
721 ret = TRUE; /* ok */
722
723 if (!has_i8 && (vt == VT_I8 || vt == VT_UI8))
724 ret = FALSE; /* Old versions of oleaut32 */
725 return ret;
726}
unsigned short VARTYPE
Definition: compat.h:2254
@ VT_BYREF
Definition: compat.h:2342
@ VT_CLSID
Definition: compat.h:2337
@ VT_ARRAY
Definition: compat.h:2341
@ VT_LPWSTR
Definition: compat.h:2325
int ret

Referenced by test_VarAbs(), test_VarAdd(), test_VarCmp(), test_VarEqv(), test_VariantClear(), test_VariantCopy(), test_VariantCopyInd(), test_VarMul(), test_VarNot(), test_VarOr(), test_VarSub(), and test_VarXor().

◆ IsValidVariantCopyIndVT()

static BOOL IsValidVariantCopyIndVT ( VARTYPE  vt,
VARTYPE  extraFlags 
)
static

Definition at line 1058 of file vartest.c.

1059{
1060 BOOL ret = FALSE;
1061
1062 if ((extraFlags & VT_ARRAY) ||
1063 (vt > VT_NULL && vt != (VARTYPE)15 && vt < VT_VOID &&
1064 !(extraFlags & (VT_VECTOR|VT_RESERVED))))
1065 {
1066 ret = TRUE; /* ok */
1067 }
1068 return ret;
1069}
@ VT_VOID
Definition: compat.h:2318
@ VT_RESERVED
Definition: compat.h:2343
@ VT_VECTOR
Definition: compat.h:2340

Referenced by test_VariantCopyInd().

◆ RecordInfo_AddRef()

static ULONG WINAPI RecordInfo_AddRef ( IRecordInfo iface)
static

Definition at line 274 of file vartest.c.

275{
277 return InterlockedIncrement(&This->ref);
278}
#define InterlockedIncrement
Definition: armddk.h:53
static IRecordInfoImpl * impl_from_IRecordInfo(IRecordInfo *iface)
Definition: vartest.c:254

◆ RecordInfo_GetField()

static HRESULT WINAPI RecordInfo_GetField ( IRecordInfo iface,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField 
)
static

Definition at line 339 of file vartest.c.

341{
342 ok(0, "unexpected call\n");
343 return E_NOTIMPL;
344}

◆ RecordInfo_GetFieldNames()

static HRESULT WINAPI RecordInfo_GetFieldNames ( IRecordInfo iface,
ULONG pcNames,
BSTR rgBstrNames 
)
static

Definition at line 367 of file vartest.c.

369{
370 ok(0, "unexpected call\n");
371 return E_NOTIMPL;
372}

◆ RecordInfo_GetFieldNoCopy()

static HRESULT WINAPI RecordInfo_GetFieldNoCopy ( IRecordInfo iface,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField,
PVOID ppvDataCArray 
)
static

Definition at line 346 of file vartest.c.

348{
349 ok(0, "unexpected call\n");
350 return E_NOTIMPL;
351}

◆ RecordInfo_GetGuid()

static HRESULT WINAPI RecordInfo_GetGuid ( IRecordInfo iface,
GUID pguid 
)
static

Definition at line 313 of file vartest.c.

314{
315 ok(0, "unexpected call\n");
316 return E_NOTIMPL;
317}

◆ RecordInfo_GetName()

static HRESULT WINAPI RecordInfo_GetName ( IRecordInfo iface,
BSTR pbstrName 
)
static

Definition at line 319 of file vartest.c.

320{
321 ok(0, "unexpected call\n");
322 return E_NOTIMPL;
323}

◆ RecordInfo_GetSize()

static HRESULT WINAPI RecordInfo_GetSize ( IRecordInfo iface,
ULONG size 
)
static

Definition at line 325 of file vartest.c.

326{
328 This->getsize++;
329 *size = 0;
330 return S_OK;
331}
GLsizeiptr size
Definition: glext.h:5919

◆ RecordInfo_GetTypeInfo()

static HRESULT WINAPI RecordInfo_GetTypeInfo ( IRecordInfo iface,
ITypeInfo **  ppTypeInfo 
)
static

Definition at line 333 of file vartest.c.

334{
335 ok(0, "unexpected call\n");
336 return E_NOTIMPL;
337}

◆ RecordInfo_IsMatchingType()

static BOOL WINAPI RecordInfo_IsMatchingType ( IRecordInfo iface,
IRecordInfo info2 
)
static

Definition at line 374 of file vartest.c.

375{
376 ok(0, "unexpected call\n");
377 return FALSE;
378}

◆ RecordInfo_PutField()

static HRESULT WINAPI RecordInfo_PutField ( IRecordInfo iface,
ULONG  wFlags,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField 
)
static

Definition at line 353 of file vartest.c.

355{
356 ok(0, "unexpected call\n");
357 return E_NOTIMPL;
358}

◆ RecordInfo_PutFieldNoCopy()

static HRESULT WINAPI RecordInfo_PutFieldNoCopy ( IRecordInfo iface,
ULONG  wFlags,
PVOID  pvData,
LPCOLESTR  szFieldName,
VARIANT pvarField 
)
static

Definition at line 360 of file vartest.c.

362{
363 ok(0, "unexpected call\n");
364 return E_NOTIMPL;
365}

◆ RecordInfo_QueryInterface()

static HRESULT WINAPI RecordInfo_QueryInterface ( IRecordInfo iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 259 of file vartest.c.

260{
261 *obj = NULL;
262
264 IsEqualIID(riid, &IID_IRecordInfo))
265 {
266 *obj = iface;
267 IRecordInfo_AddRef(iface);
268 return S_OK;
269 }
270
271 return E_NOINTERFACE;
272}

◆ RecordInfo_RecordClear()

static HRESULT WINAPI RecordInfo_RecordClear ( IRecordInfo iface,
void data 
)
static

Definition at line 297 of file vartest.c.

298{
300 This->recordclear++;
301 This->rec->pvRecord = NULL;
302 return S_OK;
303}

◆ RecordInfo_RecordCopy()

static HRESULT WINAPI RecordInfo_RecordCopy ( IRecordInfo iface,
void src,
void dest 
)
static

Definition at line 305 of file vartest.c.

306{
308 This->recordcopy++;
309 ok(src == (void*)0xdeadbeef, "wrong src pointer %p\n", src);
310 return S_OK;
311}
GLenum src
Definition: glext.h:6340

◆ RecordInfo_RecordCreate()

static PVOID WINAPI RecordInfo_RecordCreate ( IRecordInfo iface)
static

Definition at line 380 of file vartest.c.

381{
382 ok(0, "unexpected call\n");
383 return NULL;
384}

◆ RecordInfo_RecordCreateCopy()

static HRESULT WINAPI RecordInfo_RecordCreateCopy ( IRecordInfo iface,
PVOID  pvSource,
PVOID ppvDest 
)
static

Definition at line 386 of file vartest.c.

388{
389 ok(0, "unexpected call\n");
390 return E_NOTIMPL;
391}

◆ RecordInfo_RecordDestroy()

static HRESULT WINAPI RecordInfo_RecordDestroy ( IRecordInfo iface,
PVOID  pvRecord 
)
static

Definition at line 393 of file vartest.c.

394{
395 ok(0, "unexpected call\n");
396 return E_NOTIMPL;
397}

◆ RecordInfo_RecordInit()

static HRESULT WINAPI RecordInfo_RecordInit ( IRecordInfo iface,
PVOID  pvNew 
)
static

Definition at line 291 of file vartest.c.

292{
293 ok(0, "unexpected call\n");
294 return E_NOTIMPL;
295}

◆ RecordInfo_Release()

static ULONG WINAPI RecordInfo_Release ( IRecordInfo iface)
static

Definition at line 280 of file vartest.c.

281{
284
285 if (!ref)
287
288 return ref;
289}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735
Definition: send.c:48

◆ setdec()

static void setdec ( DECIMAL dec,
BYTE  scl,
BYTE  sgn,
ULONG  hi32,
ULONG64  lo64 
)
static

Definition at line 461 of file vartest.c.

462{
463 S(U(*dec)).scale = scl;
464 S(U(*dec)).sign = sgn;
465 dec->Hi32 = hi32;
466 U1(*dec).Lo64 = lo64;
467}
ios_base &_STLP_CALL dec(ios_base &__s)
Definition: _ios_base.h:321
#define U(x)
Definition: wordpad.c:45
#define S(x)
Definition: test.h:217
long sgn(REAL x)
Definition: varray.cc:48

Referenced by test_VarCmp().

◆ setdec64()

static void setdec64 ( DECIMAL dec,
BYTE  scl,
BYTE  sgn,
ULONG  hi32,
ULONG  mid32,
ULONG  lo32 
)
static

Definition at line 469 of file vartest.c.

470{
471 S(U(*dec)).scale = scl;
472 S(U(*dec)).sign = sgn;
473 dec->Hi32 = hi32;
474 S1(U1(*dec)).Mid32 = mid32;
475 S1(U1(*dec)).Lo32 = lo32;
476}

Referenced by test_VarCmp().

◆ START_TEST()

START_TEST ( vartest  )

Definition at line 9177 of file vartest.c.

9178{
9179 init();
9180
9193 test_VarAbs();
9194 test_VarNot();
9195 test_VarSub();
9196 test_VarMod();
9197 test_VarFix();
9198 test_VarInt();
9199 test_VarNeg();
9200 test_VarRound();
9201 test_VarXor();
9202 test_VarOr();
9203 test_VarPow();
9204 test_VarEqv();
9205 test_VarMul();
9206 test_VarAdd();
9207 test_VarCmp(); /* Before test_VarCat() which needs VarCmp() */
9208 test_VarCat();
9209 test_VarAnd();
9210 test_VarDiv();
9211 test_VarIdiv();
9212 test_VarImp();
9213}
static void test_VarFix(void)
Definition: vartest.c:3243
static void test_VarMul(void)
Definition: vartest.c:5383
static void test_VarOr(void)
Definition: vartest.c:4509
static void test_VarRound(void)
Definition: vartest.c:3637
static void init(void)
Definition: vartest.c:436
static void test_VarPow(void)
Definition: vartest.c:7169
static void test_VarAdd(void)
Definition: vartest.c:5554
static void test_VarParseNumFromStr(void)
Definition: vartest.c:1308
static void test_VarCmp(void)
Definition: vartest.c:6913
static void test_VarInt(void)
Definition: vartest.c:3358
static void test_VariantCopyInd(void)
Definition: vartest.c:1071
static void test_VariantTimeToSystemTime(void)
Definition: vartest.c:2144
static void test_VarIdiv(void)
Definition: vartest.c:8065
static void test_VarNot(void)
Definition: vartest.c:2380
static void test_VarNeg(void)
Definition: vartest.c:3474
static void test_VarAnd(void)
Definition: vartest.c:6217
static void test_VarAbs(void)
Definition: vartest.c:2282
static void test_VarDateFromUdate(void)
Definition: vartest.c:2032
static void test_VarCat(void)
Definition: vartest.c:5741
static void test_SystemTimeToVariantTime(void)
Definition: vartest.c:2108
static void test_VariantTimeToDosDateTime(void)
Definition: vartest.c:2258
static void test_VariantCopy(void)
Definition: vartest.c:909
static void test_VarXor(void)
Definition: vartest.c:3775
static void test_VarUdateFromDate(void)
Definition: vartest.c:1976
static void test_VarImp(void)
Definition: vartest.c:8631
static void test_VarNumFromParseNum(void)
Definition: vartest.c:1785
static void test_VarSub(void)
Definition: vartest.c:2508
static void test_VarEqv(void)
Definition: vartest.c:5244
static void test_VariantInit(void)
Definition: vartest.c:679
static void test_VariantClear(void)
Definition: vartest.c:768
static void test_DosDateTimeToVariantTime(void)
Definition: vartest.c:2170
static void test_VarDiv(void)
Definition: vartest.c:7694
static void test_VarMod(void)
Definition: vartest.c:2757

◆ strcmp_wa()

static int strcmp_wa ( const WCHAR strw,
const char stra 
)
static

Definition at line 664 of file vartest.c.

665{
666 WCHAR buf[512];
668 return lstrcmpW(strw, buf);
669}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static const char * strw(LPCWSTR x)
Definition: actctx.c:49

Referenced by _test_bstr_var(), and test_VarCat().

◆ test_cmp()

static void test_cmp ( int  line,
LCID  lcid,
UINT  flags,
VARIANT left,
VARIANT right,
HRESULT  result 
)
static

Definition at line 6873 of file vartest.c.

6874{
6875 HRESULT hres;
6876
6878
6879 hres = pVarCmp(left,right,lcid,flags);
6880 ok_(__FILE__,line)(hres == result, "VarCmp(%s,%s): expected 0x%x, got hres=0x%x\n",
6882}
HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
Definition: variant.c:2712
static const char * variantstr(const VARIANT *var)
Definition: vartest.c:546
#define CHECKPTR(func)
Definition: vartest.c:58

Referenced by test_cmpex().

◆ test_cmpex()

static void test_cmpex ( int  line,
LCID  lcid,
VARIANT left,
VARIANT right,
HRESULT  res1,
HRESULT  res2,
HRESULT  res3,
HRESULT  res4 
)
static

Definition at line 6883 of file vartest.c.

6885{
6886 test_cmp( line, lcid, 0, left, right, res1 );
6887 V_VT(left) |= VT_RESERVED;
6888 test_cmp( line, lcid, 0, left, right, res2 );
6889 V_VT(left) &= ~VT_RESERVED;
6891 test_cmp( line, lcid, 0, left, right, res3 );
6892 V_VT(left) |= VT_RESERVED;
6893 test_cmp( line, lcid, 0, left, right, res4 );
6894 ok_(__FILE__,line)(V_VT(left) & V_VT(right) & VT_RESERVED, "VT_RESERVED filtered out\n");
6895}
static void test_cmp(int line, LCID lcid, UINT flags, VARIANT *left, VARIANT *right, HRESULT result)
Definition: vartest.c:6873

◆ test_DateFromUDate()

static void test_DateFromUDate ( int  line,
WORD  d,
WORD  m,
WORD  y,
WORD  h,
WORD  mn,
WORD  s,
WORD  ms,
WORD  dw,
WORD  dy,
ULONG  flags,
HRESULT  r,
DATE  dt 
)
static

Definition at line 2010 of file vartest.c.

2012{
2013 UDATE ud;
2014 double out;
2015 HRESULT res;
2016
2017 ud.st.wYear = y;
2018 ud.st.wMonth = m;
2019 ud.st.wDay = d;
2020 ud.st.wHour = h;
2021 ud.st.wMinute = mn;
2022 ud.st.wSecond = s;
2023 ud.st.wMilliseconds = ms;
2024 ud.st.wDayOfWeek = dw;
2025 ud.wDayOfYear = dy;
2026 res = pVarDateFromUdate(&ud, flags, &out);
2027 ok_(__FILE__,line)(r == res && (r != S_OK || EQ_DOUBLE(out, dt)),
2028 "expected %x, %.16g, got %x, %.16g\n", r, dt, res, out);
2029}
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GLfloat * m
Definition: glext.h:10848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
GLint dy
Definition: linetemp.h:97
static FILE * out
Definition: regtests2xml.c:44
Definition: oleauto.h:720
SYSTEMTIME st
Definition: oleauto.h:721
USHORT wDayOfYear
Definition: oleauto.h:722
WORD wYear
Definition: winbase.h:905
WORD wMilliseconds
Definition: winbase.h:912
WORD wMonth
Definition: winbase.h:906
WORD wHour
Definition: winbase.h:909
WORD wSecond
Definition: winbase.h:911
WORD wMinute
Definition: winbase.h:910
WORD wDay
Definition: winbase.h:908
WORD wDayOfWeek
Definition: winbase.h:907
#define EQ_DOUBLE(a, b)
Definition: vartest.c:67

◆ test_dos2dt()

static void test_dos2dt ( int  line,
WORD  d,
WORD  m,
WORD  y,
WORD  h,
WORD  mn,
WORD  s,
INT  r,
double  dt 
)
static

Definition at line 2154 of file vartest.c.

2156{
2157 unsigned short dosDate, dosTime;
2158 double out;
2159 INT res;
2160
2161 out = 0.0;
2162 dosDate = MKDOSDATE(d, m, y);
2163 dosTime = MKDOSTIME(h, mn, s);
2164 res = pDosDateTimeToVariantTime(dosDate, dosTime, &out);
2165 ok_(__FILE__,line)(r == res && (!r || EQ_DOUBLE(out, dt)),
2166 "expected %d, %.16g, got %d, %.16g\n", r, dt, res, out);
2167}
#define MKDOSDATE(d, m, y)
Definition: vartest.c:2151
#define MKDOSTIME(h, m, s)
Definition: vartest.c:2152

◆ test_DosDateTimeToVariantTime()

static void test_DosDateTimeToVariantTime ( void  )
static

Definition at line 2170 of file vartest.c.

2171{
2173
2174 /* Date */
2175 DOS2DT(1,1,1980,0,0,0,1,29221.0); /* 1/1/1980 */
2176 DOS2DT(31,12,2099,0,0,0,1,73050.0); /* 31/12/2099 */
2177 /* Dates are limited to the dos date max of 31/12/2099 */
2178 DOS2DT(31,12,2100,0,0,0,0,0.0); /* 31/12/2100 */
2179 /* Days and months of 0 cause date to roll back 1 day or month */
2180 DOS2DT(0,1,1980,0,0,0,1,29220.0); /* 0 Day => 31/12/1979 */
2181 DOS2DT(1,0,1980,0,0,0,1,29190.0); /* 0 Mth => 1/12/1979 */
2182 DOS2DT(0,0,1980,0,0,0,1,29189.0); /* 0 D/M => 30/11/1979 */
2183 /* Days > days in the month cause date to roll forward 1 month */
2184 DOS2DT(29,2,1981,0,0,0,1,29646.0); /* 29/2/1981 -> 3/1/1980 */
2185 DOS2DT(30,2,1981,0,0,0,1,29647.0); /* 30/2/1981 -> 4/1/1980 */
2186 /* Takes leap years into account when rolling forward */
2187 DOS2DT(29,2,1980,0,0,0,1,29280.0); /* 2/29/1980 */
2188 /* Months > 12 cause an error */
2189 DOS2DT(2,13,1980,0,0,0,0,0.0);
2190
2191 /* Time */
2192 DOS2DT(1,1,1980,0,0,29,1,29221.00032407407); /* 1/1/1980 12:00:28 AM */
2193 DOS2DT(1,1,1980,0,0,31,1,29221.00034722222); /* 1/1/1980 12:00:30 AM */
2194 DOS2DT(1,1,1980,0,59,0,1,29221.04097222222); /* 1/1/1980 12:59:00 AM */
2195 DOS2DT(1,1,1980,0,60,0,0,0.0); /* Invalid minutes */
2196 DOS2DT(1,1,1980,0,0,60,0,0.0); /* Invalid seconds */
2197 DOS2DT(1,1,1980,23,0,0,1,29221.95833333333); /* 1/1/1980 11:00:00 PM */
2198 DOS2DT(1,1,1980,24,0,0,0,0.0); /* Invalid hours */
2199
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);
2210
2211 DOS2DT(30,12,1899,0,0,0,1,46751.0);
2212 DOS2DT(30,12,1899,0,0,1,1,46751.0);
2213
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);
2234}
INT WINAPI DosDateTimeToVariantTime(USHORT wDosDate, USHORT wDosTime, double *pDateOut)
Definition: variant.c:1211
#define DOS2DT(d, m, y, h, mn, s, r, dt)
Definition: vartest.c:2168

Referenced by START_TEST().

◆ test_dt2dos()

static void test_dt2dos ( int  line,
double  dt,
INT  r,
WORD  d,
WORD  m,
WORD  y,
WORD  h,
WORD  mn,
WORD  s 
)
static

Definition at line 2236 of file vartest.c.

2238{
2239 unsigned short dosDate, dosTime, expDosDate, expDosTime;
2240 INT res;
2241
2242 dosTime = dosDate = 0;
2243 expDosDate = MKDOSDATE(d,m,y);
2244 expDosTime = MKDOSTIME(h,mn,s);
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));
2255}

◆ test_dt2st()

static void test_dt2st ( int  line,
double  dt,
INT  r,
WORD  d,
WORD  m,
WORD  y,
WORD  h,
WORD  mn,
WORD  s,
WORD  ms 
)
static

Definition at line 2125 of file vartest.c.

2127{
2128 SYSTEMTIME st;
2129 INT res;
2130
2131 memset(&st, 0, sizeof(st));
2132 res = pVariantTimeToSystemTime(dt, &st);
2133 ok_(__FILE__,line)(r == res &&
2134 (!r || (st.wYear == y && st.wMonth == m && st.wDay == d &&
2135 st.wHour == h && st.wMinute == mn &&
2136 st.wSecond == s && st.wMilliseconds == ms)),
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,
2139 st.wYear, st.wHour, st.wMinute, st.wSecond,
2140 st.wMilliseconds);
2141}

◆ test_Mod()

static void test_Mod ( int  line,
VARIANT left,
VARIANT right,
VARIANT expected,
HRESULT  expres 
)
static

Definition at line 2732 of file vartest.c.

2733{
2735 HRESULT hres;
2736
2737 memset( &result, 0, sizeof(result) );
2738 hres = pVarMod( left, right, &result );
2739 ok_(__FILE__,line)( hres == expres, "wrong result %x/%x\n", hres, expres );
2740 if (hres == S_OK)
2741 ok_(__FILE__,line)( is_expected_variant( &result, expected ),
2742 "got %s expected %s\n", variantstr(&result), variantstr(expected) );
2743}
static BOOL is_expected_variant(const VARIANT *result, const VARIANT *expected)
Definition: vartest.c:585

◆ test_Round()

static void test_Round ( int  line,
VARIANT arg,
int  deci,
VARIANT expected 
)
static

Definition at line 3593 of file vartest.c.

3594{
3596 HRESULT hres;
3597
3598 memset( &result, 0, sizeof(result) );
3599 hres = pVarRound( arg, deci, &result );
3600 ok_(__FILE__,line)( hres == S_OK, "wrong result %x\n", hres );
3601 if (hres == S_OK)
3602 ok_(__FILE__,line)( is_expected_variant( &result, expected ),
3603 "got %s expected %s\n", variantstr(&result), variantstr(expected) );
3604}

◆ test_st2dt()

static void test_st2dt ( int  line,
WORD  d,
WORD  m,
WORD  y,
WORD  h,
WORD  mn,
WORD  s,
WORD  ms,
INT  r,
double  dt 
)
static

Definition at line 2087 of file vartest.c.

2089{
2090 SYSTEMTIME st;
2091 double out;
2092 INT res;
2093
2094 st.wYear = y;
2095 st.wMonth = m;
2096 st.wDay = d;
2097 st.wHour = h;
2098 st.wMinute = mn;
2099 st.wSecond = s;
2100 st.wMilliseconds = ms;
2101 st.wDayOfWeek = 0;
2102 res = pSystemTimeToVariantTime(&st, &out);
2103 ok_(__FILE__,line)(r == res && (!r || EQ_DOUBLE(out, dt)),
2104 "expected %d, %.16g, got %d, %.16g\n", r, dt, res, out);
2105}

◆ test_SystemTimeToVariantTime()

static void test_SystemTimeToVariantTime ( void  )
static

Definition at line 2108 of file vartest.c.

2109{
2111 ST2DT(1,1,1980,0,0,0,0,TRUE,29221.0);
2112 ST2DT(2,1,1980,0,0,0,0,TRUE,29222.0);
2113 ST2DT(0,1,1980,0,0,0,0,TRUE,29220.0); /* Rolls back to 31 Dec 1899 */
2114 ST2DT(1,13,1980,0,0,0,0,FALSE,29587.0); /* Fails on invalid month */
2115 ST2DT(32,1,1980,0,0,0,0,FALSE,0.0); /* Fails on invalid day */
2116 ST2DT(1,1,-1,0,0,0,0,FALSE,0.0); /* Fails on invalid year */
2117 ST2DT(1,1,10000,0,0,0,0,FALSE,0.0); /* Fails on invalid year */
2118 ST2DT(1,1,9999,0,0,0,0,TRUE,2958101.0); /* 9999 is last valid year */
2119 ST2DT(31,12,90,0,0,0,0,TRUE,33238.0); /* 30 <= year < 100 is 1900+year */
2120 ST2DT(1,1,30,0,0,0,0,TRUE,10959.0); /* 30 <= year < 100 is 1900+year */
2121 ST2DT(1,1,29,0,0,0,0,TRUE,47119.0); /* 0 <= year < 30 is 2000+year */
2122 ST2DT(1,1,0,0,0,0,0,TRUE,36526.0); /* 0 <= year < 30 is 2000+year */
2123}
INT WINAPI SystemTimeToVariantTime(LPSYSTEMTIME lpSt, double *pDateOut)
Definition: variant.c:1286
#define ST2DT(d, m, y, h, mn, s, ms, r, dt)
Definition: vartest.c:2106

Referenced by START_TEST().

◆ test_UdateFromDate()

static void test_UdateFromDate ( int  line,
DATE  dt,
ULONG  flags,
HRESULT  r,
WORD  d,
WORD  m,
WORD  y,
WORD  h,
WORD  mn,
WORD  s,
WORD  ms,
WORD  dw,
WORD  dy 
)
static

Definition at line 1958 of file vartest.c.

1960{
1961 UDATE ud;
1962 HRESULT res;
1963
1964 memset(&ud, 0, sizeof(ud));
1965 res = pVarUdateFromDate(dt, flags, &ud);
1966 ok_(__FILE__,line)(r == res && (res != S_OK || (ud.st.wYear == y && ud.st.wMonth == m && ud.st.wDay == d &&
1967 ud.st.wHour == h && ud.st.wMinute == mn && ud.st.wSecond == s &&
1968 ud.st.wMilliseconds == ms && ud.st.wDayOfWeek == dw && ud.wDayOfYear == dy)),
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,
1971 res, ud.st.wDay, ud.st.wMonth, ud.st.wYear, ud.st.wHour, ud.st.wMinute,
1973}

◆ test_var_call1()

static void test_var_call1 ( int  line,
HRESULT(WINAPI *func)(LPVARIANT, LPVARIANT ,
VARIANT arg,
VARIANT expected 
)
static

Definition at line 626 of file vartest.c.

628{
629 VARIANT old_arg = *arg;
632
633 memset( &result, 0, sizeof(result) );
634 hres = func( arg, &result );
635 ok_(__FILE__,line)( hres == S_OK, "wrong result %x\n", hres );
636 if (hres == S_OK)
638 "got %s expected %s\n", variantstr(&result), variantstr(expected) );
639 ok_(__FILE__,line)( is_expected_variant( arg, &old_arg ), "Modified argument %s / %s\n",
640 variantstr(&old_arg), variantstr(arg));
642}
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
void * arg
Definition: msvc.h:10

◆ test_var_call2()

static void test_var_call2 ( int  line,
HRESULT(WINAPI *func)(LPVARIANT, LPVARIANT, LPVARIANT ,
VARIANT left,
VARIANT right,
VARIANT expected 
)
static

Definition at line 644 of file vartest.c.

646{
647 VARIANT old_left = *left, old_right = *right;
650
651 memset( &result, 0, sizeof(result) );
652 hres = func( left, right, &result );
653 ok_(__FILE__,line)( hres == S_OK, "wrong result %x\n", hres );
654 if (hres == S_OK)
656 "got %s expected %s\n", variantstr(&result), variantstr(expected) );
657 ok_(__FILE__,line)( is_expected_variant( left, &old_left ), "Modified left argument %s / %s\n",
658 variantstr(&old_left), variantstr(left));
659 ok_(__FILE__,line)( is_expected_variant( right, &old_right ), "Modified right argument %s / %s\n",
660 variantstr(&old_right), variantstr(right));
662}

◆ test_VarAbs()

static void test_VarAbs ( void  )
static

Definition at line 2282 of file vartest.c.

2283{
2284 static WCHAR szNum[] = {'-','1','.','1','\0' };
2285 char buff[8];
2286 HRESULT hres;
2287 VARIANT v, vDst, exp;
2288 size_t i;
2289
2291
2292 /* Test all possible V_VT values.
2293 */
2294 for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++)
2295 {
2296 VARTYPE vt;
2297
2298 for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
2299 {
2300 HRESULT hExpected = DISP_E_BADVARTYPE;
2301
2302 SKIPTESTS(vt);
2303
2304 memset(&v, 0, sizeof(v));
2305 V_VT(&v) = vt | ExtraFlags[i];
2306 V_VT(&vDst) = VT_EMPTY;
2307
2308 hres = pVarAbs(&v,&vDst);
2309 if (ExtraFlags[i] & VT_ARRAY ||
2310 (!ExtraFlags[i] && (vt == VT_UNKNOWN || vt == VT_BSTR ||
2311 vt == VT_DISPATCH || vt == VT_ERROR || vt == VT_RECORD)))
2312 {
2313 hExpected = DISP_E_TYPEMISMATCH;
2314 }
2315 else if (ExtraFlags[i] || vt >= VT_CLSID || vt == VT_VARIANT)
2316 {
2317 hExpected = DISP_E_BADVARTYPE;
2318 }
2320 hExpected = S_OK;
2321
2322 /* Native always fails on some vartypes that should be valid. don't
2323 * check that Wine does the same; these are bugs in native.
2324 */
2325 if (vt == VT_I8 || vt == VT_UI8 || vt == VT_INT || vt == VT_UINT ||
2326 vt == VT_I1 || vt == VT_UI2 || vt == VT_UI4)
2327 continue;
2328 ok(hres == hExpected, "VarAbs: expected 0x%X, got 0x%X for vt %d | 0x%X\n",
2329 hExpected, hres, vt, ExtraFlags[i]);
2330 }
2331 }
2332
2333 /* BOOL->I2, BSTR->R8, all others remain the same */
2334 VARABS(BOOL,VARIANT_TRUE,I2,-VARIANT_TRUE);
2335 VARABS(BOOL,VARIANT_FALSE,I2,VARIANT_FALSE);
2336 VARABS(EMPTY,0,I2,0);
2337 VARABS(EMPTY,1,I2,0);
2338 VARABS(NULL,0,NULL,0);
2339 VARABS(NULL,1,NULL,0);
2340 VARABS(I2,1,I2,1);
2341 VARABS(I2,-1,I2,1);
2342 VARABS(I4,1,I4,1);
2343 VARABS(I4,-1,I4,1);
2344 VARABS(UI1,1,UI1,1);
2345 VARABS(R4,1,R4,1);
2346 VARABS(R4,-1,R4,1);
2347 VARABS(R8,1,R8,1);
2348 VARABS(R8,-1,R8,1);
2349 VARABS(DATE,1,DATE,1);
2350 VARABS(DATE,-1,DATE,1);
2351 V_VT(&v) = VT_CY;
2352 V_CY(&v).int64 = -10000;
2353 memset(&vDst,0,sizeof(vDst));
2354 hres = pVarAbs(&v,&vDst);
2355 ok(hres == S_OK && V_VT(&vDst) == VT_CY && V_CY(&vDst).int64 == 10000,
2356 "VarAbs(CY): expected 0x0 got 0x%X\n", hres);
2358 if (buff[1])
2359 {
2360 trace("Skipping VarAbs(BSTR) as decimal separator is '%s'\n", buff);
2361 return;
2362 } else {
2363 szNum[2] = buff[0];
2364 }
2365 V_VT(&v) = VT_BSTR;
2366 V_BSTR(&v) = (BSTR)szNum;
2367 memset(&vDst,0,sizeof(vDst));
2368 hres = pVarAbs(&v,&vDst);
2369 ok(hres == S_OK && V_VT(&vDst) == VT_R8 && V_R8(&vDst) == 1.1,
2370 "VarAbs: expected 0x0,%d,%g, got 0x%X,%d,%g\n", VT_R8, 1.1, hres, V_VT(&vDst), V_R8(&vDst));
2371}
@ R8
Definition: amd64_sup.c:13
#define trace
Definition: atltest.h:70
double DATE
Definition: compat.h:2253
@ VT_BSTR_BLOB
Definition: compat.h:2339
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: lang.c:1022
#define EMPTY(rect)
Definition: text.c:32
#define LOCALE_USER_DEFAULT
#define R4(v, w, x, y, z, i)
Definition: sha1.c:39
HRESULT WINAPI VarAbs(LPVARIANT pVarIn, LPVARIANT pVarOut)
Definition: variant.c:4263
#define VARABS(vt, val, rvt, rval)
Definition: vartest.c:2277
static const VARTYPE ExtraFlags[16]
Definition: vartest.c:689
static BOOL IsValidVariantClearVT(VARTYPE vt, VARTYPE extraFlags)
Definition: vartest.c:710
#define SKIPTESTS(a)
Definition: vartest.c:70
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
#define DISP_E_TYPEMISMATCH
Definition: winerror.h:2514
#define LOCALE_SDECIMAL
Definition: winnls.h:42

Referenced by START_TEST().

◆ test_VarAdd()

static void test_VarAdd ( void  )
static

Definition at line 5554 of file vartest.c.

5555{
5557 VARTYPE i;
5558 BSTR lbstr, rbstr;
5559 HRESULT hres;
5560 double r;
5561
5563
5564 lbstr = SysAllocString(sz12);
5565 rbstr = SysAllocString(sz12);
5566
5567 /* Test all possible flag/vt combinations & the resulting vt type */
5568 for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++)
5569 {
5570 VARTYPE leftvt, rightvt, resvt;
5571
5572 for (leftvt = 0; leftvt <= VT_BSTR_BLOB; leftvt++)
5573 {
5574
5575 SKIPTESTS(leftvt);
5576
5577 for (rightvt = 0; rightvt <= VT_BSTR_BLOB; rightvt++)
5578 {
5579 BOOL bFail = FALSE;
5580
5581 SKIPTESTS(rightvt);
5582
5583 if (leftvt == VT_UNKNOWN || rightvt == VT_UNKNOWN)
5584 continue;
5585
5586 memset(&left, 0, sizeof(left));
5587 memset(&right, 0, sizeof(right));
5588 V_VT(&left) = leftvt | ExtraFlags[i];
5589 if (leftvt == VT_BSTR)
5590 V_BSTR(&left) = lbstr;
5591 V_VT(&right) = rightvt | ExtraFlags[i];
5592 if (rightvt == VT_BSTR)
5593 V_BSTR(&right) = rbstr;
5594 V_VT(&result) = VT_EMPTY;
5595 resvt = VT_ERROR;
5596
5597 /* Don't ask me why but native VarAdd cannot handle:
5598 VT_I1, VT_UI2, VT_UI4, VT_INT, VT_UINT and VT_UI8.
5599 Tested with DCOM98, Win2k, WinXP */
5600 if (ExtraFlags[i] & VT_ARRAY || ExtraFlags[i] & VT_BYREF ||
5601 !IsValidVariantClearVT(leftvt, ExtraFlags[i]) ||
5602 !IsValidVariantClearVT(rightvt, ExtraFlags[i]) ||
5603 leftvt == VT_CLSID || rightvt == VT_CLSID ||
5604 leftvt == VT_RECORD || rightvt == VT_RECORD ||
5605 leftvt == VT_VARIANT || rightvt == VT_VARIANT ||
5606 leftvt == VT_ERROR || rightvt == VT_ERROR ||
5607 leftvt == VT_I1 || rightvt == VT_I1 ||
5608 leftvt == VT_UI2 || rightvt == VT_UI2 ||
5609 leftvt == VT_UI4 || rightvt == VT_UI4 ||
5610 leftvt == VT_UI8 || rightvt == VT_UI8 ||
5611 leftvt == VT_INT || rightvt == VT_INT ||
5612 leftvt == VT_UINT || rightvt == VT_UINT) {
5613 bFail = TRUE;
5614 }
5615
5616 if (leftvt == VT_NULL || rightvt == VT_NULL)
5617 resvt = VT_NULL;
5618 else if (leftvt == VT_DISPATCH || rightvt == VT_DISPATCH)
5619 bFail = TRUE;
5620 else if (leftvt == VT_DECIMAL || rightvt == VT_DECIMAL)
5621 resvt = VT_DECIMAL;
5622 else if (leftvt == VT_DATE || rightvt == VT_DATE)
5623 resvt = VT_DATE;
5624 else if (leftvt == VT_CY || rightvt == VT_CY)
5625 resvt = VT_CY;
5626 else if (leftvt == VT_R8 || rightvt == VT_R8)
5627 resvt = VT_R8;
5628 else if (leftvt == VT_BSTR || rightvt == VT_BSTR) {
5629 if ((leftvt == VT_BSTR && rightvt == VT_BSTR) ||
5630 leftvt == VT_EMPTY || rightvt == VT_EMPTY)
5631 resvt = VT_BSTR;
5632 else
5633 resvt = VT_R8;
5634 } else if (leftvt == VT_R4 || rightvt == VT_R4) {
5635 if (leftvt == VT_I4 || rightvt == VT_I4 ||
5636 leftvt == VT_I8 || rightvt == VT_I8)
5637 resvt = VT_R8;
5638 else
5639 resvt = VT_R4;
5640 }
5641 else if (leftvt == VT_I8 || rightvt == VT_I8)
5642 resvt = VT_I8;
5643 else if (leftvt == VT_I4 || rightvt == VT_I4)
5644 resvt = VT_I4;
5645 else if (leftvt == VT_I2 || rightvt == VT_I2 ||
5646 leftvt == VT_BOOL || rightvt == VT_BOOL ||
5647 (leftvt == VT_EMPTY && rightvt == VT_EMPTY))
5648 resvt = VT_I2;
5649 else if (leftvt == VT_UI1 || rightvt == VT_UI1)
5650 resvt = VT_UI1;
5651
5652 hres = pVarAdd(&left, &right, &result);
5653 if (bFail) {
5655 "VarAdd: %d|0x%X, %d|0x%X: Expected failure, got 0x%X vt %d\n",
5656 leftvt, ExtraFlags[i], rightvt, ExtraFlags[i], hres,
5657 V_VT(&result));
5658 } else {
5659 ok(hres == S_OK && V_VT(&result) == resvt,
5660 "VarAdd: %d|0x%X, %d|0x%X: expected S_OK, vt %d, got 0x%X vt %d\n",
5661 leftvt, ExtraFlags[i], rightvt, ExtraFlags[i], resvt, hres,
5662 V_VT(&result));
5663 }
5664 /* Note, we don't clear left/right deliberately here */
5666 }
5667 }
5668 }
5669
5670 /* Test returned values */
5671 VARADD(I4,4,I4,2,I4,6);
5672 VARADD(I2,4,I2,2,I2,6);
5673 VARADD(I2,-13,I4,5,I4,-8);
5674 VARADD(I4,-13,I4,5,I4,-8);
5675 VARADD(I2,7,R4,0.5f,R4,7.5f);
5676 VARADD(R4,0.5f,I4,5,R8,5.5);
5677 VARADD(R8,7.1,BOOL,0,R8,7.1);
5678 VARADD(BSTR,lbstr,I2,4,R8,16);
5679 VARADD(BSTR,lbstr,BOOL,1,R8,13);
5680 VARADD(BSTR,lbstr,R4,0.1f,R8,12.1);
5681 VARADD(R4,0.2f,BSTR,rbstr,R8,12.2);
5682 VARADD(DATE,2.25,I4,7,DATE,9.25);
5683 VARADD(DATE,1.25,R4,-1.7f,DATE,-0.45);
5684
5685 VARADD(UI1, UI1_MAX, UI1, UI1_MAX, I2, UI1_MAX + UI1_MAX);
5686 VARADD(I2, I2_MAX, I2, I2_MAX, I4, I2_MAX + I2_MAX);
5687 VARADD(I2, I2_MAX, I2, I2_MIN, I2, I2_MAX + I2_MIN);
5688 VARADD(I2, I2_MIN, I2, I2_MIN, I4, I2_MIN + I2_MIN);
5689 VARADD(I4, I4_MAX, I4, I4_MIN, I4, I4_MAX + I4_MIN);
5690 VARADD(I4, I4_MAX, I4, I4_MAX, R8, (double)I4_MAX + I4_MAX);
5691 VARADD(I4, I4_MIN, I4, I4_MIN, R8, (double)I4_MIN + I4_MIN);
5692 VARADD(R4, R4_MAX, R4, R4_MAX, R8, (double)R4_MAX + R4_MAX);
5697
5698 /* Manually test BSTR + BSTR */
5699 V_VT(&left) = VT_BSTR;
5700 V_BSTR(&left) = lbstr;
5701 V_VT(&right) = VT_BSTR;
5702 V_BSTR(&right) = rbstr;
5703 hres = pVarAdd(&left, &right, &result);
5704 ok(hres == S_OK && V_VT(&result) == VT_BSTR, "VarAdd: expected coerced type VT_BSTR, got %s!\n", vtstr(V_VT(&result)));
5705 hres = VarR8FromStr(V_BSTR(&result), 0, 0, &r);
5706 ok(hres == S_OK && EQ_DOUBLE(r, 1212.0), "VarAdd: BSTR value %f, expected %f\n", r, 1212.0);
5708
5709 /* Manuly test some VT_CY and VT_DECIMAL variants */
5710 V_VT(&cy) = VT_CY;
5711 hres = VarCyFromI4(4711, &V_CY(&cy));
5712 ok(hres == S_OK, "VarCyFromI4 failed!\n");
5713 V_VT(&dec) = VT_DECIMAL;
5714 hres = VarDecFromR8(-4.2, &V_DECIMAL(&dec));
5715 ok(hres == S_OK, "VarDecFromR4 failed!\n");
5716 memset(&left, 0, sizeof(left));
5717 memset(&right, 0, sizeof(right));
5718 V_VT(&left) = VT_I4;
5719 V_I4(&left) = -11;
5720 V_VT(&right) = VT_UI1;
5721 V_UI1(&right) = 9;
5722
5723 hres = pVarAdd(&cy, &right, &result);
5724 ok(hres == S_OK && V_VT(&result) == VT_CY, "VarAdd: expected coerced type VT_CY, got %s!\n", vtstr(V_VT(&result)));
5725 hres = VarR8FromCy(V_CY(&result), &r);
5726 ok(hres == S_OK && EQ_DOUBLE(r, 4720.0), "VarAdd: CY value %f, expected %f\n", r, 4720.0);
5727
5728 hres = pVarAdd(&left, &dec, &result);
5729 ok(hres == S_OK && V_VT(&result) == VT_DECIMAL, "VarAdd: expected coerced type VT_DECIMAL, got %s!\n", vtstr(V_VT(&result)));
5731 ok(hres == S_OK && EQ_DOUBLE(r, -15.2), "VarAdd: DECIMAL value %f, expected %f\n", r, -15.2);
5733
5734 SysFreeString(lbstr);
5735 SysFreeString(rbstr);
5736}
@ VT_BOOL
Definition: compat.h:2306
HRESULT WINAPI VarR8FromCy(CY cyIn, double *pDblOut)
Definition: vartype.c:3113
HRESULT WINAPI VarDecFromR8(double dblIn, DECIMAL *pDecOut)
Definition: vartype.c:4200
HRESULT WINAPI VarCyFromI4(LONG lIn, CY *pCyOut)
Definition: vartype.c:3462
HRESULT WINAPI VarR8FromDec(const DECIMAL *pDecIn, double *pDblOut)
Definition: vartype.c:3267
HRESULT WINAPI VarR8FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, double *pDblOut)
Definition: vartype.c:3151
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
Definition: variant.c:3130
#define I2_MIN
Definition: vartest.c:82
#define VARADD(vt1, val1, vt2, val2, rvt, rval)
Definition: vartest.c:5548
#define I4_MAX
Definition: vartest.c:85
#define I2_MAX
Definition: vartest.c:81
#define R4_MAX
Definition: vartest.c:95
#define R4_MIN
Definition: vartest.c:96
#define I4_MIN
Definition: vartest.c:86
#define R8_MIN
Definition: vartest.c:98
#define R8_MAX
Definition: vartest.c:97
#define UI1_MAX
Definition: vartest.c:79

Referenced by START_TEST().

◆ test_VarAnd()

static void test_VarAnd ( void  )
static

Definition at line 6217 of file vartest.c.

6218{
6219 static const WCHAR szFalse[] = { '#','F','A','L','S','E','#','\0' };
6220 static const WCHAR szTrue[] = { '#','T','R','U','E','#','\0' };
6222 BSTR false_str, true_str;
6223 VARTYPE i;
6224 HRESULT hres;
6225
6227
6228 true_str = SysAllocString(szTrue);
6229 false_str = SysAllocString(szFalse);
6230
6231 /* Test all possible flag/vt combinations & the resulting vt type */
6232 for (i = 0; i < ARRAY_SIZE(ExtraFlags); i++)
6233 {
6234 VARTYPE leftvt, rightvt, resvt;
6235
6236 for (leftvt = 0; leftvt <= VT_BSTR_BLOB; leftvt++)
6237 {
6238 SKIPTESTAND(leftvt);
6239
6240 /* Check if we need/have support for I8 and/or UI8 */
6241 if ((leftvt == VT_I8 || leftvt == VT_UI8) && !has_i8)
6242 continue;
6243
6244 for (rightvt = 0; rightvt <= VT_BSTR_BLOB; rightvt++)
6245 {
6246 BOOL bFail = FALSE;
6247 SKIPTESTAND(rightvt);
6248
6249 /* Check if we need/have support for I8 and/or UI8 */
6250 if ((rightvt == VT_I8 || rightvt == VT_UI8) && !has_i8)
6251 continue;
6252
6253 memset(&left, 0, sizeof(left));
6254 memset(&right, 0, sizeof(right));
6255 V_VT(&left) = leftvt | ExtraFlags[i];
6256 V_VT(&right) = rightvt | ExtraFlags[i];
6257 V_VT(&result) = VT_EMPTY;
6258 resvt = VT_EMPTY;
6259 if ((leftvt | ExtraFlags[i]) == VT_BSTR)
6260 V_BSTR(&left) = true_str;
6261 if ((rightvt | ExtraFlags[i]) == VT_BSTR)
6262 V_BSTR(&right) = true_str;
6263
6264 /* Native VarAnd always returns an error when using extra
6265 * flags or if the variant combination is I8 and INT.
6266 */
6267 if ((leftvt == VT_I8 && rightvt == VT_INT) ||
6268 (leftvt == VT_INT && rightvt == VT_I8) ||
6269 ExtraFlags[i] != 0)
6270 bFail = TRUE;
6271
6272 /* Determine return type */
6273 else if (leftvt == VT_I8 || rightvt == VT_I8)
6274 resvt = VT_I8;
6275 else if (leftvt == VT_I4 || rightvt == VT_I4 ||
6276 leftvt == VT_UINT || rightvt == VT_UINT ||
6277 leftvt == VT_INT || rightvt == VT_INT ||
6278 leftvt == VT_R4 || rightvt == VT_R4 ||
6279 leftvt == VT_R8 || rightvt == VT_R8 ||
6280 leftvt == VT_CY || rightvt == VT_CY ||
6281 leftvt == VT_DATE || rightvt == VT_DATE ||
6282 leftvt == VT_I1 || rightvt == VT_I1 ||
6283 leftvt == VT_UI2 || rightvt == VT_UI2 ||
6284 leftvt == VT_UI4 || rightvt == VT_UI4 ||
6285 leftvt == VT_UI8 || rightvt == VT_UI8 ||
6286 leftvt == VT_DECIMAL || rightvt == VT_DECIMAL)
6287 resvt = VT_I4;
6288 else if (leftvt == VT_UI1 || rightvt == VT_UI1 ||
6289 leftvt == VT_I2 || rightvt == VT_I2 ||
6290 leftvt == VT_EMPTY || rightvt == VT_EMPTY)
6291 if ((leftvt == VT_NULL && rightvt == VT_UI1) ||
6292 (leftvt == VT_UI1 && rightvt == VT_NULL) ||
6293 (leftvt == VT_UI1 && rightvt == VT_UI1))
6294 resvt = VT_UI1;
6295 else
6296 resvt = VT_I2;
6297 else if (leftvt == VT_BOOL || rightvt == VT_BOOL ||
6298 (leftvt == VT_BSTR && rightvt == VT_BSTR))
6299 resvt = VT_BOOL;
6300 else if (leftvt == VT_NULL || rightvt == VT_NULL ||
6301 leftvt == VT_BSTR || rightvt == VT_BSTR)
6302 resvt = VT_NULL;
6303 else
6304 bFail = TRUE;
6305
6306 hres = pVarAnd(&left, &right, &result);
6307
6308 /* Check expected HRESULT and if result variant type is correct */
6309 if (bFail)
6311 "VarAnd: %s|0x%X, %s|0x%X: got vt %s hr 0x%X\n",
6312 vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i],
6313 vtstr(V_VT(&result)), hres);
6314 else
6315 ok (hres == S_OK && resvt == V_VT(&result),
6316 "VarAnd: %s|0x%X, %s|0x%X: expected vt %s hr 0x%X, got vt %s hr 0x%X\n",
6317 vtstr(leftvt), ExtraFlags[i], vtstr(rightvt), ExtraFlags[i], vtstr(resvt),
6318 S_OK, vtstr(V_VT(&result)), hres);
6319 }
6320 }
6321 }
6322
6323 /*
6324 * Test returned values. Since we know the returned type is correct
6325 * and that we handle all combinations of invalid types, just check
6326 * that good type combinations produce the desired value.
6327 * FIXME: Test VT_DECIMAL
6328 */
6329 VARAND(EMPTY,0,EMPTY,0,I2,0);
6330 VARAND(EMPTY,1,EMPTY,0,I2,0);
6331 VARAND(EMPTY,1,EMPTY,1,I2,0);
6332 VARAND(EMPTY,0,NULL,0,I2,0);
6333 VARAND(EMPTY,1,NULL,0,I2,0);
6334 VARAND(EMPTY,1,NULL,1,I2,0);
6335 VARAND(EMPTY,0,I1,0,I4,0);
6336 VARAND(EMPTY,0,I1,1,I4,0);
6337 VARAND(EMPTY,1,I1,1,I4,0);
6338 VARAND(EMPTY,0,UI1,0,I2,0);
6339 VARAND(EMPTY,0,UI1,1,I2,0);
6340 VARAND(EMPTY,1,UI1,1,I2,0);
6341 VARAND(EMPTY,0,I2,0,I2,0);
6342 VARAND(EMPTY,0,I2,1,I2,0);
6343 VARAND(EMPTY,1,I2,1,I2,0);
6344 VARAND(EMPTY,0,UI2,0,I4,0);
6345 VARAND(EMPTY,0,UI2,1,I4,0);
6346 VARAND(EMPTY,1,UI2,1,I4,0);
6347 VARAND(EMPTY,0,I4,0,I4,0);
6348 VARAND(EMPTY,0,I4,1,I4,0);
6349 VARAND(EMPTY,1,I4,1,I4,0);
6350 VARAND(EMPTY,0,UI4,0,I4,0);
6351 VARAND(EMPTY,0,UI4,1,I4,0);
6352 VARAND(EMPTY,1,UI4,1,I4,0);
6353 if (has_i8)
6354 {
6355 VARAND(EMPTY,0,I8,0,I8,0);
6356 VARAND(EMPTY,0,I8,1,I8,0);
6357 VARAND(EMPTY,1,I8,1,I8,0);
6358 VARAND(EMPTY,0,UI8,0,I4,0);
6359 VARAND(EMPTY,0,UI8,1,I4,0);
6360 VARAND(EMPTY,1,UI8,1,I4,0);
6361 }
6362 VARAND(EMPTY,0,INT,0,I4,0);
6363 VARAND(EMPTY,0,INT,1,I4,0);
6364 VARAND(EMPTY,1,INT,1,I4,0);
6365 VARAND(EMPTY,0,UINT,0,I4,0);
6366 VARAND(EMPTY,0,UINT,1,I4,0);
6367 VARAND(EMPTY,1,UINT,1,I4,0);
6368 VARAND(EMPTY,0,BOOL,0,I2,0);
6369 VARAND(EMPTY,0,BOOL,1,I2,0);
6370 VARAND(EMPTY,1,BOOL,1,I2,0);
6371 VARAND(EMPTY,0,R4,0,I4,0);
6372 VARAND(EMPTY,0,R4,1,I4,0);
6373 VARAND(EMPTY,1,R4,1,I4,0);
6374 VARAND(EMPTY,0,R8,0,I4,0);
6375 VARAND(EMPTY,0,R8,1,I4,0);
6376 VARAND(EMPTY,1,R8,1,I4,0);
6377 VARAND(EMPTY,0,BSTR,false_str,I2,0);
6378 VARAND(EMPTY,0,BSTR,true_str,I2,0);
6379 VARANDCY(EMPTY,0,10000,I4,0);
6380
6381 /* NULL OR 0 = NULL. NULL OR n = n */
6382 VARAND(NULL,0,NULL,0,NULL,0);
6383 VARAND(NULL,1,NULL,0,NULL,0);
6384 VARAND(NULL,0,I1,0,I4,0);
6385 VARAND(NULL,0,I1,1,NULL,0);
6386 VARAND(NULL,0,UI1,0,UI1,0);
6387 VARAND(NULL,0,UI1,1,NULL,0);
6388 VARAND(NULL,0,I2,0,I2,0);
6389 VARAND(NULL,0,I2,1,NULL,0);
6390 VARAND(NULL,0,UI2,0,I4,0);
6391 VARAND(NULL,0,UI2,1,NULL,0);
6392 VARAND(NULL,0,I4,0,I4,0);
6393 VARAND(NULL,0,I4,1,NULL,0);
6394 VARAND(NULL,0,UI4,0,I4,0);
6395 VARAND(NULL,0,UI4,1,NULL,0);
6396 if (has_i8)
6397 {
6398 VARAND(NULL,0,I8,0,I8,0);
6399 VARAND(NULL,0,I8,1,NULL,0);
6400 VARAND(NULL,0,UI8,0,I4,0);
6401 VARAND(NULL,0,UI8,1,NULL,0);
6402 }
6403 VARAND(NULL,0,INT,0,I4,0);
6404 VARAND(NULL,0,INT,1,NULL,0);
6405 VARAND(NULL,0,UINT,0,I4,0);
6406 VARAND(NULL,0,UINT,1,NULL,0);
6407 VARAND(NULL,0,BOOL,0,BOOL,0);
6408 VARAND(NULL,0,BOOL,1,NULL,0);
6409 VARAND(NULL,0,R4,0,I4,0);
6410 VARAND(NULL,0,R4,1,NULL,0);
6411 VARAND(NULL,0,R8,0,I4,0);
6412 VARAND(NULL,0,R8,1,NULL,0);
6413 VARAND(NULL,0,BSTR,false_str,BOOL,0);
6414 VARAND(NULL,0,BSTR,true_str,NULL,VARIANT_FALSE);
6415 VARANDCY(NULL,0,10000,NULL,0);
6416 VARANDCY(NULL,0,0,I4,0);
6417 VARAND(BOOL,VARIANT_TRUE,BOOL,VARIANT_TRUE,BOOL,VARIANT_TRUE);
6418 VARAND(BOOL,VARIANT_TRUE,BOOL,VARIANT_FALSE,BOOL,VARIANT_FALSE);
6419 VARAND(BOOL,VARIANT_FALSE,BOOL,VARIANT_TRUE,BOOL,VARIANT_FALSE);
6420 VARAND(BOOL,VARIANT_FALSE,BOOL,VARIANT_FALSE,BOOL,VARIANT_FALSE);
6421
6422 /* Assume x,y & y,x are the same from now on to reduce the number of tests */
6423 VARAND(BOOL,VARIANT_TRUE,I1,-1,I4,-1);
6424 VARAND(BOOL,VARIANT_TRUE,I1,0,I4,0);
6425 VARAND(BOOL,VARIANT_FALSE,I1,0,I4,0);
6426 VARAND(BOOL,VARIANT_TRUE,UI1,255,I2,255);
6427 VARAND(BOOL,VARIANT_TRUE,UI1,0,I2,0);
6428 VARAND(BOOL,VARIANT_FALSE,UI1,0,I2,0);
6429 VARAND(BOOL,VARIANT_TRUE,I2,-1,I2,-1);
6430 VARAND(BOOL,VARIANT_TRUE,I2,0,I2,0);
6431 VARAND(BOOL,VARIANT_FALSE,I2,0,I2,0);
6432 VARAND(BOOL,VARIANT_TRUE,UI2,65535,I4,65535);
6433 VARAND(BOOL,VARIANT_TRUE,UI2,0,I4,0);
6434 VARAND(BOOL,VARIANT_FALSE,UI2,0,I4,0);
6435 VARAND(BOOL,VARIANT_TRUE,I4,-1,I4,-1);
6436 VARAND(BOOL,VARIANT_TRUE,I4,0,I4,0);
6437 VARAND(BOOL,VARIANT_FALSE,I4,0,I4,0);
6438 VARAND(BOOL,VARIANT_TRUE,UI4,0xffffffff,I4,-1);
6439 VARAND(BOOL,VARIANT_TRUE,UI4,0,I4,0);
6440 VARAND(BOOL,VARIANT_FALSE,UI4,0,I4,0);
6441 VARAND(BOOL,VARIANT_TRUE,R4,-1,I4,-1);
6442 VARAND(BOOL,VARIANT_TRUE,R4,0,I4,0);
6443 VARAND(BOOL,VARIANT_FALSE,R4,0,I4,0);
6444 VARAND(BOOL,VARIANT_TRUE,R8,-1,I4,-1);
6445 VARAND(BOOL,VARIANT_TRUE,R8,0,I4,0);
6446 VARAND(BOOL,VARIANT_FALSE,R8,0,I4,0);
6447 VARAND(BOOL,VARIANT_TRUE,DATE,-1,I4,-1);
6448 VARAND(BOOL,VARIANT_TRUE,DATE,0,I4,0);
6449 VARAND(BOOL,VARIANT_FALSE,DATE,0,I4,0);
6450 if (has_i8)
6451 {
6452 VARAND(BOOL,VARIANT_TRUE,I8,-1,I8,-1);
6453 VARAND(BOOL,VARIANT_TRUE,I8,0,I8,0);
6454 VARAND(BOOL,VARIANT_FALSE,I8,0,I8,0);
6455 VARAND(BOOL,VARIANT_TRUE,UI8,0,I4,0);
6456 VARAND(BOOL,VARIANT_FALSE,UI8,0,I4,0);
6457 }
6458 VARAND(BOOL,VARIANT_TRUE,INT,-1,I4,-1);
6459 VARAND(BOOL,VARIANT_TRUE,INT,0,I4,0);
6460 VARAND(BOOL,VARIANT_FALSE,INT,0,I4,0);
6461 VARAND(BOOL,VARIANT_TRUE,UINT,0xffffffff,I4,-1);
6462 VARAND(BOOL,VARIANT_TRUE,UINT,0,I4,0);
6463 VARAND(BOOL,VARIANT_FALSE,UINT,0,I4,0);
6464 VARAND(BOOL,VARIANT_FALSE,BSTR,false_str,BOOL,VARIANT_FALSE);
6465 VARAND(BOOL,VARIANT_TRUE,BSTR,false_str,BOOL,VARIANT_FALSE);
6466 VARAND(BOOL,VARIANT_FALSE,BSTR,true_str,BOOL,VARIANT_FALSE);
6467 VARAND(BOOL,VARIANT_TRUE,BSTR,true_str,BOOL,VARIANT_TRUE);
6468 VARANDCY(BOOL,VARIANT_TRUE,10000,I4,1);
6469 VARANDCY(BOOL,VARIANT_TRUE,0,I4,0);
6470 VARANDCY(BOOL,VARIANT_FALSE,0,I4,0);
6471 VARAND(I1,-1,I1,-1,I4,-1);
6472 VARAND(I1,-1,I1,0,I4,0);
6473 VARAND(I1,0,I1,0,I4,0);
6474 VARAND(I1,-1,UI1,255,I4,255);
6475 VARAND(I1,-1,UI1,0,I4,0);
6476 VARAND(I1,0,UI1,0,I4,0);
6477 VARAND(I1,-1,I2,-1,I4,-1);
6478 VARAND(I1,-1,I2,0,I4,0);
6479 VARAND(I1,0,I2,0,I4,0);
6480 VARAND(I1,-1,UI2,65535,I4,65535);
6481 VARAND(I1,-1,UI2,0,I4,0);
6482 VARAND(I1,0,UI2,0,I4,0);
6483 VARAND(I1,-1,I4,-1,I4,-1);
6484 VARAND(I1,-1,I4,0,I4,0);
6485 VARAND(I1,0,I4,0,I4,0);
6486 VARAND(I1,-1,UI4,0xffffffff,I4,-1);
6487 VARAND(I1,-1,UI4,0,I4,0);
6488 VARAND(I1,0,UI4,0,I4,0);
6489 VARAND(I1,-1,R4,-1,I4,-1);
6490 VARAND(I1,-1,R4,0,I4,0);
6491 VARAND(I1,0,R4,0,I4,0);
6492 VARAND(I1,-1,R8,-1,I4,-1);
6493 VARAND(I1,-1,R8,0,I4,0);
6494 VARAND(I1,0,R8,0,I4,0);
6495 VARAND(I1,-1,DATE,-1,I4,-1);
6496 VARAND(I1,-1,DATE,0,I4,0);
6497 VARAND(I1,0,DATE,0,I4,0);
6498 if (has_i8)
6499 {
6500 VARAND(I1,-1,I8,-1,I8,-1);
6501 VARAND(I1,-1,I8,0,I8,0);
6502 VARAND(I1,0,I8,0,I8,0);
6503 VARAND(I1,-1,UI8,0,I4,0);
6504 VARAND(I1,0,UI8,0,I4,0);
6505 }
6506 VARAND(I1,-1,INT,-1,I4,-1);
6507 VARAND(I1,-1,INT,0,I4,0);
6508 VARAND(I1,0,INT,0,I4,0);
6509 VARAND(I1,-1,UINT,0xffffffff,I4,-1);
6510 VARAND(I1,-1,UINT,0,I4,0);
6511 VARAND(I1,0,UINT,0,I4,0);
6512 VARAND(I1,0,BSTR,false_str,I4,0);
6513 VARAND(I1,-1,BSTR,false_str,I4,0);
6514 VARAND(I1,0,BSTR,true_str,I4,0);
6515 VARAND(I1,-1,BSTR,true_str,I4,-1);
6516 VARANDCY(I1,-1,10000,I4,1);
6517 VARANDCY(I1,-1,0,I4,0);
6518 VARANDCY(I1,0,0,I4,0);
6519
6520 VARAND(UI1,255,UI1,255,UI1,255);
6521 VARAND(UI1,255,UI1,0,UI1,0);
6522 VARAND(UI1,0,UI1,0,UI1,0);
6523 VARAND(UI1,255,I2,-1,I2,255);
6524 VARAND(UI1,255,I2,0,I2,0);
6525 VARAND(UI1,0,I2,0,I2,0);
6526 VARAND(UI1,255,UI2,65535,I4,255);
6527 VARAND(UI1,255,UI2,0,I4,0);
6528 VARAND(UI1,0,UI2,0,I4,0);
6529 VARAND(UI1,255,I4,-1,I4,255);
6530 VARAND(UI1,255,I4,0,I4,0);
6531 VARAND(UI1,0,I4,0,I4,0);
6532 VARAND(UI1,255,UI4,0xffffffff,I4,255);
6533 VARAND(UI1,255,UI4,0,I4,0);
6534 VARAND(UI1,0,UI4,0,I4,0);
6535 VARAND(UI1,255,R4,-1,I4,255);
6536 VARAND(UI1,255,R4,0,I4,0);
6537 VARAND(UI1,0,R4,0,I4,0);
6538 VARAND(UI1,255,R8,-1,I4,255);
6539 VARAND(UI1,255,R8,0,I4,0);
6540 VARAND(UI1,0,R8,0,I4,0);
6541 VARAND(UI1,255,DATE,-1,I4,255);
6542 VARAND(UI1,255,DATE,0,I4,0);
6543 VARAND(UI1,0,DATE,0,I4,0);
6544 if (has_i8)
6545 {
6546 VARAND(UI1,255,I8,-1,I8,255);
6547 VARAND(UI1,255,I8,0,I8,0);
6548 VARAND(UI1,0,I8,0,I8,0);
6549 VARAND(UI1,255,UI8,0,I4,0);
6550 VARAND(UI1,0,UI8,0,I4,0);
6551 }
6552 VARAND(UI1,255,INT,-1,I4,255);
6553 VARAND(UI1,255,INT,0,I4,0);
6554 VARAND(UI1,0,INT,0,I4,0);
6555 VARAND(UI1,255,UINT,0xffffffff,I4,255);
6556 VARAND(UI1,255,UINT,0,I4,0);
6557 VARAND(UI1,0,UINT,0,I4,0);
6558 VARAND(UI1,0,BSTR,false_str,I2,0);
6559 VARAND(UI1,255,BSTR,false_str,I2,0);
6560 VARAND(UI1,0,BSTR,true_str,I2,0);
6561 VARAND(UI1,255,BSTR,true_str,I2,255);
6562 VARANDCY(UI1,255,10000,I4,1);
6563 VARANDCY(UI1,255,0,I4,0);
6564 VARANDCY(UI1,0,0,I4,0);
6565
6566 VARAND(I2,-1,I2,-1,I2,-1);
6567 VARAND(I2,-1,I2,0,I2,0);
6568 VARAND(I2,0,I2,0,I2,0);
6569 VARAND(I2,-1,UI2,65535,I4,65535);
6570 VARAND(I2,-1,UI2,0,I4,0);
6571 VARAND(I2,0,UI2,0,I4,0);
6572 VARAND(I2,-1,I4,-1,I4,-1);
6573 VARAND(I2,-1,I4,0,I4,0);
6574 VARAND(I2,0,I4,0,I4,0);
6575 VARAND(I2,-1,UI4,0xffffffff,I4,-1);
6576 VARAND(I2,-1,UI4,0,I4,0);
6577 VARAND(I2,0,UI4,0,I4,0);
6578 VARAND(I2,-1,R4,-1,I4,-1);
6579 VARAND(I2,-1,R4,0,I4,0);
6580 VARAND(I2,0,R4,0,I4,0);
6581 VARAND(I2,-1,R8,-1,I4,-1);
6582 VARAND(I2,-1,R8,0,I4,0);
6583 VARAND(I2,0,R8,0,I4,0);
6584 VARAND(I2,-1,DATE,-1,I4,-1);
6585 VARAND(I2,-1,DATE,0,I4,0);
6586 VARAND(I2,0,DATE,0,I4,0);
6587 if (has_i8)
6588 {
6589 VARAND(I2,-1,I8,-1,I8,-1);
6590 VARAND(I2,-1,I8,0,I8,0);
6591 VARAND(I2,0,I8,0,I8,0);
6592 VARAND(I2,-1,UI8,0,I4,0);
6593 VARAND(I2,0,UI8,0,I4,0);
6594 }
6595 VARAND(I2,-1,INT,-1,I4,-1);
6596 VARAND(I2,-1,INT,0,I4,0);
6597 VARAND(I2,0,INT,0,I4,0);
6598 VARAND(I2,-1,UINT,0xffffffff,I4,-1);
6599 VARAND(I2,-1,UINT,0,I4,0);
6600 VARAND(I2,0,UINT,0,I4,0);
6601 VARAND(I2,0,BSTR,false_str,I2,0);
6602 VARAND(I2,-1,BSTR,false_str,I2,0);
6603 VARAND(I2,0,BSTR,true_str,I2,0);
6604 VARAND(I2,-1,BSTR,true_str,I2,-1);
6605 VARANDCY(I2,-1,10000,I4,1);
6606 VARANDCY(I2,-1,0,I4,0);
6607 VARANDCY(I2,0,0,I4,0);
6608
6609 VARAND(UI2,65535,UI2,65535,I4,65535);
6610 VARAND(UI2,65535,UI2,0,I4,0);
6611 VARAND(UI2,0,UI2,0,I4,0);
6612 VARAND(UI2,65535,I4,-1,I4,65535);
6613 VARAND(UI2,65535,I4,0,I4,0);
6614 VARAND(UI2,0,I4,0,I4,0);
6615 VARAND(UI2,65535,UI4,0xffffffff,I4,65535);
6616 VARAND(UI2,65535,UI4,0,I4,0);
6617 VARAND(UI2,0,UI4,0,I4,0);
6618 VARAND(UI2,65535,R4,-1,I4,65535);
6619 VARAND(UI2,65535,R4,0,I4,0);
6620 VARAND(UI2,0,R4,0,I4,0);
6621 VARAND(UI2,65535,R8,-1,I4,65535);
6622 VARAND(UI2,65535,R8,0,I4,0);
6623 VARAND(UI2,0,R8,0,I4,0);
6624 VARAND(UI2,65535,DATE,-1,I4,65535);
6625 VARAND(UI2,65535,DATE,0,I4,0);
6626 VARAND(UI2,0,DATE,0,I4,0);
6627 if (has_i8)
6628 {
6629 VARAND(UI2,65535,I8,-1,I8,65535);
6630 VARAND(UI2,65535,I8,0,I8,0);
6631 VARAND(UI2,0,I8,0,I8,0);
6632 VARAND(UI2,65535,UI8,0,I4,0);
6633 VARAND(UI2,0,UI8,0,I4,0);
6634 }
6635 VARAND(UI2,65535,INT,-1,I4,65535);
6636 VARAND(UI2,65535,INT,0,I4,0);
6637 VARAND(UI2,0,INT,0,I4,0);
6638 VARAND(UI2,65535,UINT,0xffffffff,I4,65535);
6639 VARAND(UI2,65535,UINT,0,I4,0);
6640 VARAND(UI2,0,UINT,0,I4,0);
6641 VARAND(UI2,0,BSTR,false_str,I4,0);
6642 VARAND(UI2,65535,BSTR,false_str,I4,0);
6643 VARAND(UI2,0,BSTR,true_str,I4,0);
6644 VARAND(UI2,65535,BSTR,true_str,I4,65535);
6645 VARANDCY(UI2,65535,10000,I4,1);
6646 VARANDCY(UI2,65535,0,I4,0);
6647 VARANDCY(UI2,0,0,I4,0);
6648
6649 VARAND(I4,-1,I4,-1,I4,-1);
6650 VARAND(I4,-1,I4,0,I4,0);
6651 VARAND(I4,0,I4,0,I4,0);
6652 VARAND(I4,-1,UI4,0xffffffff,I4,-1);
6653 VARAND(I4,-1,UI4,0,I4,0);
6654 VARAND(I4,0,UI4,0,I4,0);
6655 VARAND(I4,-1,R4,-1,I4,-1);
6656 VARAND(I4,-1,R4,0,I4,0);
6657 VARAND(I4,0,R4,0,I4,0);
6658 VARAND(I4,-1,R8,-1,I4,-1);
6659 VARAND(I4,-1,R8,0,I4,0);
6660 VARAND(I4,0,R8,0,I4,0);
6661 VARAND(I4,-1,DATE,-1,I4,-1);
6662 VARAND(I4,-1,DATE,0,I4,0);
6663 VARAND(I4,0,DATE,0,I4,0);
6664 if (has_i8)
6665 {
6666 VARAND(I4,-1,I8,-1,I8,-1);
6667 VARAND(I4,-1,I8,0,I8,0);
6668 VARAND(I4,0,I8,0,I8,0);
6669 VARAND(I4,-1,UI8,0,I4,0);
6670 VARAND(I4,0,UI8,0,I4,0);
6671 }
6672 VARAND(I4,-1,INT,-1,I4,-1);
6673 VARAND(I4,-1,INT,0,I4,0);
6674 VARAND(I4,0,INT,0,I4,0);
6675 VARAND(I4,-1,UINT,0xffffffff,I4,-1);
6676 VARAND(I4,-1,UINT,0,I4,0);
6677 VARAND(I4,0,UINT,0,I4,0);
6678 VARAND(