ReactOS 0.4.15-dev-5669-g09dde2c
vartype.c File Reference
#include "wine/test.h"
#include "oleauto.h"
#include <math.h>
#include <stdio.h>
#include "test_tlb.h"
#include "initguid.h"
Include dependency graph for vartype.c:

Go to the source code of this file.

Classes

struct  tagINTERNAL_BSTR
 
struct  DummyDispatch
 

Macros

#define CONST_VTABLE
 
#define COBJMACROS
 
#define HAS_UINT64_TO_FLOAT
 
#define IS_MODERN_VTYPE(vt)
 
#define CONVVARS(typ)   HRESULT hres; CONV_TYPE out; typ in
 
#define _EXPECT_NO_OUT(res)   ok(hres == res, "expected " #res ", got hres=0x%08x\n", hres)
 
#define EXPECT_OVERFLOW   _EXPECT_NO_OUT(DISP_E_OVERFLOW)
 
#define EXPECT_MISMATCH   _EXPECT_NO_OUT(DISP_E_TYPEMISMATCH)
 
#define EXPECT_BADVAR   _EXPECT_NO_OUT(DISP_E_BADVARTYPE)
 
#define EXPECT_INVALID   _EXPECT_NO_OUT(E_INVALIDARG)
 
#define EXPECT_LT   _EXPECT_NO_OUT(VARCMP_LT)
 
#define EXPECT_GT   _EXPECT_NO_OUT(VARCMP_GT)
 
#define EXPECT_EQ   _EXPECT_NO_OUT(VARCMP_EQ)
 
#define _EXPECTRES(res, x, fs)    ok(hres == S_OK && out == (CONV_TYPE)(x), "expected " #x ", got " fs "; hres=0x%08x\n", out, hres)
 
#define EXPECT(x)   EXPECTRES(S_OK, (x))
 
#define EXPECT_DBL(x)    ok(hres == S_OK && fabs(out-(x))<=1e-14*(x), "expected %16.16g, got %16.16g; hres=0x%08x\n", (x), out, hres)
 
#define CONVERT(func, val)   in = val; hres = func(in, &out)
 
#define CONVERTRANGE(func, start, end)   for (i = start; i < end; i+=1) { CONVERT(func, i); EXPECT(i); };
 
#define OVERFLOWRANGE(func, start, end)   for (i = start; i < end; i+=1) { CONVERT(func, i); EXPECT_OVERFLOW; };
 
#define CY_MULTIPLIER   10000
 
#define DATE_MIN   -657434
 
#define DATE_MAX   2958465
 
#define CONVERT_I8(func, hi, lo)   in = hi; in = (in << 32) | lo; hres = func(in, &out)
 
#define CONVERT_CY(func, val)   in.int64 = (LONGLONG)(val * CY_MULTIPLIER); hres = func(in, &out)
 
#define CONVERT_CY64(func, hi, lo)   S(in).Hi = hi; S(in).Lo = lo; in.int64 *= CY_MULTIPLIER; hres = func(in, &out)
 
#define SETDEC(dec, scl, sgn, hi, lo)
 
#define SETDEC64(dec, scl, sgn, hi, mid, lo)
 
#define CONVERT_DEC(func, scl, sgn, hi, lo)   SETDEC(in,scl,sgn,hi,lo); hres = func(&in, &out)
 
#define CONVERT_DEC64(func, scl, sgn, hi, mid, lo)   SETDEC64(in,scl,sgn,hi,mid,lo); hres = func(&in, &out)
 
#define CONVERT_BADDEC(func)
 
#define CONVERT_STR(func, str, flags)
 
#define COPYTEST(val, vt, srcval, dstval, srcref, dstref, fs)
 
#define CHANGETYPEEX(typ)   hres = VariantChangeTypeEx(&vDst, &vSrc, 0, 0, typ)
 
#define TYPETEST(typ, res, fs)
 
#define TYPETESTI8(typ, res)
 
#define BADVAR(typ)   CHANGETYPEEX(typ); EXPECT_BADVAR
 
#define MISMATCH(typ)   CHANGETYPEEX(typ); EXPECT_MISMATCH
 
#define INITIAL_TYPETEST(vt, val, fs)
 
#define NEGATIVE_TYPETEST(vt, val, fs, vtneg, valneg)
 
#define INITIAL_TYPETESTI8(vt, val)
 
#define COMMON_TYPETEST
 
#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 CONV_TYPE   signed char
 
#define EXPECTRES(res, x)   _EXPECTRES(res, x, "%d")
 
#define CONV_TYPE   BYTE
 
#define CONV_TYPE   SHORT
 
#define CONV_TYPE   USHORT
 
#define CONV_TYPE   LONG
 
#define CONV_TYPE   ULONG
 
#define EXPECTRES(res, x)   _EXPECTRES(res, x, "%u")
 
#define CONV_TYPE   LONG64
 
#define EXPECTI8(x)
 
#define EXPECTI864(x, y)
 
#define CONV_TYPE   ULONG64
 
#define CONV_TYPE   float
 
#define EXPECTRES(res, x)   _EXPECTRES(res, x, "%15.15f")
 
#define CONV_TYPE   double
 
#define MATHRND(l, r)   left = l; right = r; hres = VarR8Round(left, right, &out)
 
#define CONV_TYPE   DATE
 
#define DFS(str)
 
#define MKRELDATE(day, mth)
 
#define CONV_TYPE   CY
 
#define EXPECTCY(x)
 
#define EXPECTCY64(x, y)
 
#define MATHVARS1   HRESULT hres; double left = 0.0; CY cyLeft, out
 
#define MATHVARS2   MATHVARS1; double right = 0.0; CY cyRight
 
#define MATH1(func, l)   left = (double)l; VarCyFromR8(left, &cyLeft); hres = func(cyLeft, &out)
 
#define MATH2(func, l, r)
 
#define MATHMULI4(l, r)
 
#define MATHMULI8(l, r)
 
#define MATHCMP(l, r)
 
#define MATHCMPR8(l, r)
 
#define MATHRND(l, r)
 
#define MATHFIX(l)
 
#define MATHINT(l)
 
#define CONV_TYPE   DECIMAL
 
#define EXPECTDEC(scl, sgn, hi, lo)
 
#define EXPECTDEC64(scl, sgn, hi, mid, lo)
 
#define EXPECTDECZERO()
 
#define EXPECTDECI   if (i < 0) EXPECTDEC(0, 0x80, 0, -i); else EXPECTDEC(0, 0, 0, i)
 
#define MATHVARS1   HRESULT hres; DECIMAL l, out
 
#define MATHVARS2   MATHVARS1; DECIMAL r
 
#define MATH1(func)   hres = func(&l, &out)
 
#define MATH2(func)   hres = func(&l, &r, &out)
 
#define MATH3(func)   hres = func(&l, r)
 
#define CLEAR(x)   memset(&(x), 0xBB, sizeof(x))
 
#define CONV_TYPE   VARIANT_BOOL
 
#define EXPECTRES(res, x)   _EXPECTRES(res, x, "%d")
 
#define CONVERTRANGE(func, start, end)
 
#define BOOL_STR(flags, str)
 
#define BSTR_DATE(dt, str)   _BSTR_DATE(dt,str,__LINE__)
 
#define BSTR_CY(a, b, str, lcid)   _BSTR_CY(a, b, str, lcid, __LINE__)
 
#define BSTR_DEC(scale, sign, hi, lo, str, lcid)   _BSTR_DEC(scale, sign, hi, 0, lo, str, lcid, __LINE__)
 
#define BSTR_DEC64(scale, sign, hi, mid, lo, str, lcid)   _BSTR_DEC(scale, sign, hi, mid, lo, str, lcid, __LINE__)
 
#define _VARBSTRCMP(left, right, lcid, flags, result)
 
#define VARBSTRCMP(left, right, flags, result)    _VARBSTRCMP(left,right,lcid,flags,result)
 
#define NUM_CUST_ITEMS   16
 

Typedefs

typedef struct tagINTERNAL_BSTR INTERNAL_BSTR
 
typedef struct tagINTERNAL_BSTRLPINTERNAL_BSTR
 

Functions

 DEFINE_GUID (UUID_test_struct, 0x4029f190, 0xca4a, 0x4611, 0xae, 0xb9, 0x67, 0x39, 0x83, 0xcb, 0x96, 0xdd)
 
 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 (LONG ref, VARTYPE vt, DummyDispatch *dispatch)
 
static void test_VarI1FromI2 (void)
 
static void test_VarI1FromI4 (void)
 
static void test_VarI1FromI8 (void)
 
static void test_VarI1FromUI1 (void)
 
static void test_VarI1FromUI2 (void)
 
static void test_VarI1FromUI4 (void)
 
static void test_VarI1FromUI8 (void)
 
static void test_VarI1FromBool (void)
 
static void test_VarI1FromR4 (void)
 
static void test_VarI1FromR8 (void)
 
static void test_VarI1FromDate (void)
 
static void test_VarI1FromCy (void)
 
static void test_VarI1FromDec (void)
 
static void test_VarI1FromStr (void)
 
static void test_VarI1Copy (void)
 
static void test_VarI1ChangeTypeEx (void)
 
static void test_VarUI1FromI1 (void)
 
static void test_VarUI1FromI2 (void)
 
static void test_VarUI1FromI4 (void)
 
static void test_VarUI1FromI8 (void)
 
static void test_VarUI1FromUI2 (void)
 
static void test_VarUI1FromUI4 (void)
 
static void test_VarUI1FromUI8 (void)
 
static void test_VarUI1FromBool (void)
 
static void test_VarUI1FromR4 (void)
 
static void test_VarUI1FromR8 (void)
 
static void test_VarUI1FromDate (void)
 
static void test_VarUI1FromCy (void)
 
static void test_VarUI1FromDec (void)
 
static void test_VarUI1FromStr (void)
 
static void test_VarUI1FromDisp (void)
 
static void test_VarUI1Copy (void)
 
static void test_VarUI1ChangeTypeEx (void)
 
static void test_VarI2FromI1 (void)
 
static void test_VarI2FromI4 (void)
 
static void test_VarI2FromI8 (void)
 
static void test_VarI2FromUI1 (void)
 
static void test_VarI2FromUI2 (void)
 
static void test_VarI2FromUI4 (void)
 
static void test_VarI2FromUI8 (void)
 
static void test_VarI2FromBool (void)
 
static void test_VarI2FromR4 (void)
 
static void test_VarI2FromR8 (void)
 
static void test_VarI2FromDate (void)
 
static void test_VarI2FromCy (void)
 
static void test_VarI2FromDec (void)
 
static void test_VarI2FromStr (void)
 
static void test_VarI2Copy (void)
 
static void test_VarI2ChangeTypeEx (void)
 
static void test_VarUI2FromI1 (void)
 
static void test_VarUI2FromI2 (void)
 
static void test_VarUI2FromI4 (void)
 
static void test_VarUI2FromI8 (void)
 
static void test_VarUI2FromUI1 (void)
 
static void test_VarUI2FromUI4 (void)
 
static void test_VarUI2FromUI8 (void)
 
static void test_VarUI2FromBool (void)
 
static void test_VarUI2FromR4 (void)
 
static void test_VarUI2FromR8 (void)
 
static void test_VarUI2FromDate (void)
 
static void test_VarUI2FromCy (void)
 
static void test_VarUI2FromDec (void)
 
static void test_VarUI2FromStr (void)
 
static void test_VarUI2Copy (void)
 
static void test_VarUI2ChangeTypeEx (void)
 
static void test_VarI4FromI1 (void)
 
static void test_VarI4FromI2 (void)
 
static void test_VarI4FromI8 (void)
 
static void test_VarI4FromUI1 (void)
 
static void test_VarI4FromUI2 (void)
 
static void test_VarI4FromUI4 (void)
 
static void test_VarI4FromUI8 (void)
 
static void test_VarI4FromBool (void)
 
static void test_VarI4FromR4 (void)
 
static void test_VarI4FromR8 (void)
 
static void test_VarI4FromDate (void)
 
static void test_VarI4FromCy (void)
 
static void test_VarI4FromDec (void)
 
static void test_VarI4FromStr (void)
 
static void test_VarI4Copy (void)
 
static void test_VarI4ChangeTypeEx (void)
 
static void test_VarUI4FromI1 (void)
 
static void test_VarUI4FromI2 (void)
 
static void test_VarUI4FromUI2 (void)
 
static void test_VarUI4FromI8 (void)
 
static void test_VarUI4FromUI1 (void)
 
static void test_VarUI4FromI4 (void)
 
static void test_VarUI4FromUI8 (void)
 
static void test_VarUI4FromBool (void)
 
static void test_VarUI4FromR4 (void)
 
static void test_VarUI4FromR8 (void)
 
static void test_VarUI4FromDate (void)
 
static void test_VarUI4FromCy (void)
 
static void test_VarUI4FromDec (void)
 
static void test_VarUI4FromStr (void)
 
static void test_VarUI4Copy (void)
 
static void test_VarUI4ChangeTypeEx (void)
 
static void test_VarI8FromI1 (void)
 
static void test_VarI8FromUI1 (void)
 
static void test_VarI8FromI2 (void)
 
static void test_VarI8FromUI2 (void)
 
static void test_VarI8FromUI4 (void)
 
static void test_VarI8FromR4 (void)
 
static void test_VarI8FromR8 (void)
 
static void test_VarI8FromDate (void)
 
static void test_VarI8FromBool (void)
 
static void test_VarI8FromUI8 (void)
 
static void test_VarI8FromCy (void)
 
static void test_VarI8FromDec (void)
 
static void test_VarI8FromStr (void)
 
static void test_VarI8Copy (void)
 
static void test_VarI8ChangeTypeEx (void)
 
static void test_VarUI8FromI1 (void)
 
static void test_VarUI8FromUI1 (void)
 
static void test_VarUI8FromI2 (void)
 
static void test_VarUI8FromUI2 (void)
 
static void test_VarUI8FromUI4 (void)
 
static void test_VarUI8FromR4 (void)
 
static void test_VarUI8FromR8 (void)
 
static void test_VarUI8FromDate (void)
 
static void test_VarUI8FromBool (void)
 
static void test_VarUI8FromI8 (void)
 
static void test_VarUI8FromCy (void)
 
static void test_VarUI8FromDec (void)
 
static void test_VarUI8FromStr (void)
 
static void test_VarUI8Copy (void)
 
static void test_VarUI8ChangeTypeEx (void)
 
static void test_VarR4FromI1 (void)
 
static void test_VarR4FromUI1 (void)
 
static void test_VarR4FromI2 (void)
 
static void test_VarR4FromUI2 (void)
 
static void test_VarR4FromI4 (void)
 
static void test_VarR4FromUI4 (void)
 
static void test_VarR4FromR8 (void)
 
static void test_VarR4FromBool (void)
 
static void test_VarR4FromCy (void)
 
static void test_VarR4FromI8 (void)
 
static void test_VarR4FromUI8 (void)
 
static void test_VarR4FromDec (void)
 
static void test_VarR4FromDate (void)
 
static void test_VarR4FromStr (void)
 
static void test_VarR4Copy (void)
 
static void test_VarR4ChangeTypeEx (void)
 
static void test_VarR8FromI1 (void)
 
static void test_VarR8FromUI1 (void)
 
static void test_VarR8FromI2 (void)
 
static void test_VarR8FromUI2 (void)
 
static void test_VarR8FromI4 (void)
 
static void test_VarR8FromUI4 (void)
 
static void test_VarR8FromR4 (void)
 
static void test_VarR8FromBool (void)
 
static void test_VarR8FromCy (void)
 
static void test_VarR8FromI8 (void)
 
static void test_VarR8FromUI8 (void)
 
static void test_VarR8FromDec (void)
 
static void test_VarR8FromDate (void)
 
static void test_VarR8FromStr (void)
 
static void test_VarR8Copy (void)
 
static void test_VarR8ChangeTypeEx (void)
 
static void test_VarR8Round (void)
 
static void test_VarDateFromI1 (void)
 
static void test_VarDateFromUI1 (void)
 
static void test_VarDateFromI2 (void)
 
static void test_VarDateFromUI2 (void)
 
static void test_VarDateFromI4 (void)
 
static void test_VarDateFromUI4 (void)
 
static void test_VarDateFromR4 (void)
 
static void test_VarDateFromR8 (void)
 
static void test_VarDateFromBool (void)
 
static void test_VarDateFromCy (void)
 
static void test_VarDateFromI8 (void)
 
static void test_VarDateFromUI8 (void)
 
static void test_VarDateFromDec (void)
 
static void test_VarDateFromStr (void)
 
static void test_VarDateCopy (void)
 
static const charwtoascii (LPWSTR lpszIn)
 
static void test_VarDateChangeTypeEx (void)
 
static void test_VarCyFromI1 (void)
 
static void test_VarCyFromUI1 (void)
 
static void test_VarCyFromI2 (void)
 
static void test_VarCyFromUI2 (void)
 
static void test_VarCyFromI4 (void)
 
static void test_VarCyFromUI4 (void)
 
static void test_VarCyFromR4 (void)
 
static void test_VarCyFromR8 (void)
 
static void test_VarCyFromBool (void)
 
static void test_VarCyFromI8 (void)
 
static void test_VarCyFromUI8 (void)
 
static void test_VarCyFromDec (void)
 
static void test_VarCyFromDate (void)
 
static void test_VarCyAdd (void)
 
static void test_VarCyMul (void)
 
static void test_VarCySub (void)
 
static void test_VarCyAbs (void)
 
static void test_VarCyNeg (void)
 
static void test_VarCyMulI4 (void)
 
static void test_VarCyMulI8 (void)
 
static void test_VarCyCmp (void)
 
static void test_VarCyCmpR8 (void)
 
static void test_VarCyRound (void)
 
static void test_VarCyFix (void)
 
static void test_VarCyInt (void)
 
static void test_VarDecFromI1 (void)
 
static void test_VarDecFromI2 (void)
 
static void test_VarDecFromI4 (void)
 
static void test_VarDecFromI8 (void)
 
static void test_VarDecFromUI1 (void)
 
static void test_VarDecFromUI2 (void)
 
static void test_VarDecFromUI4 (void)
 
static void test_VarDecFromUI8 (void)
 
static void test_VarDecFromBool (void)
 
static void test_VarDecFromR4 (void)
 
static void test_VarDecFromR8 (void)
 
static void test_VarDecFromDate (void)
 
static void test_VarDecFromStr (void)
 
static void test_VarDecFromCy (void)
 
static void test_VarDecAbs (void)
 
static void test_VarDecNeg (void)
 
static void test_VarDecAdd (void)
 
static void test_VarDecSub (void)
 
static void test_VarDecMul (void)
 
static void test_VarDecDiv (void)
 
static void test_VarDecCmp (void)
 
static void test_VarDecCmpR8 (void)
 
static void test_VarDecRound (void)
 
static void test_VarBoolFromI1 (void)
 
static void test_VarBoolFromUI1 (void)
 
static void test_VarBoolFromI2 (void)
 
static void test_VarBoolFromUI2 (void)
 
static void test_VarBoolFromI4 (void)
 
static void test_VarBoolFromUI4 (void)
 
static void test_VarBoolFromR4 (void)
 
static void test_VarBoolFromR8 (void)
 
static void test_VarBoolFromCy (void)
 
static void test_VarBoolFromI8 (void)
 
static void test_VarBoolFromUI8 (void)
 
static void test_VarBoolFromDec (void)
 
static void test_VarBoolFromDate (void)
 
static void test_VarBoolFromStr (void)
 
static void test_VarBoolCopy (void)
 
static void test_VarBoolChangeTypeEx (void)
 
static void test_VarBstrFromI4 (void)
 
static void test_VarBstrFromR4 (void)
 
static void _BSTR_DATE (DATE dt, const char *str, int line)
 
static void test_VarBstrFromDate (void)
 
static void _BSTR_CY (LONG a, LONG b, const char *str, LCID lcid, int line)
 
static void test_VarBstrFromCy (void)
 
static void _BSTR_DEC (BYTE scale, BYTE sign, ULONG hi, ULONG mid, ULONGLONG lo, const char *str, LCID lcid, int line)
 
static void test_VarBstrFromDec (void)
 
static void test_VarBstrCmp (void)
 
static LPINTERNAL_BSTR Get (const BSTR lpszString)
 
static BSTR GetBSTR (const LPINTERNAL_BSTR bstr)
 
static void test_SysStringLen (void)
 
static void test_SysStringByteLen (void)
 
static void test_SysAllocString (void)
 
static void test_SysAllocStringLen (void)
 
static void test_SysAllocStringByteLen (void)
 
static void test_SysReAllocString (void)
 
static void test_SysReAllocStringLen (void)
 
static void test_BstrCopy (void)
 
static void test_VarBstrCat (void)
 
static void test_IUnknownClear (void)
 
static void test_IUnknownCopy (void)
 
static void test_IUnknownChangeTypeEx (void)
 
static void test_IDispatchClear (void)
 
static void test_IDispatchCopy (void)
 
static void test_IDispatchChangeTypeEx (void)
 
static void test_ErrorChangeTypeEx (void)
 
static void test_EmptyChangeTypeEx (void)
 
static void test_NullChangeTypeEx (void)
 
static void test_UintChangeTypeEx (void)
 
static void test_ClearCustData (void)
 
static void test_NullByRef (void)
 
static void test_ChangeType_keep_dst (void)
 
static void test_bstr_cache (void)
 
static void write_typelib (int res_no, const char *filename)
 
static const charcreate_test_typelib (int res_no)
 
static void test_recinfo (void)
 
 START_TEST (vartype)
 

Variables

static HMODULE hOleaut32
 
static BOOL has_i8
 
static BOOL has_locales
 
static const IDispatchVtbl DummyDispatch_VTable
 
static const char *const BadDateStrings []
 

Macro Definition Documentation

◆ _EXPECT_NO_OUT

#define _EXPECT_NO_OUT (   res)    ok(hres == res, "expected " #res ", got hres=0x%08x\n", hres)

Definition at line 67 of file vartype.c.

◆ _EXPECTRES

#define _EXPECTRES (   res,
  x,
  fs 
)     ok(hres == S_OK && out == (CONV_TYPE)(x), "expected " #x ", got " fs "; hres=0x%08x\n", out, hres)

Definition at line 76 of file vartype.c.

◆ _VARBSTRCMP

#define _VARBSTRCMP (   left,
  right,
  lcid,
  flags,
  result 
)
Value:
ok(hres == result, "VarBstrCmp: expected " #result ", got hres=0x%x\n", hres)
HRESULT WINAPI VarBstrCmp(BSTR pbstrLeft, BSTR pbstrRight, LCID lcid, DWORD dwFlags)
Definition: vartype.c:7158
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
HRESULT hres
Definition: protocol.c:465

Definition at line 4808 of file vartype.c.

◆ BADVAR

#define BADVAR (   typ)    CHANGETYPEEX(typ); EXPECT_BADVAR

Definition at line 144 of file vartype.c.

◆ BOOL_STR

#define BOOL_STR (   flags,
  str 
)
Value:
hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, flags, VT_BSTR); \
ok(hres == S_OK && V_VT(&vDst) == VT_BSTR && \
V_BSTR(&vDst) && !memcmp(V_BSTR(&vDst), str, sizeof(str)), \
"hres=0x%X, type=%d (should be VT_BSTR), *bstr='%c'\n", \
hres, V_VT(&vDst), V_BSTR(&vDst) ? *V_BSTR(&vDst) : '?'); \
VariantClear(&vDst)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
@ VT_BSTR
Definition: compat.h:2303
#define S_OK
Definition: intsafe.h:52
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const WCHAR * str
HRESULT WINAPI VariantChangeTypeEx(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
Definition: variant.c:988

Definition at line 4494 of file vartype.c.

◆ BSTR_CY

#define BSTR_CY (   a,
  b,
  str,
  lcid 
)    _BSTR_CY(a, b, str, lcid, __LINE__)

◆ BSTR_DATE

#define BSTR_DATE (   dt,
  str 
)    _BSTR_DATE(dt,str,__LINE__)

◆ BSTR_DEC

#define BSTR_DEC (   scale,
  sign,
  hi,
  lo,
  str,
  lcid 
)    _BSTR_DEC(scale, sign, hi, 0, lo, str, lcid, __LINE__)

◆ BSTR_DEC64

#define BSTR_DEC64 (   scale,
  sign,
  hi,
  mid,
  lo,
  str,
  lcid 
)    _BSTR_DEC(scale, sign, hi, mid, lo, str, lcid, __LINE__)

◆ CHANGETYPEEX

#define CHANGETYPEEX (   typ)    hres = VariantChangeTypeEx(&vDst, &vSrc, 0, 0, typ)

Definition at line 134 of file vartype.c.

◆ 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 268 of file vartype.c.

◆ CHECK_EXPECT

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

Definition at line 262 of file vartype.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 256 of file vartype.c.

◆ CLEAR

#define CLEAR (   x)    memset(&(x), 0xBB, sizeof(x))

Definition at line 4232 of file vartype.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file vartype.c.

◆ COMMON_TYPETEST

#define COMMON_TYPETEST

Definition at line 195 of file vartype.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 21 of file vartype.c.

◆ CONV_TYPE [1/14]

#define CONV_TYPE   signed char

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [2/14]

#define CONV_TYPE   BYTE

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [3/14]

#define CONV_TYPE   SHORT

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [4/14]

#define CONV_TYPE   USHORT

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [5/14]

#define CONV_TYPE   LONG

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [6/14]

#define CONV_TYPE   ULONG

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [7/14]

#define CONV_TYPE   LONG64

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [8/14]

#define CONV_TYPE   ULONG64

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [9/14]

#define CONV_TYPE   float

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [10/14]

#define CONV_TYPE   double

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [11/14]

#define CONV_TYPE   DATE

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [12/14]

#define CONV_TYPE   CY

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [13/14]

#define CONV_TYPE   DECIMAL

Definition at line 4268 of file vartype.c.

◆ CONV_TYPE [14/14]

#define CONV_TYPE   VARIANT_BOOL

Definition at line 4268 of file vartype.c.

◆ CONVERT

#define CONVERT (   func,
  val 
)    in = val; hres = func(in, &out)

Definition at line 82 of file vartype.c.

◆ CONVERT_BADDEC

#define CONVERT_BADDEC (   func)
Value:
CONVERT_DEC(func,0,0x1,0,0); EXPECT_INVALID; \
CONVERT_DEC(func,0,0x40,0,0); EXPECT_INVALID; \
CONVERT_DEC(func,0,0x7f,0,0); EXPECT_INVALID;
#define CONVERT_DEC(func, scl, sgn, hi, lo)
Definition: vartype.c:103
#define EXPECT_INVALID
Definition: vartype.c:71

Definition at line 107 of file vartype.c.

◆ CONVERT_CY

#define CONVERT_CY (   func,
  val 
)    in.int64 = (LONGLONG)(val * CY_MULTIPLIER); hres = func(in, &out)

Definition at line 93 of file vartype.c.

◆ CONVERT_CY64

#define CONVERT_CY64 (   func,
  hi,
  lo 
)    S(in).Hi = hi; S(in).Lo = lo; in.int64 *= CY_MULTIPLIER; hres = func(in, &out)

Definition at line 95 of file vartype.c.

◆ CONVERT_DEC

#define CONVERT_DEC (   func,
  scl,
  sgn,
  hi,
  lo 
)    SETDEC(in,scl,sgn,hi,lo); hres = func(&in, &out)

Definition at line 103 of file vartype.c.

◆ CONVERT_DEC64

#define CONVERT_DEC64 (   func,
  scl,
  sgn,
  hi,
  mid,
  lo 
)    SETDEC64(in,scl,sgn,hi,mid,lo); hres = func(&in, &out)

Definition at line 105 of file vartype.c.

◆ CONVERT_I8

#define CONVERT_I8 (   func,
  hi,
  lo 
)    in = hi; in = (in << 32) | lo; hres = func(in, &out)

Definition at line 91 of file vartype.c.

◆ CONVERT_STR

#define CONVERT_STR (   func,
  str,
  flags 
)
Value:
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define MultiByteToWideChar
Definition: compat.h:110
static unsigned char buff[32768]
Definition: fatten.c:17
GLuint in
Definition: glext.h:9616
static FILE * out
Definition: regtests2xml.c:44

Definition at line 113 of file vartype.c.

◆ CONVERTRANGE [1/2]

#define CONVERTRANGE (   func,
  start,
  end 
)    for (i = start; i < end; i+=1) { CONVERT(func, i); EXPECT(i); };

Definition at line 4272 of file vartype.c.

◆ CONVERTRANGE [2/2]

#define CONVERTRANGE (   func,
  start,
  end 
)
Value:
for (i = start; i < end; i++) { \
CONVERT(func, i); if (i) { EXPECT(VARIANT_TRUE); } else { EXPECT(VARIANT_FALSE); } }
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
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
#define EXPECT(x)
Definition: vartype.c:78

Definition at line 4272 of file vartype.c.

◆ CONVVARS

#define CONVVARS (   typ)    HRESULT hres; CONV_TYPE out; typ in

Definition at line 65 of file vartype.c.

◆ COPYTEST

#define COPYTEST (   val,
  vt,
  srcval,
  dstval,
  srcref,
  dstref,
  fs 
)
Value:
do { \
HRESULT hres; VARIANTARG vSrc, vDst; CONV_TYPE in = val; \
VariantInit(&vSrc); VariantInit(&vDst); \
V_VT(&vSrc) = vt; srcval = in; \
hres = VariantCopy(&vDst, &vSrc); \
ok(hres == S_OK && V_VT(&vDst) == vt && dstval == in, \
"copy hres 0x%X, type %d, value (" fs ") " fs "\n", hres, V_VT(&vDst), val, dstval); \
V_VT(&vSrc) = vt|VT_BYREF; srcref = &in; \
hres = VariantCopy(&vDst, &vSrc); \
ok(hres == S_OK && V_VT(&vDst) == (vt|VT_BYREF) && dstref == &in, \
"ref hres 0x%X, type %d, ref (%p) %p\n", hres, V_VT(&vDst), &in, dstref); \
hres = VariantCopyInd(&vDst, &vSrc); \
ok(hres == S_OK && V_VT(&vDst) == vt && dstval == in, \
"ind hres 0x%X, type %d, value (" fs ") " fs "\n", hres, V_VT(&vDst), val, dstval); \
} while(0)
@ VT_BYREF
Definition: compat.h:2342
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:86
GLuint GLfloat * val
Definition: glext.h:7180
#define CONV_TYPE
Definition: vartype.c:4268
Definition: ffs.h:70
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:748

Definition at line 118 of file vartype.c.

◆ CY_MULTIPLIER

#define CY_MULTIPLIER   10000

Definition at line 86 of file vartype.c.

◆ DATE_MAX

#define DATE_MAX   2958465

Definition at line 89 of file vartype.c.

◆ DATE_MIN

#define DATE_MIN   -657434

Definition at line 88 of file vartype.c.

◆ DEFINE_EXPECT

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

Definition at line 250 of file vartype.c.

◆ DFS

#define DFS (   str)
Value:
buff[0] = '\0'; out = 0.0; \
HRESULT WINAPI VarDateFromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, DATE *pdateOut)
Definition: vartype.c:7595
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19

Definition at line 2945 of file vartype.c.

◆ EXPECT

#define EXPECT (   x)    EXPECTRES(S_OK, (x))

Definition at line 78 of file vartype.c.

◆ EXPECT_BADVAR

#define EXPECT_BADVAR   _EXPECT_NO_OUT(DISP_E_BADVARTYPE)

Definition at line 70 of file vartype.c.

◆ EXPECT_DBL

#define EXPECT_DBL (   x)     ok(hres == S_OK && fabs(out-(x))<=1e-14*(x), "expected %16.16g, got %16.16g; hres=0x%08x\n", (x), out, hres)

Definition at line 79 of file vartype.c.

◆ EXPECT_EQ

#define EXPECT_EQ   _EXPECT_NO_OUT(VARCMP_EQ)

Definition at line 74 of file vartype.c.

◆ EXPECT_GT

#define EXPECT_GT   _EXPECT_NO_OUT(VARCMP_GT)

Definition at line 73 of file vartype.c.

◆ EXPECT_INVALID

#define EXPECT_INVALID   _EXPECT_NO_OUT(E_INVALIDARG)

Definition at line 71 of file vartype.c.

◆ EXPECT_LT

#define EXPECT_LT   _EXPECT_NO_OUT(VARCMP_LT)

Definition at line 72 of file vartype.c.

◆ EXPECT_MISMATCH

#define EXPECT_MISMATCH   _EXPECT_NO_OUT(DISP_E_TYPEMISMATCH)

Definition at line 69 of file vartype.c.

◆ EXPECT_OVERFLOW

#define EXPECT_OVERFLOW   _EXPECT_NO_OUT(DISP_E_OVERFLOW)

Definition at line 68 of file vartype.c.

◆ EXPECTCY

#define EXPECTCY (   x)
Value:
ok((hres == S_OK && out.int64 == (LONGLONG)(x*CY_MULTIPLIER)), \
"expected " #x "*CY_MULTIPLIER, got (%8x %8x); hres=0x%08x\n", S(out).Hi, S(out).Lo, hres)
#define ok(value,...)
Definition: atltest.h:57
#define CY_MULTIPLIER
Definition: vartype.c:38
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define S(x)
Definition: test.h:217
Definition: movable.cpp:9
int64_t LONGLONG
Definition: typedefs.h:68

Definition at line 3201 of file vartype.c.

◆ EXPECTCY64

#define EXPECTCY64 (   x,
  y 
)
Value:
ok(hres == S_OK && S(out).Hi == (LONG)x && S(out).Lo == y, \
"expected " #x " " #y " (%u,%u), got (%u,%u); hres=0x%08x\n", \
(ULONG)(x), (ULONG)(y), S(out).Hi, S(out).Lo, hres)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
long LONG
Definition: pedump.c:60
uint32_t ULONG
Definition: typedefs.h:59

Definition at line 3205 of file vartype.c.

◆ EXPECTDEC

#define EXPECTDEC (   scl,
  sgn,
  hi,
  lo 
)
Value:
ok(hres == S_OK && \
S(U(out)).scale == (BYTE)(scl) && S(U(out)).sign == (BYTE)(sgn) && \
out.Hi32 == (ULONG)(hi) && U1(out).Lo64 == (ULONG64)(lo), \
"expected (%d,%d,%d,(%x %x)), got (%d,%d,%d,(%x %x)) hres 0x%08x\n", \
scl, sgn, hi, (LONG)((LONG64)(lo) >> 32), (LONG)((lo) & 0xffffffff), S(U(out)).scale, \
S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres)
#define U(x)
Definition: wordpad.c:45
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define sign(x)
Definition: mapdesc.cc:613
unsigned __int64 ULONG64
Definition: imports.h:198
#define U1(x)
Definition: test.h:199
#define S1(x)
Definition: test.h:218
int64_t LONG64
Definition: typedefs.h:68
long sgn(REAL x)
Definition: varray.cc:48
unsigned char BYTE
Definition: xxhash.c:193

Definition at line 3676 of file vartype.c.

◆ EXPECTDEC64

#define EXPECTDEC64 (   scl,
  sgn,
  hi,
  mid,
  lo 
)
Value:
ok(hres == S_OK && \
S(U(out)).scale == (BYTE)(scl) && S(U(out)).sign == (BYTE)(sgn) && \
out.Hi32 == (ULONG)(hi) && S1(U1(out)).Mid32 == (ULONG)(mid) && \
S1(U1(out)).Lo32 == (ULONG)(lo), \
"expected (%d,%d,%d,(%x %x)), got (%d,%d,%d,(%x %x)) hres 0x%08x\n", \
scl, sgn, hi, (LONG)(mid), (LONG)(lo), S(U(out)).scale, \
S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres)

Definition at line 3683 of file vartype.c.

◆ EXPECTDECI

#define EXPECTDECI   if (i < 0) EXPECTDEC(0, 0x80, 0, -i); else EXPECTDEC(0, 0, 0, i)

Definition at line 3697 of file vartype.c.

◆ EXPECTDECZERO

#define EXPECTDECZERO ( )
Value:
ok(hres == S_OK && S(U(out)).scale == 0 && \
(S(U(out)).sign == 0 || S(U(out)).sign == 0x80) && out.Hi32 == 0 && U1(out).Lo64 == 0, \
"expected zero, got (%d,%d,%d,(%x %x)) hres 0x%08x\n", \
S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres)

Definition at line 3692 of file vartype.c.

◆ EXPECTI8

#define EXPECTI8 (   x)
Value:
ok((hres == S_OK && out == (CONV_TYPE)(x)), \
"expected " #x "(%u,%u), got (%u,%u); hres=0x%08x\n", \
(ULONG)((LONG64)(x) >> 32), (ULONG)((x) & 0xffffffff), \
(ULONG)(out >> 32), (ULONG)(out & 0xffffffff), hres)

Definition at line 1865 of file vartype.c.

◆ EXPECTI864

#define EXPECTI864 (   x,
  y 
)
Value:
ok(hres == S_OK && (out >> 32) == (CONV_TYPE)(x) && (out & 0xffffffff) == (CONV_TYPE)(y), \
"expected " #x "(%u,%u), got (%u,%u); hres=0x%08x\n", \
(ULONG)(x), (ULONG)(y), \
(ULONG)(out >> 32), (ULONG)(out & 0xffffffff), hres)

Definition at line 1871 of file vartype.c.

◆ EXPECTRES [1/4]

#define EXPECTRES (   res,
  x 
)    _EXPECTRES(res, x, "%d")

Definition at line 4270 of file vartype.c.

◆ EXPECTRES [2/4]

#define EXPECTRES (   res,
  x 
)    _EXPECTRES(res, x, "%u")

Definition at line 4270 of file vartype.c.

◆ EXPECTRES [3/4]

#define EXPECTRES (   res,
  x 
)    _EXPECTRES(res, x, "%15.15f")

Definition at line 4270 of file vartype.c.

◆ EXPECTRES [4/4]

#define EXPECTRES (   res,
  x 
)    _EXPECTRES(res, x, "%d")

Definition at line 4270 of file vartype.c.

◆ HAS_UINT64_TO_FLOAT

#define HAS_UINT64_TO_FLOAT

Definition at line 39 of file vartype.c.

◆ INITIAL_TYPETEST

#define INITIAL_TYPETEST (   vt,
  val,
  fs 
)
Value:
VariantInit(&vSrc); \
VariantInit(&vDst); \
V_VT(&vSrc) = vt; \
(val(&vSrc)) = in; \
TYPETEST(VT_I1, V_I1(&vDst), fs); \
TYPETEST(VT_UI2, V_UI2(&vDst), fs); \
TYPETEST(VT_UI4, V_UI4(&vDst), fs); \
TYPETEST(VT_INT, V_INT(&vDst), fs); \
TYPETEST(VT_UINT, V_UINT(&vDst), fs); \
TYPETEST(VT_UI1, V_UI1(&vDst), fs); \
TYPETEST(VT_I2, V_I2(&vDst), fs); \
TYPETEST(VT_I4, V_I4(&vDst), fs); \
TYPETEST(VT_R4, V_R4(&vDst), fs); \
TYPETEST(VT_R8, V_R8(&vDst), fs); \
TYPETEST(VT_DATE, V_DATE(&vDst), fs); \
if (has_i8) \
{ \
TYPETEST(VT_I8, V_I8(&vDst), fs); \
TYPETEST(VT_UI8, V_UI8(&vDst), fs); \
}
@ VT_UI8
Definition: compat.h:2315
@ VT_INT
Definition: compat.h:2316
@ VT_R4
Definition: compat.h:2299
@ VT_UI2
Definition: compat.h:2312
@ VT_R8
Definition: compat.h:2300
@ VT_I8
Definition: compat.h:2314
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_DATE
Definition: compat.h:2302
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
@ VT_UINT
Definition: compat.h:2317
@ VT_UI1
Definition: compat.h:2311
static BOOL has_i8
Definition: vartype.c:56
#define V_UI1(A)
Definition: oleauto.h:266
#define V_I8(A)
Definition: oleauto.h:249
#define V_UI2(A)
Definition: oleauto.h:268
#define V_I1(A)
Definition: oleauto.h:243
#define V_I4(A)
Definition: oleauto.h:247
#define V_R4(A)
Definition: oleauto.h:260
#define V_UINT(A)
Definition: oleauto.h:264
#define V_UI4(A)
Definition: oleauto.h:270
#define V_R8(A)
Definition: oleauto.h:262
#define V_DATE(A)
Definition: oleauto.h:231
#define V_UI8(A)
Definition: oleauto.h:272
#define V_I2(A)
Definition: oleauto.h:245
#define V_INT(x)
Definition: webchild.h:78

Definition at line 147 of file vartype.c.

◆ INITIAL_TYPETESTI8

#define INITIAL_TYPETESTI8 (   vt,
  val 
)
Value:
VariantInit(&vSrc); \
VariantInit(&vDst); \
V_VT(&vSrc) = vt; \
(val(&vSrc)) = in; \
TYPETESTI8(VT_I1, V_I1(&vDst)); \
TYPETESTI8(VT_UI1, V_UI1(&vDst)); \
TYPETESTI8(VT_I2, V_I2(&vDst)); \
TYPETESTI8(VT_UI2, V_UI2(&vDst)); \
TYPETESTI8(VT_I4, V_I4(&vDst)); \
TYPETESTI8(VT_UI4, V_UI4(&vDst)); \
TYPETESTI8(VT_INT, V_INT(&vDst)); \
TYPETESTI8(VT_UINT, V_UINT(&vDst)); \
TYPETESTI8(VT_R4, V_R4(&vDst)); \
TYPETESTI8(VT_R8, V_R8(&vDst)); \
TYPETESTI8(VT_DATE, V_DATE(&vDst)); \
TYPETESTI8(VT_I8, V_I8(&vDst)); \
TYPETESTI8(VT_UI8, V_UI8(&vDst))

Definition at line 176 of file vartype.c.

◆ IS_MODERN_VTYPE

#define IS_MODERN_VTYPE (   vt)
Value:
@ VT_DECIMAL
Definition: compat.h:2309
@ VT_VARIANT
Definition: compat.h:2307

Definition at line 61 of file vartype.c.

◆ MATH1 [1/2]

#define MATH1 (   func)    hres = func(&l, &out)

Definition at line 3875 of file vartype.c.

◆ MATH1 [2/2]

#define MATH1 (   func,
  l 
)    left = (double)l; VarCyFromR8(left, &cyLeft); hres = func(cyLeft, &out)

Definition at line 3875 of file vartype.c.

◆ MATH2 [1/2]

#define MATH2 (   func)    hres = func(&l, &r, &out)

Definition at line 3877 of file vartype.c.

◆ MATH2 [2/2]

#define MATH2 (   func,
  l,
  r 
)
Value:
left = (double)l; right = (double)r; \
VarCyFromR8(left, &cyLeft); VarCyFromR8(right, &cyRight); \
hres = func(cyLeft, cyRight, &out)
r l[0]
Definition: byte_order.h:167
HRESULT WINAPI VarCyFromR8(double dblIn, CY *pCyOut)
Definition: vartype.c:3503
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80

Definition at line 3877 of file vartype.c.

◆ MATH3

#define MATH3 (   func)    hres = func(&l, r)

Definition at line 3879 of file vartype.c.

◆ MATHCMP

#define MATHCMP (   l,
  r 
)
Value:
left = l; right = r; VarCyFromR8(left, &cyLeft); VarCyFromR8(right, &cyRight); \
hres = VarCyCmp(cyLeft, cyRight)
HRESULT WINAPI VarCyCmp(CY cyLeft, CY cyRight)
Definition: vartype.c:4012

Definition at line 3541 of file vartype.c.

◆ MATHCMPR8

#define MATHCMPR8 (   l,
  r 
)
Value:
left = l; right = r; VarCyFromR8(left, &cyLeft); \
hres = VarCyCmpR8(cyLeft, right);
HRESULT WINAPI VarCyCmpR8(CY cyLeft, double dblRight)
Definition: vartype.c:4046

Definition at line 3563 of file vartype.c.

◆ MATHFIX

#define MATHFIX (   l)
Value:
left = l; VarCyFromR8(left, &cyLeft); \
hres = VarCyFix(cyLeft, &out)
HRESULT WINAPI VarCyFix(CY cyIn, CY *pCyOut)
Definition: vartype.c:3902

Definition at line 3619 of file vartype.c.

◆ MATHINT

#define MATHINT (   l)
Value:
left = l; VarCyFromR8(left, &cyLeft); \
hres = VarCyInt(cyLeft, &out)
HRESULT WINAPI VarCyInt(CY cyIn, CY *pCyOut)
Definition: vartype.c:3926

Definition at line 3644 of file vartype.c.

◆ MATHMULI4

#define MATHMULI4 (   l,
  r 
)
Value:
left = l; right = r; VarCyFromR8(left, &cyLeft); \
hres = VarCyMulI4(cyLeft, right, &out)
HRESULT WINAPI VarCyMulI4(CY cyLeft, LONG lRight, CY *pCyOut)
Definition: vartype.c:3831

Definition at line 3511 of file vartype.c.

◆ MATHMULI8

#define MATHMULI8 (   l,
  r 
)
Value:
left = l; right = r; VarCyFromR8(left, &cyLeft); \
hres = VarCyMulI8(cyLeft, right, &out)
HRESULT WINAPI VarCyMulI8(CY cyLeft, LONG64 llRight, CY *pCyOut)
Definition: vartype.c:4073

Definition at line 3526 of file vartype.c.

◆ MATHRND [1/2]

#define MATHRND (   l,
  r 
)    left = l; right = r; hres = VarR8Round(left, right, &out)

Definition at line 3587 of file vartype.c.

◆ MATHRND [2/2]

#define MATHRND (   l,
  r 
)
Value:
left = l; right = r; VarCyFromR8(left, &cyLeft); \
hres = VarCyRound(cyLeft, right, &out)
HRESULT WINAPI VarCyRound(CY cyIn, int cDecimals, CY *pCyOut)
Definition: vartype.c:3974

Definition at line 3587 of file vartype.c.

◆ MATHVARS1 [1/2]

#define MATHVARS1   HRESULT hres; double left = 0.0; CY cyLeft, out

Definition at line 3871 of file vartype.c.

◆ MATHVARS1 [2/2]

#define MATHVARS1   HRESULT hres; DECIMAL l, out

Definition at line 3871 of file vartype.c.

◆ MATHVARS2 [1/2]

#define MATHVARS2   MATHVARS1; double right = 0.0; CY cyRight

Definition at line 3873 of file vartype.c.

◆ MATHVARS2 [2/2]

#define MATHVARS2   MATHVARS1; DECIMAL r

Definition at line 3873 of file vartype.c.

◆ MISMATCH

#define MISMATCH (   typ)    CHANGETYPEEX(typ); EXPECT_MISMATCH

Definition at line 145 of file vartype.c.

◆ MKRELDATE

#define MKRELDATE (   day,
  mth 
)
Value:
st.wMonth = mth; st.wDay = day; \
SystemTimeToVariantTime(&st,&relative)
static DOUBLE day(DOUBLE time)
Definition: date.c:117

Definition at line 2950 of file vartype.c.

◆ NEGATIVE_TYPETEST

#define NEGATIVE_TYPETEST (   vt,
  val,
  fs,
  vtneg,
  valneg 
)
Value:
in = -in; \
VariantInit(&vSrc); \
VariantInit(&vDst); \
V_VT(&vSrc) = vt; \
(val(&vSrc)) = in; \
TYPETEST(vtneg, valneg(&vDst), fs);

Definition at line 168 of file vartype.c.

◆ NUM_CUST_ITEMS

#define NUM_CUST_ITEMS   16

Definition at line 5823 of file vartype.c.

◆ OVERFLOWRANGE

#define OVERFLOWRANGE (   func,
  start,
  end 
)    for (i = start; i < end; i+=1) { CONVERT(func, i); EXPECT_OVERFLOW; };

Definition at line 84 of file vartype.c.

◆ SET_EXPECT

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

Definition at line 253 of file vartype.c.

◆ SETDEC

#define SETDEC (   dec,
  scl,
  sgn,
  hi,
  lo 
)
Value:
S(U(dec)).scale = (BYTE)scl; S(U(dec)).sign = (BYTE)sgn; \
dec.Hi32 = (ULONG)hi; U1(dec).Lo64 = (ULONG64)lo
ios_base &_STLP_CALL dec(ios_base &__s)
Definition: _ios_base.h:321

Definition at line 97 of file vartype.c.

◆ SETDEC64

#define SETDEC64 (   dec,
  scl,
  sgn,
  hi,
  mid,
  lo 
)
Value:
S(U(dec)).scale = (BYTE)scl; S(U(dec)).sign = (BYTE)sgn; \
dec.Hi32 = (ULONG)hi; S1(U1(dec)).Mid32 = mid; S1(U1(dec)).Lo32 = lo;

Definition at line 100 of file vartype.c.

◆ TYPETEST

#define TYPETEST (   typ,
  res,
  fs 
)
Value:
CHANGETYPEEX(typ); \
ok(hres == S_OK && V_VT(&vDst) == typ && (CONV_TYPE)res == in, \
"hres=0x%X, type=%d (should be %d(" #typ ")), value=" fs " (should be " fs ")\n", \
hres, V_VT(&vDst), typ, (CONV_TYPE)res, in);
GLuint res
Definition: glext.h:9613
#define CHANGETYPEEX(typ)
Definition: vartype.c:134

Definition at line 136 of file vartype.c.

◆ TYPETESTI8

#define TYPETESTI8 (   typ,
  res 
)
Value:
CHANGETYPEEX(typ); \
ok(hres == S_OK && V_VT(&vDst) == typ && (CONV_TYPE)res == in, \
"hres=0x%X, type=%d (should be %d(" #typ ")), value=%d (should be 1)\n", \
hres, V_VT(&vDst), typ, (int)res);

Definition at line 140 of file vartype.c.

◆ VARBSTRCMP

#define VARBSTRCMP (   left,
  right,
  flags,
  result 
)     _VARBSTRCMP(left,right,lcid,flags,result)

Definition at line 4811 of file vartype.c.

Typedef Documentation

◆ INTERNAL_BSTR

◆ LPINTERNAL_BSTR

Function Documentation

◆ _BSTR_CY()

static void _BSTR_CY ( LONG  a,
LONG  b,
const char str,
LCID  lcid,
int  line 
)
static

Definition at line 4675 of file vartype.c.

4676{
4677 HRESULT hr;
4678 BSTR bstr = NULL;
4679 char buff[256];
4680 CY l;
4681
4682 S(l).Lo = b;
4683 S(l).Hi = a;
4684 hr = VarBstrFromCy(l, lcid, LOCALE_NOUSEROVERRIDE, &bstr);
4685 ok(hr == S_OK, "got hr 0x%08x\n", hr);
4686
4687 if(bstr)
4688 {
4689 WideCharToMultiByte(CP_ACP, 0, bstr, -1, buff, sizeof(buff), 0, 0);
4690 SysFreeString(bstr);
4691 }
4692 else
4693 buff[0] = 0;
4694
4695 if(hr == S_OK)
4696 {
4697 ok_(__FILE__, line)(!strcmp(str, buff), "Expected '%s', got '%s'\n", str, buff);
4698 }
4699}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ok_(x1, x2)
Definition: atltest.h:61
OLECHAR * BSTR
Definition: compat.h:2293
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT WINAPI VarBstrFromCy(CY cyIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
Definition: vartype.c:6608
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:49
Definition: compat.h:2255

◆ _BSTR_DATE()

static void _BSTR_DATE ( DATE  dt,
const char str,
int  line 
)
static

Definition at line 4638 of file vartype.c.

4639{
4641 char buff[256];
4642 BSTR bstr = NULL;
4643 HRESULT hres;
4644
4645 hres = VarBstrFromDate(dt, lcid, LOCALE_NOUSEROVERRIDE, &bstr);
4646 if (bstr)
4647 {
4648 WideCharToMultiByte(CP_ACP, 0, bstr, -1, buff, sizeof(buff), 0, 0);
4649 SysFreeString(bstr);
4650 }
4651 else
4652 buff[0] = 0;
4653 ok_(__FILE__, line)(hres == S_OK && !strcmp(str, buff),
4654 "Expected '%s', got '%s', hres = 0x%08x\n", str, buff, hres);
4655}
HRESULT WINAPI VarBstrFromDate(DATE dateIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
Definition: vartype.c:6778
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_ENGLISH
Definition: nls.h:52
DWORD LCID
Definition: nls.h:13
#define SUBLANG_ENGLISH_US
Definition: nls.h:222

◆ _BSTR_DEC()

static void _BSTR_DEC ( BYTE  scale,
BYTE  sign,
ULONG  hi,
ULONG  mid,
ULONGLONG  lo,
const char str,
LCID  lcid,
int  line 
)
static

Definition at line 4726 of file vartype.c.

4728{
4729 char buff[256];
4730 HRESULT hr;
4731 BSTR bstr = NULL;
4732 DECIMAL dec;
4733
4734 SETDEC64(dec, scale, sign, hi, mid, lo);
4735 hr = VarBstrFromDec(&dec, lcid, LOCALE_NOUSEROVERRIDE, &bstr);
4736 ok_(__FILE__, line)(hr == S_OK, "got hr 0x%08x\n", hr);
4737
4738 if(bstr)
4739 {
4740 WideCharToMultiByte(CP_ACP, 0, bstr, -1, buff, sizeof(buff), 0, 0);
4741 SysFreeString(bstr);
4742 }
4743 else
4744 buff[0] = 0;
4745
4746 if(hr == S_OK)
4747 {
4748 ok_(__FILE__, line)(!strcmp(str, buff), "Expected '%s', got '%s'\n", str, buff);
4749 }
4750}
HRESULT WINAPI VarBstrFromDec(DECIMAL *pDecIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
Definition: vartype.c:6991
#define SETDEC64(dec, scl, sgn, hi, mid, lo)
Definition: vartype.c:100

◆ create_test_typelib()

static const char * create_test_typelib ( int  res_no)
static

Definition at line 5969 of file vartype.c.

5970{
5971 static char filename[MAX_PATH];
5972
5973 GetTempFileNameA( ".", "tlb", 0, filename );
5974 write_typelib(res_no, filename);
5975 return filename;
5976}
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
const char * filename
Definition: ioapi.h:137
static void write_typelib(int res_no, const char *filename)
Definition: vartype.c:5951

Referenced by test_recinfo().

◆ DEFINE_EXPECT()

DEFINE_EXPECT ( dispatch_invoke  )

◆ DEFINE_GUID()

DEFINE_GUID ( UUID_test_struct  ,
0x4029f190  ,
0xca4a  ,
0x4611  ,
0xae  ,
0xb9  ,
0x67  ,
0x39  ,
0x83  ,
0xcb  ,
0x96  ,
0xdd   
)

◆ DummyDispatch_AddRef()

static ULONG WINAPI DummyDispatch_AddRef ( IDispatch iface)
static

Definition at line 296 of file vartype.c.

297{
299 return InterlockedIncrement(&This->ref);
300}
#define InterlockedIncrement
Definition: armddk.h:53
static DummyDispatch * impl_from_IDispatch(IDispatch *iface)
Definition: vartype.c:291

◆ DummyDispatch_GetIDsOfNames()

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

Definition at line 336 of file vartype.c.

338{
339 ok(0, "Unexpected call\n");
340 return E_NOTIMPL;
341}
#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 330 of file vartype.c.

331{
332 ok(0, "Unexpected call\n");
333 return E_NOTIMPL;
334}

◆ DummyDispatch_GetTypeInfoCount()

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

Definition at line 324 of file vartype.c.

325{
326 ok(0, "Unexpected call\n");
327 return E_NOTIMPL;
328}

◆ 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 343 of file vartype.c.

350{
352
353 CHECK_EXPECT(dispatch_invoke);
354
355 ok(dispid == DISPID_VALUE, "got dispid %d\n", dispid);
356 ok(IsEqualIID(riid, &IID_NULL), "go riid %s\n", wine_dbgstr_guid(riid));
357 ok(wFlags == DISPATCH_PROPERTYGET, "Flags wrong\n");
358
359 ok(params->rgvarg == NULL, "got %p\n", params->rgvarg);
360 ok(params->rgdispidNamedArgs == NULL, "got %p\n", params->rgdispidNamedArgs);
361 ok(params->cArgs == 0, "got %d\n", params->cArgs);
362 ok(params->cNamedArgs == 0, "got %d\n", params->cNamedArgs);
363
364 ok(res != NULL, "got %p\n", res);
365 ok(V_VT(res) == VT_EMPTY, "got %d\n", V_VT(res));
366 ok(ei == NULL, "got %p\n", ei);
367 ok(arg_err == NULL, "got %p\n", arg_err);
368
369 if (This->bFailInvoke)
370 return E_OUTOFMEMORY;
371
372 V_VT(res) = This->vt;
373 if (This->vt == VT_UI1)
374 V_UI1(res) = 1;
375 else
376 memset(res, 0, sizeof(*res));
377
378 return S_OK;
379}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
@ VT_EMPTY
Definition: compat.h:2295
GLenum const GLfloat * params
Definition: glext.h:5645
REFIID riid
Definition: atlbase.h:39
#define CHECK_EXPECT(func)
Definition: vartype.c:262
#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 memset(x, y, z)
Definition: compat.h:39
_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 308 of file vartype.c.

311{
312 *ppvObject = NULL;
313
316 {
317 *ppvObject = iface;
318 IDispatch_AddRef(iface);
319 }
320
321 return *ppvObject ? S_OK : E_NOINTERFACE;
322}
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 302 of file vartype.c.

303{
305 return InterlockedDecrement(&This->ref);
306}
#define InterlockedDecrement
Definition: armddk.h:52

◆ Get()

static LPINTERNAL_BSTR Get ( const BSTR  lpszString)
inlinestatic

Definition at line 4895 of file vartype.c.

4896{
4897 return lpszString ? (LPINTERNAL_BSTR)((char*)lpszString - sizeof(DWORD)) : NULL;
4898}
struct tagINTERNAL_BSTR * LPINTERNAL_BSTR
#define DWORD
Definition: nt_native.h:44

Referenced by DECLARE_INTERFACE_(), test_BstrCopy(), test_SysAllocString(), test_SysAllocStringByteLen(), test_SysAllocStringLen(), test_SysReAllocString(), and test_SysReAllocStringLen().

◆ GetBSTR()

static BSTR GetBSTR ( const LPINTERNAL_BSTR  bstr)
inlinestatic

Definition at line 4900 of file vartype.c.

4901{
4902 return (BSTR)bstr->szString;
4903}
OLECHAR szString[1]
Definition: vartype.c:280

Referenced by test_SysStringByteLen(), and test_SysStringLen().

◆ impl_from_IDispatch()

static DummyDispatch * impl_from_IDispatch ( IDispatch iface)
inlinestatic

Definition at line 291 of file vartype.c.

292{
293 return CONTAINING_RECORD(iface, DummyDispatch, IDispatch_iface);
294}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by DummyDispatch_AddRef(), DummyDispatch_Invoke(), and DummyDispatch_Release().

◆ init_test_dispatch()

static void init_test_dispatch ( LONG  ref,
VARTYPE  vt,
DummyDispatch dispatch 
)
static

Definition at line 392 of file vartype.c.

393{
394 dispatch->IDispatch_iface.lpVtbl = &DummyDispatch_VTable;
395 dispatch->ref = ref;
396 dispatch->vt = vt;
397 dispatch->bFailInvoke = FALSE;
398}
void dispatch(HANDLE hStopEvent)
Definition: dispatch.c:70
static const IDispatchVtbl DummyDispatch_VTable
Definition: vartype.c:381
Definition: send.c:48

Referenced by test_IDispatchChangeTypeEx(), test_IDispatchClear(), test_IDispatchCopy(), test_IUnknownChangeTypeEx(), test_IUnknownClear(), test_IUnknownCopy(), test_recinfo(), and test_VarUI1FromDisp().

◆ START_TEST()

START_TEST ( vartype  )

Definition at line 6115 of file vartype.c.

6116{
6117 hOleaut32 = GetModuleHandleA("oleaut32.dll");
6118
6119 has_i8 = GetProcAddress(hOleaut32, "VarI8FromI1") != NULL;
6120 has_locales = has_i8 && GetProcAddress(hOleaut32, "GetVarConversionLocaleSetting") != NULL;
6121
6122 trace("LCIDs: System=0x%08x, User=0x%08x\n", GetSystemDefaultLCID(),
6124
6126
6144
6161
6178
6195
6212
6229
6245
6261
6278
6296
6313
6327
6328 test_VarCyAdd();
6329 test_VarCyMul();
6330 test_VarCySub();
6331 test_VarCyAbs();
6332 test_VarCyNeg();
6335 test_VarCyCmp();
6338 test_VarCyFix();
6339 test_VarCyInt();
6340
6356
6366
6383
6397 test_BstrCopy();
6399
6403
6407
6412
6414
6417
6418 test_recinfo();
6419}
#define trace
Definition: atltest.h:70
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:772
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:791
static void test_VarDateFromR8(void)
Definition: vartype.c:2866
static void test_VarUI1FromBool(void)
Definition: vartype.c:711
static void test_VarI1FromStr(void)
Definition: vartype.c:600
static void test_VarBoolChangeTypeEx(void)
Definition: vartype.c:4501
static void test_VarUI8FromR8(void)
Definition: vartype.c:2201
static void test_VarUI2FromDate(void)
Definition: vartype.c:1300
static void test_VarDateFromI8(void)
Definition: vartype.c:2906
static void test_VarUI1Copy(void)
Definition: vartype.c:914
static void test_IDispatchChangeTypeEx(void)
Definition: vartype.c:5565
static void test_VarI1ChangeTypeEx(void)
Definition: vartype.c:629
static void test_VarI2FromI8(void)
Definition: vartype.c:957
static void test_VarR4FromI8(void)
Definition: vartype.c:2475
static void test_VarBoolFromStr(void)
Definition: vartype.c:4418
static void test_VarI1FromBool(void)
Definition: vartype.c:475
static void test_VarUI1FromDec(void)
Definition: vartype.c:814
static void test_VarR8ChangeTypeEx(void)
Definition: vartype.c:2742
static void test_VarI4FromUI8(void)
Definition: vartype.c:1464
static void test_VarI8FromUI4(void)
Definition: vartype.c:1921
static void test_VarDateFromI4(void)
Definition: vartype.c:2827
static void test_VarDateFromBool(void)
Definition: vartype.c:2876
static void test_VarCyAbs(void)
Definition: vartype.c:3491
static void test_VarDateFromDec(void)
Definition: vartype.c:2929
static void test_VarDecCmp(void)
Definition: vartype.c:4099
static void test_VarI4Copy(void)
Definition: vartype.c:1618
static void test_VarBstrFromCy(void)
Definition: vartype.c:4701
static void test_VarR4FromUI2(void)
Definition: vartype.c:2405
static void test_VarI2FromI1(void)
Definition: vartype.c:939
static void test_VarI2FromDate(void)
Definition: vartype.c:1064
static void test_VarBoolFromUI1(void)
Definition: vartype.c:4283
static void test_VarI1FromUI8(void)
Definition: vartype.c:466
static void test_NullByRef(void)
Definition: vartype.c:5838
static void test_VarBoolFromI2(void)
Definition: vartype.c:4291
static void test_VarI8FromUI2(void)
Definition: vartype.c:1910
static void test_VarUI8ChangeTypeEx(void)
Definition: vartype.c:2354
static void test_VarUI4Copy(void)
Definition: vartype.c:1840
static void test_VarI2FromCy(void)
Definition: vartype.c:1087
static void test_VarI1FromUI2(void)
Definition: vartype.c:448
static void test_VarI4FromUI1(void)
Definition: vartype.c:1438
static void test_VarCyFromDec(void)
Definition: vartype.c:3381
static void test_VarI1FromUI1(void)
Definition: vartype.c:439
static void test_VarDecFromUI8(void)
Definition: vartype.c:3776
static void test_VarBoolFromI4(void)
Definition: vartype.c:4307
static void test_VarDecFromI2(void)
Definition: vartype.c:3710
static void test_VarUI2FromR8(void)
Definition: vartype.c:1275
static void test_VarR8FromDec(void)
Definition: vartype.c:2685
static void test_VarI8FromCy(void)
Definition: vartype.c:2011
static void test_VarBstrFromR4(void)
Definition: vartype.c:4577
static void test_VarUI1FromStr(void)
Definition: vartype.c:830
static void test_VarUI8FromUI4(void)
Definition: vartype.c:2174
static void test_VarUI2FromI8(void)
Definition: vartype.c:1204
static void test_VarI8ChangeTypeEx(void)
Definition: vartype.c:2100
static void test_VarI2FromUI4(void)
Definition: vartype.c:984
static void test_VarI4FromCy(void)
Definition: vartype.c:1549
static void test_VarR8FromUI4(void)
Definition: vartype.c:2611
static void test_VarUI2FromI2(void)
Definition: vartype.c:1184
static void test_VarBoolFromUI8(void)
Definition: vartype.c:4381
static void test_VarR4ChangeTypeEx(void)
Definition: vartype.c:2547
static void test_VarI8FromR8(void)
Definition: vartype.c:1950
static void test_VarR4FromBool(void)
Definition: vartype.c:2447
static void test_VarUI4FromBool(void)
Definition: vartype.c:1706
static void test_IDispatchClear(void)
Definition: vartype.c:5490
static void test_VarUI8FromDec(void)
Definition: vartype.c:2278
static void test_VarR4FromUI1(void)
Definition: vartype.c:2389
static void test_VarR8FromCy(void)
Definition: vartype.c:2640
static void test_VarUI1FromR4(void)
Definition: vartype.c:722
static void test_VarDecFromBool(void)
Definition: vartype.c:3787
static void test_IUnknownCopy(void)
Definition: vartype.c:5361
static void test_UintChangeTypeEx(void)
Definition: vartype.c:5805
static HMODULE hOleaut32
Definition: vartype.c:53
static void test_VarUI2FromUI8(void)
Definition: vartype.c:1232
static void test_VarUI4FromDec(void)
Definition: vartype.c:1800
static void test_VarDecFromR4(void)
Definition: vartype.c:3803
static void test_VarBstrCat(void)
Definition: vartype.c:5224
static void test_VarI4FromStr(void)
Definition: vartype.c:1593
static void test_VarDecFromStr(void)
Definition: vartype.c:3842
static void test_VarUI1FromCy(void)
Definition: vartype.c:793
static void test_VarDecFromCy(void)
Definition: vartype.c:3860
static void test_VarR4FromUI8(void)
Definition: vartype.c:2484
static void test_VarBoolFromCy(void)
Definition: vartype.c:4359
static void test_VarBstrFromDec(void)
Definition: vartype.c:4752
static void test_VarI4FromUI2(void)
Definition: vartype.c:1446
static void test_VarI2FromR8(void)
Definition: vartype.c:1037
static void test_VarUI2FromI1(void)
Definition: vartype.c:1175
static void test_VarI8FromUI1(void)
Definition: vartype.c:1888
static void test_VarCyFix(void)
Definition: vartype.c:3622
static void test_VarI8FromR4(void)
Definition: vartype.c:1930
static void test_VarUI4FromI8(void)
Definition: vartype.c:1667
static void test_VarR8FromStr(void)
Definition: vartype.c:2712
static void test_VarCyFromBool(void)
Definition: vartype.c:3345
static void test_VarUI1FromUI8(void)
Definition: vartype.c:702
static void test_SysAllocStringByteLen(void)
Definition: vartype.c:4985
static void test_VarUI4FromI1(void)
Definition: vartype.c:1641
static void test_VarR8FromI4(void)
Definition: vartype.c:2600
static void test_VarUI2FromUI1(void)
Definition: vartype.c:1215
static void test_VarCyMulI4(void)
Definition: vartype.c:3514
static void test_VarUI1FromI8(void)
Definition: vartype.c:674
static void test_VarR8FromI8(void)
Definition: vartype.c:2662
static void test_VarDecFromUI2(void)
Definition: vartype.c:3754
static void test_VarR8FromBool(void)
Definition: vartype.c:2632
static void test_VarBoolFromI1(void)
Definition: vartype.c:4275
static void test_VarCyFromI1(void)
Definition: vartype.c:3210
static void test_VarCyFromUI8(void)
Definition: vartype.c:3369
static void test_VarUI2FromBool(void)
Definition: vartype.c:1241
static void test_VarUI1FromUI2(void)
Definition: vartype.c:684
static void test_VarI8FromDec(void)
Definition: vartype.c:2031
static void test_VarUI8FromUI1(void)
Definition: vartype.c:2137
static void test_VarI8FromI2(void)
Definition: vartype.c:1899
static void test_VarCyFromR8(void)
Definition: vartype.c:3305
static void test_VarR4FromR8(void)
Definition: vartype.c:2435
static void test_VarR4FromCy(void)
Definition: vartype.c:2455
static void test_VarI4FromR8(void)
Definition: vartype.c:1501
static void test_VarDecFromI1(void)
Definition: vartype.c:3699
static void test_VarUI4FromUI1(void)
Definition: vartype.c:1678
static void test_VarR4FromI1(void)
Definition: vartype.c:2381
static void test_VarCyFromI4(void)
Definition: vartype.c:3254
static void test_VarCyFromUI2(void)
Definition: vartype.c:3243
static void test_VarDecFromDate(void)
Definition: vartype.c:3829
static void test_NullChangeTypeEx(void)
Definition: vartype.c:5729
static void test_SysStringByteLen(void)
Definition: vartype.c:4916
static void test_VarR4FromUI4(void)
Definition: vartype.c:2424
static void test_VarUI4FromR8(void)
Definition: vartype.c:1736
static void test_ChangeType_keep_dst(void)
Definition: vartype.c:5869
static void test_VarR8FromUI1(void)
Definition: vartype.c:2576
static void test_VarUI2FromR4(void)
Definition: vartype.c:1250
static void test_VarDecFromR8(void)
Definition: vartype.c:3816
static void test_VarCyFromDate(void)
Definition: vartype.c:3407
static void test_VarR4FromStr(void)
Definition: vartype.c:2520
static void test_VarUI8Copy(void)
Definition: vartype.c:2323
static void test_VarBoolFromR8(void)
Definition: vartype.c:4347
static void test_VarI8FromBool(void)
Definition: vartype.c:1990
static void test_VarCyFromI8(void)
Definition: vartype.c:3356
static void test_SysAllocString(void)
Definition: vartype.c:4927
static void test_VarCyFromR4(void)
Definition: vartype.c:3274
static void test_VarDecAdd(void)
Definition: vartype.c:3910
static void test_VarUI8FromI8(void)
Definition: vartype.c:2250
static void test_VarUI4FromStr(void)
Definition: vartype.c:1816
static void test_VarCyAdd(void)
Definition: vartype.c:3451
static void test_IDispatchCopy(void)
Definition: vartype.c:5518
static void test_VarUI4FromCy(void)
Definition: vartype.c:1780
static void test_VarCyFromUI1(void)
Definition: vartype.c:3221
static void test_VarDecSub(void)
Definition: vartype.c:3990
static void test_VarDecDiv(void)
Definition: vartype.c:4050
static void test_VarUI8FromStr(void)
Definition: vartype.c:2298
static BOOL has_locales
Definition: vartype.c:58
static void test_VarI1FromUI4(void)
Definition: vartype.c:457
static void test_VarR4Copy(void)
Definition: vartype.c:2542
static void test_VarUI4FromUI8(void)
Definition: vartype.c:1696
static void test_VarDateFromUI8(void)
Definition: vartype.c:2919
static void test_VarI2FromBool(void)
Definition: vartype.c:1002
static void test_VarI1FromCy(void)
Definition: vartype.c:560
static void test_VarBstrCmp(void)
Definition: vartype.c:4814
static void test_VarDateFromUI4(void)
Definition: vartype.c:2844
static void test_VarI8FromUI8(void)
Definition: vartype.c:2001
static void test_VarCyMul(void)
Definition: vartype.c:3465
static void test_VarI8Copy(void)
Definition: vartype.c:2069
static void test_ClearCustData(void)
Definition: vartype.c:5825
static void test_VarBstrFromI4(void)
Definition: vartype.c:4543
static void test_VarBoolFromR4(void)
Definition: vartype.c:4327
static void test_IUnknownChangeTypeEx(void)
Definition: vartype.c:5410
static void test_bstr_cache(void)
Definition: vartype.c:5900
static void test_VarDateFromI2(void)
Definition: vartype.c:2811
static void test_VarDecFromI4(void)
Definition: vartype.c:3721
static void test_VarUI4FromI2(void)
Definition: vartype.c:1650
static void test_BstrCopy(void)
Definition: vartype.c:5198
static void test_VarUI1FromDisp(void)
Definition: vartype.c:854
static void test_VarR8FromDate(void)
Definition: vartype.c:2703
static void test_VarDateFromUI2(void)
Definition: vartype.c:2819
static void test_VarUI1FromI1(void)
Definition: vartype.c:645
static void test_VarI4ChangeTypeEx(void)
Definition: vartype.c:1623
static void test_VarI4FromR4(void)
Definition: vartype.c:1482
static void test_VarUI2FromUI4(void)
Definition: vartype.c:1223
static void test_VarCyRound(void)
Definition: vartype.c:3590
static void test_VarI2FromUI2(void)
Definition: vartype.c:975
static void test_VarUI2FromStr(void)
Definition: vartype.c:1359
static void test_VarI2FromUI8(void)
Definition: vartype.c:993
static void test_VarUI4FromI4(void)
Definition: vartype.c:1686
static void test_VarBoolFromUI4(void)
Definition: vartype.c:4318
static void test_VarUI2FromI4(void)
Definition: vartype.c:1193
static void test_VarI1FromR4(void)
Definition: vartype.c:486
static void test_VarDateFromI1(void)
Definition: vartype.c:2795
static void test_VarUI8FromUI2(void)
Definition: vartype.c:2163
static void test_VarUI1FromUI4(void)
Definition: vartype.c:693
static void test_VarR8FromUI2(void)
Definition: vartype.c:2592
static void test_VarUI2Copy(void)
Definition: vartype.c:1383
static void test_VarI4FromI1(void)
Definition: vartype.c:1408
static void test_VarI2FromDec(void)
Definition: vartype.c:1110
static void test_VarUI2FromDec(void)
Definition: vartype.c:1342
static void test_VarUI1FromR8(void)
Definition: vartype.c:747
static void test_VarR4FromI2(void)
Definition: vartype.c:2397
static void test_VarUI8FromBool(void)
Definition: vartype.c:2239
static void test_VarCyCmpR8(void)
Definition: vartype.c:3566
static void test_VarI2FromI4(void)
Definition: vartype.c:947
static void test_EmptyChangeTypeEx(void)
Definition: vartype.c:5657
static void test_VarUI8FromI1(void)
Definition: vartype.c:2122
static void test_VarUI8FromI2(void)
Definition: vartype.c:2148
static void test_VarUI4FromUI2(void)
Definition: vartype.c:1659
static void test_SysReAllocStringLen(void)
Definition: vartype.c:5114
static void test_VarCyFromUI4(void)
Definition: vartype.c:3265
static void test_VarI4FromDate(void)
Definition: vartype.c:1527
static void test_VarDecMul(void)
Definition: vartype.c:4000
static void test_VarR8FromUI8(void)
Definition: vartype.c:2674
static void test_IUnknownClear(void)
Definition: vartype.c:5333
static void test_VarUI2FromCy(void)
Definition: vartype.c:1321
static void test_VarCyFromI2(void)
Definition: vartype.c:3232
static void test_VarR8Copy(void)
Definition: vartype.c:2737
static void test_VarR4FromDec(void)
Definition: vartype.c:2492
static void test_VarUI8FromR4(void)
Definition: vartype.c:2182
static void test_VarDateFromUI1(void)
Definition: vartype.c:2803
static void test_VarI2FromUI1(void)
Definition: vartype.c:967
static void test_VarI4FromI2(void)
Definition: vartype.c:1416
static void test_VarR8FromI2(void)
Definition: vartype.c:2584
static void test_VarI1FromDate(void)
Definition: vartype.c:538
static void test_VarDecFromUI4(void)
Definition: vartype.c:3765
static void test_VarUI4FromR4(void)
Definition: vartype.c:1714
static void test_VarDecNeg(void)
Definition: vartype.c:3895
static void test_VarI1Copy(void)
Definition: vartype.c:624
static void test_VarI2ChangeTypeEx(void)
Definition: vartype.c:1159
static void test_VarBoolFromDec(void)
Definition: vartype.c:4389
static void test_VarI1FromI4(void)
Definition: vartype.c:419
static void test_VarBoolFromDate(void)
Definition: vartype.c:4409
static void test_VarR8FromI1(void)
Definition: vartype.c:2568
static void test_VarUI1FromDate(void)
Definition: vartype.c:772
static void test_VarCyInt(void)
Definition: vartype.c:3647
static void test_VarDecRound(void)
Definition: vartype.c:4234
static void test_VarDateFromStr(void)
Definition: vartype.c:2985
static void test_VarI8FromStr(void)
Definition: vartype.c:2047
static void test_VarUI1FromI2(void)
Definition: vartype.c:654
static void test_SysAllocStringLen(void)
Definition: vartype.c:4950
static void test_VarUI8FromDate(void)
Definition: vartype.c:2220
static void test_VarDecFromUI1(void)
Definition: vartype.c:3743
static void test_VarBoolFromI8(void)
Definition: vartype.c:4372
static void test_VarI1FromI2(void)
Definition: vartype.c:409
static void test_VarI2Copy(void)
Definition: vartype.c:1154
static void test_VarI4FromDec(void)
Definition: vartype.c:1572
static void test_VarDecAbs(void)
Definition: vartype.c:3881
static void test_SysReAllocString(void)
Definition: vartype.c:5076
static void test_VarI4FromI8(void)
Definition: vartype.c:1424
static void test_SysStringLen(void)
Definition: vartype.c:4905
static void test_VarI8FromDate(void)
Definition: vartype.c:1970
static void test_VarUI2ChangeTypeEx(void)
Definition: vartype.c:1388
static void test_VarUI4FromDate(void)
Definition: vartype.c:1760
static void test_VarCySub(void)
Definition: vartype.c:3477
static void test_VarI4FromBool(void)
Definition: vartype.c:1474
static void test_VarBstrFromDate(void)
Definition: vartype.c:4657
static void test_VarUI1ChangeTypeEx(void)
Definition: vartype.c:919
static void test_VarI1FromI8(void)
Definition: vartype.c:429
static void test_VarCyCmp(void)
Definition: vartype.c:3544
static void test_VarBoolFromUI2(void)
Definition: vartype.c:4299
static void test_VarUI4ChangeTypeEx(void)
Definition: vartype.c:1845
static void test_VarDateFromCy(void)
Definition: vartype.c:2884
static void test_VarI1FromDec(void)
Definition: vartype.c:582
static void test_VarI4FromUI4(void)
Definition: vartype.c:1454
static void test_VarUI8FromCy(void)
Definition: vartype.c:2259
static void test_VarCyNeg(void)
Definition: vartype.c:3501
static void test_VarR8Round(void)
Definition: vartype.c:2758
static void test_ErrorChangeTypeEx(void)
Definition: vartype.c:5616
static void test_VarR8FromR4(void)
Definition: vartype.c:2620
static void test_VarR4FromDate(void)
Definition: vartype.c:2511
static void test_VarR4FromI4(void)
Definition: vartype.c:2413
static void test_VarI1FromR8(void)
Definition: vartype.c:512
static void test_VarUI1FromI4(void)
Definition: vartype.c:664
static void test_VarBoolCopy(void)
Definition: vartype.c:4489
static void test_VarDateChangeTypeEx(void)
Definition: vartype.c:3151
static void test_VarDateFromR4(void)
Definition: vartype.c:2856
static void test_VarI2FromR4(void)
Definition: vartype.c:1010
static void test_VarI2FromStr(void)
Definition: vartype.c:1129
static void test_VarDateCopy(void)
Definition: vartype.c:3138
static void test_VarDecCmpR8(void)
Definition: vartype.c:4204
static void test_recinfo(void)
Definition: vartype.c:5978
static void test_VarDecFromI8(void)
Definition: vartype.c:3732
static void test_VarCyMulI8(void)
Definition: vartype.c:3529
static void test_VarI8FromI1(void)
Definition: vartype.c:1877

◆ test_bstr_cache()

static void test_bstr_cache ( void  )
static

Definition at line 5900 of file vartype.c.

5901{
5902 BSTR str, str2, strs[20];
5903 unsigned i;
5904
5905 static const WCHAR testW[] = {'t','e','s','t',0};
5906
5907 if (GetEnvironmentVariableA("OANOCACHE", NULL, 0)) {
5908 skip("BSTR cache is disabled, some tests will be skipped.\n");
5909 return;
5910 }
5911
5913 /* This should put the string into cache */
5915 /* The string is in cache, this won't touch it */
5917
5918 ok(SysStringLen(str) == 4, "unexpected len\n");
5919 ok(!lstrcmpW(str, testW), "string changed\n");
5920
5921 str2 = SysAllocString(testW);
5922 ok(str == str2, "str != str2\n");
5923 SysFreeString(str2);
5924
5925 /* Fill the bucket with cached entries.
5926 We roll our own, to show that the cache doesn't use
5927 the bstr length field to determine bucket allocation. */
5928 for(i=0; i < ARRAY_SIZE(strs); i++)
5929 {
5931 ptr[0] = 0;
5932 strs[i] = (BSTR)(ptr + 1);
5933 }
5934 for(i=0; i < ARRAY_SIZE(strs); i++)
5935 SysFreeString(strs[i]);
5936
5937 /* Following allocation will be made from cache */
5938 str = SysAllocStringLen(NULL, 24);
5939 ok(str == strs[0], "str != strs[0]\n");
5940
5941 /* Smaller buffers may also use larget cached buffers */
5942 str2 = SysAllocStringLen(NULL, 16);
5943 ok(str2 == strs[1], "str2 != strs[1]\n");
5944
5946 SysFreeString(str2);
5948 SysFreeString(str2);
5949}
#define skip(...)
Definition: atltest.h:64
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
static const WCHAR testW[]
Definition: jsregexp.c:44
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static PVOID ptr
Definition: dispmode.c:27
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
uint32_t DWORD_PTR
Definition: typedefs.h:65
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_BstrCopy()

static void test_BstrCopy ( void  )
static

Definition at line 5198 of file vartype.c.

5199{
5200 const CHAR szTestA[6] = { 'T','e','s','t','\0','?' };
5201 const CHAR szTestTruncA[4] = { 'T','e','s','\0' };
5202 LPINTERNAL_BSTR bstr;
5203 BSTR str;
5204 HRESULT hres;
5205 VARIANT vt1, vt2;
5206
5207 str = SysAllocStringByteLen(szTestA, 3);
5208 ok (str != NULL, "Expected non-NULL\n");
5209 if (str)
5210 {
5211 V_VT(&vt1) = VT_BSTR;
5212 V_BSTR(&vt1) = str;
5213 V_VT(&vt2) = VT_EMPTY;
5214 hres = VariantCopy(&vt2, &vt1);
5215 ok (hres == S_OK,"Failed to copy binary bstring with hres 0x%08x\n", hres);
5216 bstr = Get(V_BSTR(&vt2));
5217 ok (bstr->dwLen == 3, "Expected 3, got %d\n", bstr->dwLen);
5218 ok (!lstrcmpA((LPCSTR)bstr->szString, szTestTruncA), "String different\n");
5219 VariantClear(&vt2);
5220 VariantClear(&vt1);
5221 }
5222}
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
static LPINTERNAL_BSTR Get(const BSTR lpszString)
Definition: vartype.c:4895
BSTR WINAPI DECLSPEC_HOTPATCH SysAllocStringByteLen(LPCSTR str, UINT len)
Definition: oleaut.c:428
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
const char * LPCSTR
Definition: xmlstorage.h:183
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_ChangeType_keep_dst()

static void test_ChangeType_keep_dst ( void  )
static

Definition at line 5869 of file vartype.c.

5870{
5871 VARIANT v1, v2;
5872 BSTR bstr;
5873 static const WCHAR testW[] = {'t','e','s','t',0};
5874 HRESULT hres;
5875
5876 bstr = SysAllocString(testW);
5877 VariantInit(&v1);
5878 VariantInit(&v2);
5879 V_VT(&v1) = VT_BSTR;
5880 V_BSTR(&v1) = bstr;
5881 hres = VariantChangeTypeEx(&v1, &v1, 0, 0, VT_INT);
5882 ok(hres == DISP_E_TYPEMISMATCH, "VariantChangeTypeEx returns %08x\n", hres);
5883 ok(V_VT(&v1) == VT_BSTR && V_BSTR(&v1) == bstr, "VariantChangeTypeEx changed dst variant\n");
5884 V_VT(&v2) = VT_INT;
5885 V_INT(&v2) = 4;
5886 hres = VariantChangeTypeEx(&v2, &v1, 0, 0, VT_INT);
5887 ok(hres == DISP_E_TYPEMISMATCH, "VariantChangeTypeEx returns %08x\n", hres);
5888 ok(V_VT(&v2) == VT_INT && V_INT(&v2) == 4, "VariantChangeTypeEx changed dst variant\n");
5889 V_VT(&v2) = 0xff; /* incorrect variant type */
5890 hres = VariantChangeTypeEx(&v2, &v1, 0, 0, VT_INT);
5891 ok(hres == DISP_E_TYPEMISMATCH, "VariantChangeTypeEx returns %08x\n", hres);
5892 ok(V_VT(&v2) == 0xff, "VariantChangeTypeEx changed dst variant\n");
5893 hres = VariantChangeTypeEx(&v2, &v1, 0, 0, VT_BSTR);
5894 ok(hres == DISP_E_BADVARTYPE, "VariantChangeTypeEx returns %08x\n", hres);
5895 ok(V_VT(&v2) == 0xff, "VariantChangeTypeEx changed dst variant\n");
5896 SysFreeString(bstr);
5897}
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
#define DISP_E_TYPEMISMATCH
Definition: winerror.h:2514

Referenced by START_TEST().

◆ test_ClearCustData()

static void test_ClearCustData ( void  )
static

Definition at line 5825 of file vartype.c.

5826{
5827 CUSTDATA ci;
5828 unsigned i;
5829
5830 ci.cCustData = NUM_CUST_ITEMS;
5831 ci.prgCustData = CoTaskMemAlloc( sizeof(CUSTDATAITEM) * NUM_CUST_ITEMS );
5832 for (i = 0; i < NUM_CUST_ITEMS; i++)
5833 VariantInit(&ci.prgCustData[i].varValue);
5834 ClearCustData(&ci);
5835 ok(!ci.cCustData && !ci.prgCustData, "ClearCustData didn't clear fields!\n");
5836}
void WINAPI ClearCustData(CUSTDATA *lpCust)
Definition: typelib.c:11635
#define NUM_CUST_ITEMS
Definition: vartype.c:5823

Referenced by START_TEST().

◆ test_EmptyChangeTypeEx()

static void test_EmptyChangeTypeEx ( void  )
static

Definition at line 5657 of file vartype.c.

5658{
5659 VARTYPE vt;
5660 LCID lcid;
5661
5663
5664 for (vt = VT_EMPTY; vt <= VT_BSTR_BLOB; vt++)
5665 {
5666 HRESULT hExpected, hres;
5667 VARIANTARG vSrc, vDst;
5668
5669 /* skip for undefined types */
5670 if ((vt == 15) || (vt > VT_VERSIONED_STREAM && vt < VT_BSTR_BLOB))
5671 continue;
5672
5673 switch (vt)
5674 {
5675 case VT_I8:
5676 case VT_UI8:
5677 if (has_i8)
5678 hExpected = S_OK;
5679 else
5680 hExpected = DISP_E_BADVARTYPE;
5681 break;
5682 case VT_RECORD:
5683 case VT_VARIANT:
5684 case VT_DISPATCH:
5685 case VT_UNKNOWN:
5686 case VT_ERROR:
5687 hExpected = DISP_E_TYPEMISMATCH;
5688 break;
5689 case VT_EMPTY:
5690 case VT_NULL:
5691 case VT_I2:
5692 case VT_I4:
5693 case VT_R4:
5694 case VT_R8:
5695 case VT_CY:
5696 case VT_DATE:
5697 case VT_BSTR:
5698 case VT_BOOL:
5699 case VT_DECIMAL:
5700 case VT_I1:
5701 case VT_UI1:
5702 case VT_UI2:
5703 case VT_UI4:
5704 case VT_INT:
5705 case VT_UINT:
5706 hExpected = S_OK;
5707 break;
5708 default:
5709 hExpected = DISP_E_BADVARTYPE;
5710 }
5711
5712 VariantInit(&vSrc);
5713 V_VT(&vSrc) = VT_EMPTY;
5714 memset(&vDst, 0, sizeof(vDst));
5715 V_VT(&vDst) = VT_NULL;
5716
5717 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, vt);
5718 ok(hres == hExpected, "change empty: vt %d expected 0x%08x, got 0x%08x, vt %d\n",
5719 vt, hExpected, hres, V_VT(&vDst));
5720 if (hres == S_OK)
5721 {
5722 ok(V_VT(&vDst) == vt, "change empty: vt %d, got %d\n", vt, V_VT(&vDst));
5723 VariantClear(&vDst);
5724 }
5725 }
5726}
unsigned short VARTYPE
Definition: compat.h:2254
@ VT_NULL
Definition: compat.h:2296
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_ERROR
Definition: compat.h:2305
@ VT_BSTR_BLOB
Definition: compat.h:2339
@ VT_VERSIONED_STREAM
Definition: compat.h:2338
@ VT_CY
Definition: compat.h:2301
@ VT_BOOL
Definition: compat.h:2306
@ VT_RECORD
Definition: compat.h:2326
@ VT_DISPATCH
Definition: compat.h:2304

Referenced by START_TEST().

◆ test_ErrorChangeTypeEx()

static void test_ErrorChangeTypeEx ( void  )
static

Definition at line 5616 of file vartype.c.

5617{
5618 HRESULT hres;
5619 VARIANTARG vSrc, vDst;
5620 VARTYPE vt;
5621 LCID lcid;
5622
5624
5625 for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
5626 {
5627 HRESULT hExpected = DISP_E_BADVARTYPE;
5628
5629 V_VT(&vSrc) = VT_ERROR;
5630 V_ERROR(&vSrc) = 1;
5631 VariantInit(&vDst);
5632 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, vt);
5633
5634 if (vt == VT_ERROR)
5635 hExpected = S_OK;
5636 else
5637 {
5638 if (vt == VT_I8 || vt == VT_UI8)
5639 {
5640 if (has_i8)
5641 hExpected = DISP_E_TYPEMISMATCH;
5642 }
5643 else if (vt == VT_RECORD)
5644 {
5645 hExpected = DISP_E_TYPEMISMATCH;
5646 }
5647 else if (vt <= VT_UINT && vt != (VARTYPE)15)
5648 hExpected = DISP_E_TYPEMISMATCH;
5649 }
5650
5651 ok(hres == hExpected,
5652 "change err: vt %d expected 0x%08x, got 0x%08x\n", vt, hExpected, hres);
5653 }
5654}
#define V_ERROR(A)
Definition: oleauto.h:241

Referenced by START_TEST().

◆ test_IDispatchChangeTypeEx()

static void test_IDispatchChangeTypeEx ( void  )
static

Definition at line 5565 of file vartype.c.

5566{
5567 HRESULT hres;
5568 VARIANTARG vSrc, vDst;
5569 LCID lcid;
5571 IDispatch* pd;
5572
5574 pd = &d.IDispatch_iface;
5575
5577
5578 /* NULL IDispatch -> IUnknown */
5579 V_VT(&vSrc) = VT_DISPATCH;
5580 V_DISPATCH(&vSrc) = NULL;
5581 VariantInit(&vDst);
5582 V_UNKNOWN(&vDst) = (void*)0xdeadbeef;
5583 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, VT_UNKNOWN);
5584 ok(hres == S_OK && V_VT(&vDst) == VT_UNKNOWN && V_UNKNOWN(&vDst) == NULL,
5585 "change unk(src,dst): expected 0x%08x,%d,%p, got 0x%08x,%d,%p\n",
5586 S_OK, VT_UNKNOWN, NULL, hres, V_VT(&vDst), V_UNKNOWN(&vDst));
5587
5588 V_VT(&vSrc) = VT_DISPATCH;
5589 V_DISPATCH(&vSrc) = pd;
5590
5591 /* =>IUnknown in place */
5592 hres = VariantChangeTypeEx(&vSrc, &vSrc, lcid, 0, VT_UNKNOWN);
5593 ok(hres == S_OK && d.ref == 1 &&
5594 V_VT(&vSrc) == VT_UNKNOWN && V_UNKNOWN(&vSrc) == (IUnknown*)pd,
5595 "change disp(src=src): expected 0x%08x,%d,%d,%p, got 0x%08x,%d,%d,%p\n",
5596 S_OK, 1, VT_UNKNOWN, pd, hres, d.ref, V_VT(&vSrc), V_UNKNOWN(&vSrc));
5597
5598 /* =>IUnknown */
5599 d.ref = 1;
5600 V_VT(&vSrc) = VT_DISPATCH;
5601 V_DISPATCH(&vSrc) = pd;
5602 VariantInit(&vDst);
5603 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, VT_UNKNOWN);
5604 /* Note vSrc is not cleared, as final refcount is 2 */
5605 ok(hres == S_OK && d.ref == 2 &&
5606 V_VT(&vDst) == VT_UNKNOWN && V_UNKNOWN(&vDst) == (IUnknown*)pd,
5607 "change disp(src,dst): expected 0x%08x,%d,%d,%p, got 0x%08x,%d,%d,%p\n",
5608 S_OK, 2, VT_UNKNOWN, pd, hres, d.ref, V_VT(&vDst), V_UNKNOWN(&vDst));
5609
5610 /* FIXME: Verify that VARIANT_NOVALUEPROP prevents conversion to integral
5611 * types. this requires that the xxxFromDisp tests work first.
5612 */
5613}
#define d
Definition: ke_i.h:81
static void init_test_dispatch(LONG ref, VARTYPE vt, DummyDispatch *dispatch)
Definition: vartype.c:392
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_DISPATCH(A)
Definition: oleauto.h:239

Referenced by START_TEST().

◆ test_IDispatchClear()

static void test_IDispatchClear ( void  )
static

Definition at line 5490 of file vartype.c.

5491{
5492 HRESULT hres;
5493 VARIANTARG v;
5495 IDispatch* pd;
5496
5498 pd = &d.IDispatch_iface;
5499
5500 /* As per IUnknown */
5501
5502 V_VT(&v) = VT_DISPATCH;
5503 V_DISPATCH(&v) = pd;
5504 hres = VariantClear(&v);
5505 ok(hres == S_OK && d.ref == 0 && V_VT(&v) == VT_EMPTY,
5506 "clear dispatch: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5507 S_OK, 0, VT_EMPTY, hres, d.ref, V_VT(&v));
5508
5509 d.ref = 1;
5511 V_DISPATCHREF(&v) = &pd;
5512 hres = VariantClear(&v);
5513 ok(hres == S_OK && d.ref == 1 && V_VT(&v) == VT_EMPTY,
5514 "clear dispatch: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5515 S_OK, 1, VT_EMPTY, hres, d.ref, V_VT(&v));
5516}
const GLdouble * v
Definition: gl.h:2040
#define V_DISPATCHREF(A)
Definition: oleauto.h:240

Referenced by START_TEST().

◆ test_IDispatchCopy()

static void test_IDispatchCopy ( void  )
static

Definition at line 5518 of file vartype.c.

5519{
5520 HRESULT hres;
5521 VARIANTARG vSrc, vDst;
5523 IDispatch* pd;
5524
5526 pd = &d.IDispatch_iface;
5527
5528 /* As per IUnknown */
5529
5530 VariantInit(&vDst);
5531 V_VT(&vSrc) = VT_DISPATCH;
5532 V_DISPATCH(&vSrc) = pd;
5533 hres = VariantCopy(&vDst, &vSrc);
5534 ok(hres == S_OK && d.ref == 2 && V_VT(&vDst) == VT_DISPATCH,
5535 "copy dispatch: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5536 S_OK, 2, VT_EMPTY, hres, d.ref, V_VT(&vDst));
5537
5538 VariantInit(&vDst);
5539 d.ref = 1;
5540 V_VT(&vSrc) = VT_DISPATCH|VT_BYREF;
5541 V_DISPATCHREF(&vSrc) = &pd;
5542 hres = VariantCopy(&vDst, &vSrc);
5543 ok(hres == S_OK && d.ref == 1 && V_VT(&vDst) == (VT_DISPATCH|VT_BYREF),
5544 "copy dispatch: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5545 S_OK, 1, VT_DISPATCH, hres, d.ref, V_VT(&vDst));
5546
5547 VariantInit(&vDst);
5548 d.ref = 1;
5549 V_VT(&vSrc) = VT_DISPATCH|VT_BYREF;
5550 V_DISPATCHREF(&vSrc) = &pd;
5551 hres = VariantCopyInd(&vDst, &vSrc);
5552 ok(hres == S_OK && d.ref == 2 && V_VT(&vDst) == VT_DISPATCH,
5553 "copy dispatch: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5554 S_OK, 2, VT_DISPATCH, hres, d.ref, V_VT(&vDst));
5555
5556 d.ref = 1;
5557 V_VT(&vSrc) = VT_DISPATCH|VT_BYREF;
5558 V_DISPATCHREF(&vSrc) = &pd;
5559 hres = VariantCopyInd(&vSrc, &vSrc);
5560 ok(hres == S_OK && d.ref == 2 && V_VT(&vSrc) == VT_DISPATCH,
5561 "copy dispatch: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5562 S_OK, 2, VT_DISPATCH, hres, d.ref, V_VT(&vSrc));
5563}

Referenced by START_TEST().

◆ test_IUnknownChangeTypeEx()

static void test_IUnknownChangeTypeEx ( void  )
static

Definition at line 5410 of file vartype.c.

5411{
5412 HRESULT hres;
5413 VARIANTARG vSrc, vDst;
5414 LCID lcid;
5415 VARTYPE vt;
5417 IUnknown* pu;
5418
5420 pu = (IUnknown*)&u.IDispatch_iface;
5421
5423
5424 /* NULL IUnknown -> IDispatch */
5425 V_VT(&vSrc) = VT_UNKNOWN;
5426 V_UNKNOWN(&vSrc) = NULL;
5427 VariantInit(&vDst);
5428 V_DISPATCH(&vDst) = (void*)0xdeadbeef;
5429 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, VT_DISPATCH);
5430 ok(hres == S_OK && V_VT(&vDst) == VT_DISPATCH && V_DISPATCH(&vDst) == NULL,
5431 "change unk(src,dst): expected 0x%08x,%d,%p, got 0x%08x,%d,%p\n",
5432 S_OK, VT_DISPATCH, NULL, hres, V_VT(&vDst), V_DISPATCH(&vDst));
5433
5434 V_VT(&vSrc) = VT_UNKNOWN;
5435 V_UNKNOWN(&vSrc) = pu;
5436
5437 /* =>IDispatch in place */
5438 hres = VariantChangeTypeEx(&vSrc, &vSrc, lcid, 0, VT_DISPATCH);
5439 ok(hres == S_OK && u.ref == 1 &&
5440 V_VT(&vSrc) == VT_DISPATCH && V_DISPATCH(&vSrc) == (IDispatch*)pu,
5441 "change unk(src=src): expected 0x%08x,%d,%d,%p, got 0x%08x,%d,%d,%p\n",
5442 S_OK, 1, VT_DISPATCH, pu, hres, u.ref, V_VT(&vSrc), V_DISPATCH(&vSrc));
5443
5444 /* =>IDispatch */
5445 u.ref = 1;
5446 V_VT(&vSrc) = VT_UNKNOWN;
5447 V_UNKNOWN(&vSrc) = pu;
5448 VariantInit(&vDst);
5449 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, VT_UNKNOWN);
5450 /* Note vSrc is not cleared, as final refcount is 2 */
5451 ok(hres == S_OK && u.ref == 2 &&
5452 V_VT(&vDst) == VT_UNKNOWN && V_UNKNOWN(&vDst) == pu,
5453 "change unk(src,dst): expected 0x%08x,%d,%d,%p, got 0x%08x,%d,%d,%p\n",
5454 S_OK, 2, VT_UNKNOWN, pu, hres, u.ref, V_VT(&vDst), V_UNKNOWN(&vDst));
5455
5456 /* Can't change unknown to anything else */
5457 for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
5458 {
5459 HRESULT hExpected = DISP_E_BADVARTYPE;
5460
5461 V_VT(&vSrc) = VT_UNKNOWN;
5462 V_UNKNOWN(&vSrc) = pu;
5463 VariantInit(&vDst);
5464
5465 if (vt == VT_UNKNOWN || vt == VT_DISPATCH || vt == VT_EMPTY || vt == VT_NULL)
5466 hExpected = S_OK;
5467 else
5468 {
5469 if (vt == VT_I8 || vt == VT_UI8)
5470 {
5471 if (has_i8)
5472 hExpected = DISP_E_TYPEMISMATCH;
5473 }
5474 else if (vt == VT_RECORD)
5475 {
5476 hExpected = DISP_E_TYPEMISMATCH;
5477 }
5478 else if (vt >= VT_I2 && vt <= VT_UINT && vt != (VARTYPE)15)
5479 hExpected = DISP_E_TYPEMISMATCH;
5480 }
5481
5482 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, vt);
5483 ok(hres == hExpected,
5484 "change unk(badvar): vt %d expected 0x%08x, got 0x%08x\n",
5485 vt, hExpected, hres);
5486 }
5487}
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 * u
Definition: glfuncs.h:240

Referenced by START_TEST().

◆ test_IUnknownClear()

static void test_IUnknownClear ( void  )
static

Definition at line 5333 of file vartype.c.

5334{
5335 HRESULT hres;
5336 VARIANTARG v;
5338 IUnknown* pu;
5339
5341 pu = (IUnknown*)&u.IDispatch_iface;
5342
5343 /* Test that IUnknown_Release is called on by-value */
5344 V_VT(&v) = VT_UNKNOWN;
5345 V_UNKNOWN(&v) = (IUnknown*)&u.IDispatch_iface;
5346 hres = VariantClear(&v);
5347 ok(hres == S_OK && u.ref == 0 && V_VT(&v) == VT_EMPTY,
5348 "clear unknown: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5349 S_OK, 0, VT_EMPTY, hres, u.ref, V_VT(&v));
5350
5351 /* But not when clearing a by-reference*/
5352 u.ref = 1;
5354 V_UNKNOWNREF(&v) = &pu;
5355 hres = VariantClear(&v);
5356 ok(hres == S_OK && u.ref == 1 && V_VT(&v) == VT_EMPTY,
5357 "clear dispatch: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5358 S_OK, 1, VT_EMPTY, hres, u.ref, V_VT(&v));
5359}
#define V_UNKNOWNREF(A)
Definition: oleauto.h:282

Referenced by START_TEST().

◆ test_IUnknownCopy()

static void test_IUnknownCopy ( void  )
static

Definition at line 5361 of file vartype.c.

5362{
5363 HRESULT hres;
5364 VARIANTARG vSrc, vDst;
5366 IUnknown* pu;
5367
5369 pu = (IUnknown*)&u.IDispatch_iface;
5370
5371 /* AddRef is called on by-value copy */
5372 VariantInit(&vDst);
5373 V_VT(&vSrc) = VT_UNKNOWN;
5374 V_UNKNOWN(&vSrc) = pu;
5375 hres = VariantCopy(&vDst, &vSrc);
5376 ok(hres == S_OK && u.ref == 2 && V_VT(&vDst) == VT_UNKNOWN,
5377 "copy unknown: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5378 S_OK, 2, VT_EMPTY, hres, u.ref, V_VT(&vDst));
5379
5380 /* AddRef is skipped on copy of by-reference IDispatch */
5381 VariantInit(&vDst);
5382 u.ref = 1;
5383 V_VT(&vSrc) = VT_UNKNOWN|VT_BYREF;
5384 V_UNKNOWNREF(&vSrc) = &pu;
5385 hres = VariantCopy(&vDst, &vSrc);
5386 ok(hres == S_OK && u.ref == 1 && V_VT(&vDst) == (VT_UNKNOWN|VT_BYREF),
5387 "copy unknown: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5388 S_OK, 1, VT_DISPATCH, hres, u.ref, V_VT(&vDst));
5389
5390 /* AddRef is called copying by-reference IDispatch with indirection */
5391 VariantInit(&vDst);
5392 u.ref = 1;
5393 V_VT(&vSrc) = VT_UNKNOWN|VT_BYREF;
5394 V_UNKNOWNREF(&vSrc) = &pu;
5395 hres = VariantCopyInd(&vDst, &vSrc);
5396 ok(hres == S_OK && u.ref == 2 && V_VT(&vDst) == VT_UNKNOWN,
5397 "copy unknown: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5398 S_OK, 2, VT_DISPATCH, hres, u.ref, V_VT(&vDst));
5399
5400 /* Indirection in place also calls AddRef */
5401 u.ref = 1;
5402 V_VT(&vSrc) = VT_UNKNOWN|VT_BYREF;
5403 V_UNKNOWNREF(&vSrc) = &pu;
5404 hres = VariantCopyInd(&vSrc, &vSrc);
5405 ok(hres == S_OK && u.ref == 2 && V_VT(&vSrc) == VT_UNKNOWN,
5406 "copy unknown: expected 0x%08x, %d, %d, got 0x%08x, %d, %d\n",
5407 S_OK, 2, VT_DISPATCH, hres, u.ref, V_VT(&vSrc));
5408}

Referenced by START_TEST().

◆ test_NullByRef()

static void test_NullByRef ( void  )
static

Definition at line 5838 of file vartype.c.

5839{
5840 VARIANT v1, v2;
5841 HRESULT hRes;
5842
5843 VariantInit(&v1);
5844 VariantInit(&v2);
5846 V_BYREF(&v1) = 0;
5847
5848 hRes = VariantChangeTypeEx(&v2, &v1, 0, 0, VT_I4);
5849 ok(hRes == DISP_E_TYPEMISMATCH, "VariantChangeTypeEx should return DISP_E_TYPEMISMATCH\n");
5850
5851 VariantClear(&v1);
5853 V_BYREF(&v1) = 0;
5854 V_VT(&v2) = VT_I4;
5855 V_I4(&v2) = 123;
5856
5857 hRes = VariantChangeTypeEx(&v2, &v1, 0, 0, VT_VARIANT);
5858 ok(hRes == DISP_E_TYPEMISMATCH, "VariantChangeTypeEx should return DISP_E_TYPEMISMATCH\n");
5859 ok(V_VT(&v2) == VT_I4 && V_I4(&v2) == 123, "VariantChangeTypeEx shouldn't change pvargDest\n");
5860
5861 hRes = VariantChangeTypeEx(&v2, &v1, 0, 0, VT_BYREF|VT_I4);
5862 ok(hRes == DISP_E_TYPEMISMATCH, "VariantChangeTypeEx should return DISP_E_TYPEMISMATCH\n");
5863
5864 hRes = VariantChangeTypeEx(&v2, &v1, 0, 0, 0x3847);
5865 ok(hRes == DISP_E_BADVARTYPE, "VariantChangeTypeEx should return DISP_E_BADVARTYPE\n");
5866}
#define V_BYREF(A)
Definition: oleauto.h:228

Referenced by START_TEST().

◆ test_NullChangeTypeEx()

static void test_NullChangeTypeEx ( void  )
static

Definition at line 5729 of file vartype.c.

5730{
5731 VARTYPE vt;
5732 LCID lcid;
5733
5735
5736 for (vt = VT_EMPTY; vt <= VT_BSTR_BLOB; vt++)
5737 {
5738 VARIANTARG vSrc, vDst;
5739 HRESULT hExpected, hres;
5740
5741 /* skip for undefined types */
5742 if ((vt == 15) || (vt > VT_VERSIONED_STREAM && vt < VT_BSTR_BLOB))
5743 continue;
5744
5745 switch (vt)
5746 {
5747 case VT_I8:
5748 case VT_UI8:
5749 if (has_i8)
5750 hExpected = DISP_E_TYPEMISMATCH;
5751 else
5752 hExpected = DISP_E_BADVARTYPE;
5753 break;
5754 case VT_NULL:
5755 hExpected = S_OK;
5756 break;
5757 case VT_EMPTY:
5758 case VT_I2:
5759 case VT_I4:
5760 case VT_R4:
5761 case VT_R8:
5762 case VT_CY:
5763 case VT_DATE:
5764 case VT_BSTR:
5765 case VT_DISPATCH:
5766 case VT_ERROR:
5767 case VT_BOOL:
5768 case VT_VARIANT:
5769 case VT_UNKNOWN:
5770 case VT_DECIMAL:
5771 case VT_I1:
5772 case VT_UI1:
5773 case VT_UI2:
5774 case VT_UI4:
5775 case VT_INT:
5776 case VT_UINT:
5777 case VT_RECORD:
5778 hExpected = DISP_E_TYPEMISMATCH;
5779 break;
5780 default:
5781 hExpected = DISP_E_BADVARTYPE;
5782 }
5783
5784 VariantInit(&vSrc);
5785 V_VT(&vSrc) = VT_NULL;
5786 memset(&vDst, 0, sizeof(vDst));
5787 V_VT(&vDst) = VT_EMPTY;
5788
5789 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, vt);
5790 ok(hres == hExpected, "change null: vt %d expected 0x%08x, got 0x%08x, vt %d\n",
5791 vt, hExpected, hres, V_VT(&vDst));
5792
5793 /* should work only for VT_NULL -> VT_NULL case */
5794 if (hres == S_OK)
5795 ok(V_VT(&vDst) == VT_NULL, "change null: VT_NULL expected 0x%08x, got 0x%08x, vt %d\n",
5796 hExpected, hres, V_VT(&vDst));
5797 else
5798 ok(V_VT(&vDst) == VT_EMPTY, "change null: vt %d expected 0x%08x, got 0x%08x, vt %d\n",
5799 vt, hExpected, hres, V_VT(&vDst));
5800 }
5801}

Referenced by START_TEST().

◆ test_recinfo()

static void test_recinfo ( void  )
static

Definition at line 5978 of file vartype.c.

5979{
5980 static const WCHAR testW[] = {'t','e','s','t',0};
5981 static WCHAR teststructW[] = {'t','e','s','t','_','s','t','r','u','c','t',0};
5982 static WCHAR teststruct2W[] = {'t','e','s','t','_','s','t','r','u','c','t','2',0};
5983 static WCHAR teststruct3W[] = {'t','e','s','t','_','s','t','r','u','c','t','3',0};
5984 WCHAR filenameW[MAX_PATH], filename2W[MAX_PATH];
5985 ITypeInfo *typeinfo, *typeinfo2, *typeinfo3;
5986 IRecordInfo *recinfo, *recinfo2, *recinfo3;
5987 struct test_struct teststruct, testcopy;
5988 ITypeLib *typelib, *typelib2;
5989 const char *filename;
5991 TYPEATTR *attr;
5992 MEMBERID memid;
5993 UINT16 found;
5994 HRESULT hr;
5995 ULONG size;
5996 BOOL ret;
5997
6001 ok(hr == S_OK, "got 0x%08x\n", hr);
6002
6004 MultiByteToWideChar(CP_ACP, 0, filename, -1, filename2W, MAX_PATH);
6005 hr = LoadTypeLibEx(filename2W, REGKIND_NONE, &typelib2);
6006 ok(hr == S_OK, "got 0x%08x\n", hr);
6007
6008 typeinfo = NULL;
6009 found = 1;
6010 hr = ITypeLib_FindName(typelib, teststructW, 0, &typeinfo, &memid, &found);
6011 ok(hr == S_OK, "got 0x%08x\n",