ReactOS 0.4.16-dev-197-g92996da
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:20
#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:91
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:220
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:202
#define S1(x)
Definition: test.h:221
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:168
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: locale.c:1211
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1230
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
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
static const WCHAR testW[]
Definition: jsregexp.c:44
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 str1, LPCSTR str2)
Definition: locale.c:4195
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", hr);
6012 ok(typeinfo != NULL, "got %p\n", typeinfo);
6013 hr = ITypeInfo_GetTypeAttr(typeinfo, &attr);
6014 ok(hr == S_OK, "got 0x%08x\n", hr);
6015 ok(IsEqualGUID(&attr->guid, &UUID_test_struct), "got %s\n", wine_dbgstr_guid(&attr->guid));
6016 ok(attr->typekind == TKIND_RECORD, "got %d\n", attr->typekind);
6017
6018 typeinfo2 = NULL;
6019 found = 1;
6020 hr = ITypeLib_FindName(typelib, teststruct2W, 0, &typeinfo2, &memid, &found);
6021 ok(hr == S_OK, "got 0x%08x\n", hr);
6022 ok(typeinfo2 != NULL, "got %p\n", typeinfo2);
6023
6024 typeinfo3 = NULL;
6025 found = 1;
6026 hr = ITypeLib_FindName(typelib2, teststruct3W, 0, &typeinfo3, &memid, &found);
6027 ok(hr == S_OK, "got 0x%08x\n", hr);
6028 ok(typeinfo3 != NULL, "got %p\n", typeinfo3);
6029
6031 ok(hr == S_OK, "got 0x%08x\n", hr);
6032
6033 hr = GetRecordInfoFromTypeInfo(typeinfo2, &recinfo2);
6034 ok(hr == S_OK, "got 0x%08x\n", hr);
6035
6036 hr = GetRecordInfoFromTypeInfo(typeinfo3, &recinfo3);
6037 ok(hr == S_OK, "got 0x%08x\n", hr);
6038
6039 /* IsMatchingType, these two records only differ in GUIDs */
6040 ret = IRecordInfo_IsMatchingType(recinfo, recinfo2);
6041 ok(!ret, "got %d\n", ret);
6042
6043 /* these two have same GUIDs, but different set of fields */
6044 ret = IRecordInfo_IsMatchingType(recinfo2, recinfo3);
6045 ok(ret, "got %d\n", ret);
6046
6047 IRecordInfo_Release(recinfo3);
6048 ITypeInfo_Release(typeinfo3);
6049 IRecordInfo_Release(recinfo2);
6050 ITypeInfo_Release(typeinfo2);
6051
6052 size = 0;
6053 hr = IRecordInfo_GetSize(recinfo, &size);
6054 ok(hr == S_OK, "got 0x%08x\n", hr);
6055 ok(size == sizeof(struct test_struct), "got size %d\n", size);
6056 ok(attr->cbSizeInstance == sizeof(struct test_struct), "got instance size %d\n", attr->cbSizeInstance);
6057 ITypeInfo_ReleaseTypeAttr(typeinfo, attr);
6058
6059 /* RecordInit() */
6060 teststruct.hr = E_FAIL;
6061 teststruct.b = 0x1;
6062 teststruct.disp = (void*)0xdeadbeef;
6063 teststruct.bstr = (void*)0xdeadbeef;
6064
6065 hr = IRecordInfo_RecordInit(recinfo, &teststruct);
6066 ok(hr == S_OK, "got 0x%08x\n", hr);
6067 ok(teststruct.hr == 0, "got 0x%08x\n", teststruct.hr);
6068 ok(teststruct.b == 0, "got 0x%08x\n", teststruct.b);
6069 ok(teststruct.disp == NULL, "got %p\n", teststruct.disp);
6070 ok(teststruct.bstr == NULL, "got %p\n", teststruct.bstr);
6071
6073
6074 /* RecordCopy(), interface field reference increased */
6075 teststruct.hr = S_FALSE;
6076 teststruct.b = VARIANT_TRUE;
6077 teststruct.disp = &dispatch.IDispatch_iface;
6078 teststruct.bstr = SysAllocString(testW);
6079 memset(&testcopy, 0, sizeof(testcopy));
6080 hr = IRecordInfo_RecordCopy(recinfo, &teststruct, &testcopy);
6081 ok(hr == S_OK, "got 0x%08x\n", hr);
6082 ok(testcopy.hr == S_FALSE, "got 0x%08x\n", testcopy.hr);
6083 ok(testcopy.b == VARIANT_TRUE, "got %d\n", testcopy.b);
6084 ok(testcopy.disp == teststruct.disp, "got %p\n", testcopy.disp);
6085 ok(dispatch.ref == 11, "got %d\n", dispatch.ref);
6086 ok(testcopy.bstr != teststruct.bstr, "got %p\n", testcopy.bstr);
6087 ok(!lstrcmpW(testcopy.bstr, teststruct.bstr), "got %s, %s\n", wine_dbgstr_w(testcopy.bstr), wine_dbgstr_w(teststruct.bstr));
6088
6089 /* RecordClear() */
6090 hr = IRecordInfo_RecordClear(recinfo, &teststruct);
6091 ok(hr == S_OK, "got 0x%08x\n", hr);
6092 ok(teststruct.bstr == NULL, "got %p\n", teststruct.bstr);
6093 hr = IRecordInfo_RecordClear(recinfo, &testcopy);
6094 ok(hr == S_OK, "got 0x%08x\n", hr);
6095 ok(testcopy.bstr == NULL, "got %p\n", testcopy.bstr);
6096
6097 /* now the destination contains the interface pointer */
6098 memset(&testcopy, 0, sizeof(testcopy));
6099 testcopy.disp = &dispatch.IDispatch_iface;
6100 dispatch.ref = 10;
6101
6102 hr = IRecordInfo_RecordCopy(recinfo, &teststruct, &testcopy);
6103 ok(hr == S_OK, "got 0x%08x\n", hr);
6104 ok(dispatch.ref == 9, "got %d\n", dispatch.ref);
6105
6106 IRecordInfo_Release(recinfo);
6107
6108 ITypeInfo_Release(typeinfo);
6109 ITypeLib_Release(typelib2);
6110 ITypeLib_Release(typelib);
6112 DeleteFileW(filename2W);
6113}
unsigned short UINT16
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
HRESULT WINAPI LoadTypeLibEx(LPCOLESTR szFile, REGKIND regkind, ITypeLib **pptLib)
Definition: typelib.c:473
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
#define wine_dbgstr_w
Definition: kernel32.h:34
static const WCHAR filenameW[]
Definition: amstream.c:41
static const char * create_test_typelib(int res_no)
Definition: vartype.c:5969
@ REGKIND_NONE
Definition: oleauto.h:927
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo *pTI, IRecordInfo **ppRecInfo)
Definition: recinfo.c:625
Definition: cookie.c:202
int ret
@ TKIND_RECORD
Definition: widltypes.h:220
#define S_FALSE
Definition: winerror.h:2357

Referenced by START_TEST().

◆ test_SysAllocString()

static void test_SysAllocString ( void  )
static

Definition at line 4927 of file vartype.c.

4928{
4929 const OLECHAR szTest[5] = { 'T','e','s','t','\0' };
4930 BSTR str;
4931
4933 ok (str == NULL, "Expected NULL, got %p\n", str);
4934
4935 str = SysAllocString(szTest);
4936 ok (str != NULL, "Expected non-NULL\n");
4937 if (str)
4938 {
4939 LPINTERNAL_BSTR bstr = Get(str);
4941 int align = sizeof(void *);
4942
4943 ok (bstr->dwLen == 8, "Expected 8, got %d\n", bstr->dwLen);
4944 ok (!lstrcmpW(bstr->szString, szTest), "String different\n");
4945 ok ((p & ~(align-1)) == p, "Not aligned to %d\n", align);
4947 }
4948}
WCHAR OLECHAR
Definition: compat.h:2292
int align(int length, int align)
Definition: dsound8.c:36
GLfloat GLfloat p
Definition: glext.h:8902
#define DWORD_PTR
Definition: treelist.c:76

Referenced by START_TEST().

◆ test_SysAllocStringByteLen()

static void test_SysAllocStringByteLen ( void  )
static

Definition at line 4985 of file vartype.c.

4986{
4987 const OLECHAR szTest[10] = { 'T','e','s','t','\0' };
4988 const CHAR szTestA[6] = { 'T','e','s','t','\0','?' };
4989 char *buf;
4990 BSTR str;
4991 int i;
4992
4993 if (sizeof(void *) == 4) /* not limited to 0x80000000 on Win64 */
4994 {
4995 str = SysAllocStringByteLen(szTestA, 0x80000000);
4996 ok (str == NULL, "Expected NULL, got %p\n", str);
4997 }
4998
4999 str = SysAllocStringByteLen(szTestA, 0xffffffff);
5000 ok (str == NULL, "Expected NULL, got %p\n", str);
5001
5003 ok (str != NULL, "Expected non-NULL\n");
5004 if (str)
5005 {
5006 LPINTERNAL_BSTR bstr = Get(str);
5007
5008 ok (bstr->dwLen == 0, "Expected 0, got %d\n", bstr->dwLen);
5009 ok (!bstr->szString[0], "String not empty\n");
5011 }
5012
5013 str = SysAllocStringByteLen(szTestA, 4);
5014 ok (str != NULL, "Expected non-NULL\n");
5015 if (str)
5016 {
5017 LPINTERNAL_BSTR bstr = Get(str);
5018
5019 ok (bstr->dwLen == 4, "Expected 4, got %d\n", bstr->dwLen);
5020 ok (!lstrcmpA((LPCSTR)bstr->szString, szTestA), "String different\n");
5022 }
5023
5024 /* Odd lengths are allocated rounded up, but truncated at the right position */
5025 str = SysAllocStringByteLen(szTestA, 3);
5026 ok (str != NULL, "Expected non-NULL\n");
5027 if (str)
5028 {
5029 const CHAR szTestTruncA[4] = { 'T','e','s','\0' };
5030 LPINTERNAL_BSTR bstr = Get(str);
5031
5032 ok (bstr->dwLen == 3, "Expected 3, got %d\n", bstr->dwLen);
5033 ok (!lstrcmpA((LPCSTR)bstr->szString, szTestTruncA), "String different\n");
5034 ok (!bstr->szString[2], "String not terminated\n");
5036 }
5037
5038 str = SysAllocStringByteLen((LPCSTR)szTest, 8);
5039 ok (str != NULL, "Expected non-NULL\n");
5040 if (str)
5041 {
5042 LPINTERNAL_BSTR bstr = Get(str);
5043
5044 ok (bstr->dwLen == 8, "Expected 8, got %d\n", bstr->dwLen);
5045 ok (!lstrcmpW(bstr->szString, szTest), "String different\n");
5047 }
5048
5049 /* Make sure terminating null is aligned properly */
5050 buf = HeapAlloc(GetProcessHeap(), 0, 1025);
5051 ok (buf != NULL, "Expected non-NULL\n");
5052 for (i = 0; i < 1024; i++)
5053 {
5054 LPINTERNAL_BSTR bstr;
5055
5057 ok (str != NULL, "Expected non-NULL\n");
5058 bstr = Get(str);
5059 ok (bstr->dwLen == i, "Expected %d, got %d\n", i, bstr->dwLen);
5060 ok (!bstr->szString[(i+sizeof(WCHAR)-1)/sizeof(WCHAR)], "String not terminated\n");
5062
5063 memset(buf, 0xaa, 1025);
5065 ok (str != NULL, "Expected non-NULL\n");
5066 bstr = Get(str);
5067 ok (bstr->dwLen == i, "Expected %d, got %d\n", i, bstr->dwLen);
5068 buf[i] = 0;
5069 ok (!lstrcmpA((LPCSTR)bstr->szString, buf), "String different\n");
5070 ok (!bstr->szString[(i+sizeof(WCHAR)-1)/sizeof(WCHAR)], "String not terminated\n");
5072 }
5074}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

Referenced by START_TEST().

◆ test_SysAllocStringLen()

static void test_SysAllocStringLen ( void  )
static

Definition at line 4950 of file vartype.c.

4951{
4952 const OLECHAR szTest[5] = { 'T','e','s','t','\0' };
4953 BSTR str;
4954
4955 /* Very early native dlls do not limit the size of strings, so skip this test */
4956 if (0)
4957 {
4958 str = SysAllocStringLen(szTest, 0x80000000);
4959 ok (str == NULL, "Expected NULL, got %p\n", str);
4960 }
4961
4963 ok (str != NULL, "Expected non-NULL\n");
4964 if (str)
4965 {
4966 LPINTERNAL_BSTR bstr = Get(str);
4967
4968 ok (bstr->dwLen == 0, "Expected 0, got %d\n", bstr->dwLen);
4969 ok (!bstr->szString[0], "String not empty\n");
4971 }
4972
4973 str = SysAllocStringLen(szTest, 4);
4974 ok (str != NULL, "Expected non-NULL\n");
4975 if (str)
4976 {
4977 LPINTERNAL_BSTR bstr = Get(str);
4978
4979 ok (bstr->dwLen == 8, "Expected 8, got %d\n", bstr->dwLen);
4980 ok (!lstrcmpW(bstr->szString, szTest), "String different\n");
4982 }
4983}

Referenced by START_TEST().

◆ test_SysReAllocString()

static void test_SysReAllocString ( void  )
static

Definition at line 5076 of file vartype.c.

5077{
5078 const OLECHAR szTest[5] = { 'T','e','s','t','\0' };
5079 const OLECHAR szSmaller[2] = { 'x','\0' };
5080 const OLECHAR szLarger[7] = { 'L','a','r','g','e','r','\0' };
5081 BSTR str;
5082
5083 str = SysAllocStringLen(szTest, 4);
5084 ok (str != NULL, "Expected non-NULL\n");
5085 if (str)
5086 {
5087 LPINTERNAL_BSTR bstr;
5088 int changed;
5089
5090 bstr = Get(str);
5091 ok (bstr->dwLen == 8, "Expected 8, got %d\n", bstr->dwLen);
5092 ok (!lstrcmpW(bstr->szString, szTest), "String different\n");
5093
5094 changed = SysReAllocString(&str, szSmaller);
5095 ok (changed == 1, "Expected 1, got %d\n", changed);
5096 /* Vista creates a new string, but older versions reuse the existing string. */
5097 /*ok (str == oldstr, "Created new string\n");*/
5098 bstr = Get(str);
5099 ok (bstr->dwLen == 2, "Expected 2, got %d\n", bstr->dwLen);
5100 ok (!lstrcmpW(bstr->szString, szSmaller), "String different\n");
5101
5102 changed = SysReAllocString(&str, szLarger);
5103 ok (changed == 1, "Expected 1, got %d\n", changed);
5104 /* Early versions always make new strings rather than resizing */
5105 /* ok (str == oldstr, "Created new string\n"); */
5106 bstr = Get(str);
5107 ok (bstr->dwLen == 12, "Expected 12, got %d\n", bstr->dwLen);
5108 ok (!lstrcmpW(bstr->szString, szLarger), "String different\n");
5109
5111 }
5112}
INT WINAPI SysReAllocString(LPBSTR old, LPCOLESTR str)
Definition: oleaut.c:467

Referenced by START_TEST().

◆ test_SysReAllocStringLen()

static void test_SysReAllocStringLen ( void  )
static

Definition at line 5114 of file vartype.c.

5115{
5116 const OLECHAR szTest[5] = { 'T','e','s','t','\0' };
5117 const OLECHAR szSmaller[2] = { 'x','\0' };
5118 const OLECHAR szLarger[7] = { 'L','a','r','g','e','r','\0' };
5119 BSTR str;
5120
5121 str = SysAllocStringLen(szTest, 4);
5122 ok (str != NULL, "Expected non-NULL\n");
5123 if (str)
5124 {
5125 LPINTERNAL_BSTR bstr;
5126 int changed;
5127
5128 bstr = Get(str);
5129 ok (bstr->dwLen == 8, "Expected 8, got %d\n", bstr->dwLen);
5130 ok (!lstrcmpW(bstr->szString, szTest), "String different\n");
5131
5132 changed = SysReAllocStringLen(&str, szSmaller, 1);
5133 ok (changed == 1, "Expected 1, got %d\n", changed);
5134 /* Vista creates a new string, but older versions reuse the existing string. */
5135 /*ok (str == oldstr, "Created new string\n");*/
5136 bstr = Get(str);
5137 ok (bstr->dwLen == 2, "Expected 2, got %d\n", bstr->dwLen);
5138 ok (!lstrcmpW(bstr->szString, szSmaller), "String different\n");
5139
5140 changed = SysReAllocStringLen(&str, szLarger, 6);
5141 ok (changed == 1, "Expected 1, got %d\n", changed);
5142 /* Early versions always make new strings rather than resizing */
5143 /* ok (str == oldstr, "Created new string\n"); */
5144 bstr = Get(str);
5145 ok (bstr->dwLen == 12, "Expected 12, got %d\n", bstr->dwLen);
5146 ok (!lstrcmpW(bstr->szString, szLarger), "String different\n");
5147
5148 changed = SysReAllocStringLen(&str, str, 6);
5149 ok (changed == 1, "Expected 1, got %d\n", changed);
5150
5152 }
5153
5154 /* Windows always returns null terminated strings */
5155 str = SysAllocStringLen(szTest, 4);
5156 ok (str != NULL, "Expected non-NULL\n");
5157 if (str)
5158 {
5159 const int CHUNK_SIZE = 64;
5160 const int STRING_SIZE = 24;
5161 int changed;
5162 changed = SysReAllocStringLen(&str, NULL, CHUNK_SIZE);
5163 ok (changed == 1, "Expected 1, got %d\n", changed);
5164 ok (str != NULL, "Expected non-NULL\n");
5165 if (str)
5166 {
5167 BSTR oldstr = str;
5168
5169 /* Filling string */
5170 memset (str, 0xAB, CHUNK_SIZE * sizeof (OLECHAR));
5171 /* Checking null terminator */
5172 changed = SysReAllocStringLen(&str, NULL, STRING_SIZE);
5173 ok (changed == 1, "Expected 1, got %d\n", changed);
5174 ok (str != NULL, "Expected non-NULL\n");
5175 if (str)
5176 {
5177 ok (str == oldstr, "Expected reuse of the old string memory\n");
5178 ok (str[STRING_SIZE] == 0,
5179 "Expected null terminator, got 0x%04X\n", str[STRING_SIZE]);
5181 }
5182 }
5183 }
5184
5185 /* Some Windows applications use the same pointer for pbstr and psz */
5186 str = SysAllocStringLen(szTest, 4);
5187 ok(str != NULL, "Expected non-NULL\n");
5188 if(str)
5189 {
5190 SysReAllocStringLen(&str, str, 1000000);
5191 ok(SysStringLen(str)==1000000, "Incorrect string length\n");
5192 ok(!memcmp(szTest, str, 4*sizeof(WCHAR)), "Incorrect string returned\n");
5193
5195 }
5196}
#define CHUNK_SIZE
Definition: sha256.c:8
int WINAPI SysReAllocStringLen(BSTR *old, const OLECHAR *str, unsigned int len)
Definition: oleaut.c:383

Referenced by START_TEST().

◆ test_SysStringByteLen()

static void test_SysStringByteLen ( void  )
static

Definition at line 4916 of file vartype.c.

4917{
4918 INTERNAL_BSTR bstr;
4919 BSTR str = GetBSTR(&bstr);
4920
4921 bstr.dwLen = 0;
4922 ok (SysStringByteLen(str) == 0, "Expected dwLen 0, got %d\n", SysStringByteLen(str));
4923 bstr.dwLen = 2;
4924 ok (SysStringByteLen(str) == 2, "Expected dwLen 2, got %d\n", SysStringByteLen(str));
4925}
static BSTR GetBSTR(const LPINTERNAL_BSTR bstr)
Definition: vartype.c:4900
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:215

Referenced by START_TEST().

◆ test_SysStringLen()

static void test_SysStringLen ( void  )
static

Definition at line 4905 of file vartype.c.

4906{
4907 INTERNAL_BSTR bstr;
4908 BSTR str = GetBSTR(&bstr);
4909
4910 bstr.dwLen = 0;
4911 ok (SysStringLen(str) == 0, "Expected dwLen 0, got %d\n", SysStringLen(str));
4912 bstr.dwLen = 2;
4913 ok (SysStringLen(str) == 1, "Expected dwLen 1, got %d\n", SysStringLen(str));
4914}

Referenced by START_TEST().

◆ test_UintChangeTypeEx()

static void test_UintChangeTypeEx ( void  )
static

Definition at line 5805 of file vartype.c.

5806{
5807 HRESULT hres;
5808 VARIANTARG vSrc, vDst;
5809 LCID lcid;
5810
5812
5813 /* Converting a VT_UINT to a VT_INT does not check for overflow */
5814 V_VT(&vDst) = VT_EMPTY;
5815 V_VT(&vSrc) = VT_UINT;
5816 V_UI4(&vSrc) = -1;
5817 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, VT_I4);
5818 ok(hres == S_OK && V_VT(&vDst) == VT_I4 && V_I4(&vDst) == -1,
5819 "change uint: Expected %d,0x%08x,%d got %d,0x%08x,%d\n",
5820 VT_I4, S_OK, -1, V_VT(&vDst), hres, V_I4(&vDst));
5821}

Referenced by START_TEST().

◆ test_VarBoolChangeTypeEx()

static void test_VarBoolChangeTypeEx ( void  )
static

Definition at line 4501 of file vartype.c.

4502{
4503 static const WCHAR szTrue[] = { 'T','r','u','e','\0' };
4504 static const WCHAR szFalse[] = { 'F','a','l','s','e','\0' };
4505 static const WCHAR szFaux[] = { 'F','a','u','x','\0' };
4506 HRESULT hres;
4508 VARIANTARG vSrc, vDst;
4509 LCID lcid;
4510
4511 in = 1;
4512
4515
4516 /* The common tests convert to a number. Try the different flags */
4518
4519 V_VT(&vSrc) = VT_BOOL;
4520 V_BOOL(&vSrc) = 1;
4521
4522 BOOL_STR(VARIANT_ALPHABOOL, szTrue);
4523 V_BOOL(&vSrc) = 0;
4524 BOOL_STR(VARIANT_ALPHABOOL, szFalse);
4525
4526 if (has_locales)
4527 {
4529
4530 /* VARIANT_ALPHABOOL is always English */
4531 BOOL_STR(VARIANT_ALPHABOOL, szFalse);
4532 /* VARIANT_LOCALBOOL uses the localised text */
4533 BOOL_STR(VARIANT_LOCALBOOL, szFaux);
4534 /* Both flags together acts as VARIANT_LOCALBOOL */
4536 }
4537}
short VARIANT_BOOL
Definition: compat.h:2290
#define INITIAL_TYPETEST(vt, val, fs)
Definition: vartype.c:147
#define COMMON_TYPETEST
Definition: vartype.c:195
#define BOOL_STR(flags, str)
Definition: vartype.c:4494
#define V_BOOL(A)
Definition: oleauto.h:224
#define VARIANT_ALPHABOOL
Definition: oleauto.h:311
#define VARIANT_LOCALBOOL
Definition: oleauto.h:314
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define LANG_FRENCH
Definition: nls.h:58

Referenced by START_TEST().

◆ test_VarBoolCopy()

static void test_VarBoolCopy ( void  )
static

Definition at line 4489 of file vartype.c.

4490{
4491 COPYTEST(1, VT_BOOL, V_BOOL(&vSrc), V_BOOL(&vDst), V_BOOLREF(&vSrc), V_BOOLREF(&vDst), "%d");
4492}
#define COPYTEST(val, vt, srcval, dstval, srcref, dstref, fs)
Definition: vartype.c:118
#define V_BOOLREF(A)
Definition: oleauto.h:225

Referenced by START_TEST().

◆ test_VarBoolFromCy()

static void test_VarBoolFromCy ( void  )
static

Definition at line 4359 of file vartype.c.

4360{
4361 CONVVARS(CY);
4362
4363 CONVERT_CY(VarBoolFromCy, -32769); EXPECT(VARIANT_TRUE);
4364 CONVERT_CY(VarBoolFromCy, -32768); EXPECT(VARIANT_TRUE);
4365 CONVERT_CY(VarBoolFromCy, -1); EXPECT(VARIANT_TRUE);
4366 CONVERT_CY(VarBoolFromCy, 0); EXPECT(VARIANT_FALSE);
4367 CONVERT_CY(VarBoolFromCy, 1); EXPECT(VARIANT_TRUE);
4368 CONVERT_CY(VarBoolFromCy, 32767); EXPECT(VARIANT_TRUE);
4369 CONVERT_CY(VarBoolFromCy, 32768); EXPECT(VARIANT_TRUE);
4370}
HRESULT WINAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6048
#define CONVERT_CY(func, val)
Definition: vartype.c:93
#define CONVVARS(typ)
Definition: vartype.c:65

Referenced by START_TEST().

◆ test_VarBoolFromDate()

static void test_VarBoolFromDate ( void  )
static

Definition at line 4409 of file vartype.c.

4410{
4411 CONVVARS(DATE);
4412
4413 CONVERT(VarBoolFromDate, -1.0); EXPECT(VARIANT_TRUE);
4414 CONVERT(VarBoolFromDate, -0.0); EXPECT(VARIANT_FALSE);
4415 CONVERT(VarBoolFromDate, 1.0); EXPECT(VARIANT_TRUE);
4416}
double DATE
Definition: compat.h:2253
HRESULT WINAPI VarBoolFromDate(DATE dateIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6030
#define CONVERT(func, val)
Definition: vartype.c:82

Referenced by START_TEST().

◆ test_VarBoolFromDec()

static void test_VarBoolFromDec ( void  )
static

Definition at line 4389 of file vartype.c.

4390{
4392
4394
4399
4400 CONVERT_DEC(VarBoolFromDec,0,0x80,0,1); EXPECT(VARIANT_TRUE);
4401 CONVERT_DEC(VarBoolFromDec,0,0,0,0); EXPECT(VARIANT_FALSE);
4402 CONVERT_DEC(VarBoolFromDec,0,0,0,1); EXPECT(VARIANT_TRUE);
4403 CONVERT_DEC(VarBoolFromDec,0,0,1,0); EXPECT(VARIANT_TRUE);
4404
4405 CONVERT_DEC(VarBoolFromDec,2,0,0,CY_MULTIPLIER); EXPECT(VARIANT_TRUE);
4406 CONVERT_DEC(VarBoolFromDec,2,0x80,0,CY_MULTIPLIER); EXPECT(VARIANT_TRUE);
4407}
HRESULT WINAPI VarBoolFromDec(DECIMAL *pDecIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6278
#define CONVERT_BADDEC(func)
Definition: vartype.c:107

Referenced by START_TEST().

◆ test_VarBoolFromI1()

static void test_VarBoolFromI1 ( void  )
static

Definition at line 4275 of file vartype.c.

4276{
4277 CONVVARS(signed char);
4278 int i;
4279
4280 CONVERTRANGE(VarBoolFromI1, -128, 128);
4281}
HRESULT WINAPI VarBoolFromI1(signed char cIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6223
#define CONVERTRANGE(func, start, end)
Definition: vartype.c:4272

Referenced by START_TEST().

◆ test_VarBoolFromI2()

static void test_VarBoolFromI2 ( void  )
static

Definition at line 4291 of file vartype.c.

4292{
4293 CONVVARS(SHORT);
4294 int i;
4295
4296 CONVERTRANGE(VarBoolFromI2, -32768, 32768);
4297}
HRESULT WINAPI VarBoolFromI2(SHORT sIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:5958
short SHORT
Definition: pedump.c:59

Referenced by START_TEST().

◆ test_VarBoolFromI4()

static void test_VarBoolFromI4 ( void  )
static

Definition at line 4307 of file vartype.c.

4308{
4309 CONVVARS(int);
4310
4311 CONVERT(VarBoolFromI4, 0x80000000); EXPECT(VARIANT_TRUE);
4312 CONVERT(VarBoolFromI4, -1); EXPECT(VARIANT_TRUE);
4313 CONVERT(VarBoolFromI4, 0); EXPECT(VARIANT_FALSE);
4314 CONVERT(VarBoolFromI4, 1); EXPECT(VARIANT_TRUE);
4315 CONVERT(VarBoolFromI4, 0x7fffffff); EXPECT(VARIANT_TRUE);
4316}
HRESULT WINAPI VarBoolFromI4(LONG lIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:5976

Referenced by START_TEST().

◆ test_VarBoolFromI8()

static void test_VarBoolFromI8 ( void  )
static

Definition at line 4372 of file vartype.c.

4373{
4375
4376 CONVERT(VarBoolFromI8, -1); EXPECT(VARIANT_TRUE);
4377 CONVERT(VarBoolFromI8, 0); EXPECT(VARIANT_FALSE);
4378 CONVERT(VarBoolFromI8, 1); EXPECT(VARIANT_TRUE);
4379}
HRESULT WINAPI VarBoolFromI8(LONG64 llIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6302

Referenced by START_TEST().

◆ test_VarBoolFromR4()

static void test_VarBoolFromR4 ( void  )
static

Definition at line 4327 of file vartype.c.

4328{
4329 CONVVARS(FLOAT);
4330
4331 CONVERT(VarBoolFromR4, -1.0f); EXPECT(VARIANT_TRUE);
4332 CONVERT(VarBoolFromR4, 0.0f); EXPECT(VARIANT_FALSE);
4333 CONVERT(VarBoolFromR4, 1.0f); EXPECT(VARIANT_TRUE);
4334 CONVERT(VarBoolFromR4, 1.5f); EXPECT(VARIANT_TRUE);
4335
4336 /* Rounding */
4337 CONVERT(VarBoolFromR4, -1.5f); EXPECT(VARIANT_TRUE);
4338 CONVERT(VarBoolFromR4, -0.6f); EXPECT(VARIANT_TRUE);
4339 CONVERT(VarBoolFromR4, -0.5f); EXPECT(VARIANT_TRUE);
4340 CONVERT(VarBoolFromR4, -0.4f); EXPECT(VARIANT_TRUE);
4341 CONVERT(VarBoolFromR4, 0.4f); EXPECT(VARIANT_TRUE);
4342 CONVERT(VarBoolFromR4, 0.5f); EXPECT(VARIANT_TRUE);
4343 CONVERT(VarBoolFromR4, 0.6f); EXPECT(VARIANT_TRUE);
4344 CONVERT(VarBoolFromR4, 1.5f); EXPECT(VARIANT_TRUE);
4345}
HRESULT WINAPI VarBoolFromR4(FLOAT fltIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:5994
float FLOAT
Definition: typedefs.h:69

Referenced by START_TEST().

◆ test_VarBoolFromR8()

static void test_VarBoolFromR8 ( void  )
static

Definition at line 4347 of file vartype.c.

4348{
4350
4351 /* Hopefully we made the point with R4 above that rounding is
4352 * irrelevant, so we'll skip that for R8 and Date
4353 */
4354 CONVERT(VarBoolFromR8, -1.0); EXPECT(VARIANT_TRUE);
4355 CONVERT(VarBoolFromR8, -0.0); EXPECT(VARIANT_FALSE);
4356 CONVERT(VarBoolFromR8, 1.0); EXPECT(VARIANT_TRUE);
4357}
HRESULT WINAPI VarBoolFromR8(double dblIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6012
double DOUBLE
Definition: typedefs.h:70

Referenced by START_TEST().

◆ test_VarBoolFromStr()

static void test_VarBoolFromStr ( void  )
static

Definition at line 4418 of file vartype.c.

4419{
4420 CONVVARS(LCID);
4421 OLECHAR buff[128];
4422
4424
4426 if (hres != E_INVALIDARG)
4428
4429 /* #FALSE# and #TRUE# Are always accepted */
4430 CONVERT_STR(VarBoolFromStr,"#FALSE#",0); EXPECT(VARIANT_FALSE);
4431 CONVERT_STR(VarBoolFromStr,"#TRUE#",0); EXPECT(VARIANT_TRUE);
4432
4433 /* Match of #FALSE# and #TRUE# is case sensitive */
4435 /* But match against English is not */
4436 CONVERT_STR(VarBoolFromStr,"false",0); EXPECT(VARIANT_FALSE);
4437 CONVERT_STR(VarBoolFromStr,"False",0); EXPECT(VARIANT_FALSE);
4438 /* On/Off and yes/no are not acceptable inputs, with any flags set */
4439 CONVERT_STR(VarBoolFromStr,"On",0xffffffff); EXPECT_MISMATCH;
4440 CONVERT_STR(VarBoolFromStr,"Yes",0xffffffff); EXPECT_MISMATCH;
4441
4442 /* Change the LCID. This doesn't make any difference for text,unless we ask
4443 * to check local boolean text with the VARIANT_LOCALBOOL flag. */
4445
4446 /* #FALSE# and #TRUE# are accepted in all locales */
4447 CONVERT_STR(VarBoolFromStr,"#FALSE#",0); EXPECT(VARIANT_FALSE);
4448 CONVERT_STR(VarBoolFromStr,"#TRUE#",0); EXPECT(VARIANT_TRUE);
4449 CONVERT_STR(VarBoolFromStr,"#FALSE#",VARIANT_LOCALBOOL); EXPECT(VARIANT_FALSE);
4450 CONVERT_STR(VarBoolFromStr,"#TRUE#",VARIANT_LOCALBOOL); EXPECT(VARIANT_TRUE);
4451
4452 /* English is accepted regardless of the locale */
4453 CONVERT_STR(VarBoolFromStr,"false",0); EXPECT(VARIANT_FALSE);
4454 /* And is still not case sensitive */
4455 CONVERT_STR(VarBoolFromStr,"False",0); EXPECT(VARIANT_FALSE);
4456
4457 if (has_locales)
4458 {
4459 /* French is rejected without VARIANT_LOCALBOOL */
4461 /* But accepted if this flag is given */
4462 CONVERT_STR(VarBoolFromStr,"faux",VARIANT_LOCALBOOL); EXPECT(VARIANT_FALSE);
4463 /* Regardless of case - from this we assume locale text comparisons ignore case */
4464 CONVERT_STR(VarBoolFromStr,"Faux",VARIANT_LOCALBOOL); EXPECT(VARIANT_FALSE);
4465
4466 /* Changing the locale prevents the localised text from being compared -
4467 * this demonstrates that only the indicated LCID and English are searched */
4470 }
4471
4472 /* Numeric strings are read as 0 or non-0 */
4473 CONVERT_STR(VarBoolFromStr,"0",0); EXPECT(VARIANT_FALSE);
4474 CONVERT_STR(VarBoolFromStr,"-1",0); EXPECT(VARIANT_TRUE);
4475 CONVERT_STR(VarBoolFromStr,"+1",0); EXPECT(VARIANT_TRUE);
4476
4477 if (has_locales)
4478 {
4479 /* Numeric strings are read as floating point numbers. The line below fails
4480 * because '.' is not a valid decimal separator for Polish numbers */
4482 }
4483
4484 /* Changing the lcid back to US English reads the r8 correctly */
4487}
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI VarBoolFromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6114
#define CONVERT_STR(func, str, flags)
Definition: vartype.c:113
#define EXPECT_MISMATCH
Definition: vartype.c:69
#define LANG_POLISH
Definition: nls.h:107

Referenced by START_TEST().

◆ test_VarBoolFromUI1()

static void test_VarBoolFromUI1 ( void  )
static

Definition at line 4283 of file vartype.c.

4284{
4285 CONVVARS(BYTE);
4286 int i;
4287
4289}
HRESULT WINAPI VarBoolFromUI1(BYTE bIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:5940

Referenced by START_TEST().

◆ test_VarBoolFromUI2()

static void test_VarBoolFromUI2 ( void  )
static

Definition at line 4299 of file vartype.c.

4300{
4302 int i;
4303
4304 CONVERTRANGE(VarBoolFromUI2, 0, 65536);
4305}
HRESULT WINAPI VarBoolFromUI2(USHORT usIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6241
unsigned short USHORT
Definition: pedump.c:61

Referenced by START_TEST().

◆ test_VarBoolFromUI4()

static void test_VarBoolFromUI4 ( void  )
static

Definition at line 4318 of file vartype.c.

4319{
4320 CONVVARS(ULONG);
4321
4322 CONVERT(VarBoolFromI4, 0); EXPECT(VARIANT_FALSE);
4323 CONVERT(VarBoolFromI4, 1); EXPECT(VARIANT_TRUE);
4324 CONVERT(VarBoolFromI4, 0x80000000); EXPECT(VARIANT_TRUE);
4325}

Referenced by START_TEST().

◆ test_VarBoolFromUI8()

static void test_VarBoolFromUI8 ( void  )
static

Definition at line 4381 of file vartype.c.

4382{
4384
4385 CONVERT(VarBoolFromUI8, 0); EXPECT(VARIANT_FALSE);
4386 CONVERT(VarBoolFromUI8, 1); EXPECT(VARIANT_TRUE);
4387}
HRESULT WINAPI VarBoolFromUI8(ULONG64 ullIn, VARIANT_BOOL *pBoolOut)
Definition: vartype.c:6320

Referenced by START_TEST().

◆ test_VarBstrCat()

static void test_VarBstrCat ( void  )
static

Definition at line 5224 of file vartype.c.

5225{
5226 static const WCHAR sz1[] = { 'a',0 };
5227 static const WCHAR sz2[] = { 'b',0 };
5228 static const WCHAR sz1sz2[] = { 'a','b',0 };
5229 static const WCHAR s1[] = { 'a',0 };
5230 static const WCHAR s2[] = { 'b',0 };
5231 static const WCHAR s1s2[] = { 'a',0,'b',0 };
5232 static const char str1A[] = "Have ";
5233 static const char str2A[] = "A Cigar";
5234 HRESULT ret;
5235 BSTR str1, str2, res;
5236 UINT len;
5237
5238if (0)
5239{
5240 /* Crash */
5242}
5243
5244 /* Concatenation of two NULL strings works */
5245 ret = VarBstrCat(NULL, NULL, &res);
5246 ok(ret == S_OK, "VarBstrCat failed: %08x\n", ret);
5247 ok(res != NULL, "Expected a string\n");
5248 ok(SysStringLen(res) == 0, "Expected a 0-length string\n");
5250
5251 str1 = SysAllocString(sz1);
5252
5253 /* Concatenation with one NULL arg */
5254 ret = VarBstrCat(NULL, str1, &res);
5255 ok(ret == S_OK, "VarBstrCat failed: %08x\n", ret);
5256 ok(res != NULL, "Expected a string\n");
5257 ok(SysStringLen(res) == SysStringLen(str1), "Unexpected length\n");
5258 ok(!memcmp(res, sz1, SysStringLen(str1)), "Unexpected value\n");
5260 ret = VarBstrCat(str1, NULL, &res);
5261 ok(ret == S_OK, "VarBstrCat failed: %08x\n", ret);
5262 ok(res != NULL, "Expected a string\n");
5263 ok(SysStringLen(res) == SysStringLen(str1), "Unexpected length\n");
5264 ok(!memcmp(res, sz1, SysStringLen(str1)), "Unexpected value\n");
5266
5267 /* Concatenation of two zero-terminated strings */
5268 str2 = SysAllocString(sz2);
5269 ret = VarBstrCat(str1, str2, &res);
5270 ok(ret == S_OK, "VarBstrCat failed: %08x\n", ret);
5271 ok(res != NULL, "Expected a string\n");
5272 ok(SysStringLen(res) == ARRAY_SIZE(sz1sz2) - 1, "Unexpected length\n");
5273 ok(!memcmp(res, sz1sz2, sizeof(sz1sz2)), "Unexpected value\n");
5275
5276 SysFreeString(str2);
5277 SysFreeString(str1);
5278
5279 /* Concatenation of two strings with embedded NULLs */
5282
5283 ret = VarBstrCat(str1, str2, &res);
5284 ok(ret == S_OK, "VarBstrCat failed: %08x\n", ret);
5285 ok(res != NULL, "Expected a string\n");
5286 ok(SysStringLen(res) == ARRAY_SIZE(s1s2), "Unexpected length\n");
5287 ok(!memcmp(res, s1s2, sizeof(s1s2)), "Unexpected value\n");
5289
5290 SysFreeString(str2);
5291 SysFreeString(str1);
5292
5293 /* Concatenation of ansi BSTRs, both odd byte count not including termination */
5294 str1 = SysAllocStringByteLen(str1A, sizeof(str1A)-1);
5295 str2 = SysAllocStringByteLen(str2A, sizeof(str2A)-1);
5296 len = SysStringLen(str1);
5297 ok(len == (sizeof(str1A)-1)/sizeof(WCHAR), "got length %u\n", len);
5298 len = SysStringLen(str2);
5299 ok(len == (sizeof(str2A)-1)/sizeof(WCHAR), "got length %u\n", len);
5300
5301 ret = VarBstrCat(str1, str2, &res);
5302 ok(ret == S_OK, "VarBstrCat failed: %08x\n", ret);
5303 ok(res != NULL, "Expected a string\n");
5304 len = (sizeof(str1A) + sizeof(str2A) - 2)/sizeof(WCHAR);
5305 ok(SysStringLen(res) == len, "got %d, expected %u\n", SysStringLen(res), len);
5306 ok(!memcmp(res, "Have A Cigar", sizeof(str1A) + sizeof(str2A) - 1), "got (%s)\n", (char*)res);
5308
5309 SysFreeString(str2);
5310 SysFreeString(str1);
5311
5312 /* Concatenation of ansi BSTRs, both 1 byte length not including termination */
5313 str1 = SysAllocStringByteLen(str1A, 1);
5314 str2 = SysAllocStringByteLen(str2A, 1);
5315 len = SysStringLen(str1);
5316 ok(len == 0, "got length %u\n", len);
5317 len = SysStringLen(str2);
5318 ok(len == 0, "got length %u\n", len);
5319
5320 ret = VarBstrCat(str1, str2, &res);
5321 ok(ret == S_OK, "VarBstrCat failed: %08x\n", ret);
5322 ok(res != NULL, "Expected a string\n");
5323 ok(SysStringLen(res) == 1, "got %d, expected 1\n", SysStringLen(res));
5324 ok(!memcmp(res, "HA", 2), "got (%s)\n", (char*)res);
5326
5327 SysFreeString(str2);
5328 SysFreeString(str1);
5329}
HRESULT WINAPI VarBstrCat(BSTR pbstrLeft, BSTR pbstrRight, BSTR *pbstrOut)
Definition: vartype.c:7107
GLenum GLsizei len
Definition: glext.h:6722
struct S1 s1
struct S2 s2
unsigned int UINT
Definition: ndis.h:50

Referenced by START_TEST().

◆ test_VarBstrCmp()

static void test_VarBstrCmp ( void  )
static

Definition at line 4814 of file vartype.c.

4815{
4816 LCID lcid;
4817 HRESULT hres;
4818 static const WCHAR sz[] = {'W','u','r','s','c','h','t','\0'};
4819 static const WCHAR szempty[] = {'\0'};
4820 static const WCHAR sz1[] = { 'a',0 };
4821 static const WCHAR sz2[] = { 'A',0 };
4822 static const WCHAR s1[] = { 'a',0 };
4823 static const WCHAR s2[] = { 'a',0,'b' };
4824 static const char sb1[] = {1,0,1};
4825 static const char sb2[] = {1,0,2};
4826 static const char sbchr0[] = {0,0};
4827 static const char sbchr00[] = {0,0,0};
4828 BSTR bstr, bstrempty, bstr2;
4829
4831 bstr = SysAllocString(sz);
4832 bstrempty = SysAllocString(szempty);
4833
4834 /* NULL handling. Yepp, MSDN is totally wrong here */
4836 VARBSTRCMP(bstr,NULL,0,VARCMP_GT);
4837 VARBSTRCMP(NULL,bstr,0,VARCMP_LT);
4838
4839 /* NULL and empty string comparisons */
4840 VARBSTRCMP(bstrempty,NULL,0,VARCMP_EQ);
4841 VARBSTRCMP(NULL,bstrempty,0,VARCMP_EQ);
4842
4843 SysFreeString(bstr);
4844 bstr = SysAllocString(sz1);
4845
4846 bstr2 = SysAllocString(sz2);
4847 VARBSTRCMP(bstr,bstr2,0,VARCMP_LT);
4849 SysFreeString(bstr2);
4850 /* These two strings are considered equal even though one is
4851 * NULL-terminated and the other not.
4852 */
4853 bstr2 = SysAllocStringLen(s1, ARRAY_SIZE(s1));
4854 VARBSTRCMP(bstr,bstr2,0,VARCMP_EQ);
4855 SysFreeString(bstr2);
4856
4857 /* These two strings are not equal */
4858 bstr2 = SysAllocStringLen(s2, ARRAY_SIZE(s2));
4859 VARBSTRCMP(bstr,bstr2,0,VARCMP_LT);
4860 SysFreeString(bstr2);
4861
4862 SysFreeString(bstr);
4863
4864 bstr = SysAllocStringByteLen(sbchr0, sizeof(sbchr0));
4865 bstr2 = SysAllocStringByteLen(sbchr00, sizeof(sbchr00));
4866 VARBSTRCMP(bstr,bstrempty,0,VARCMP_GT);
4867 VARBSTRCMP(bstrempty,bstr,0,VARCMP_LT);
4868 VARBSTRCMP(bstr2,bstrempty,0,VARCMP_GT);
4869 VARBSTRCMP(bstr2,bstr,0,VARCMP_EQ);
4870 SysFreeString(bstr2);
4871 SysFreeString(bstr);
4872
4873 /* When (LCID == 0) it should be a binary comparison
4874 * so these two strings could not match.
4875 */
4876 bstr = SysAllocStringByteLen(sb1, sizeof(sb1));
4877 bstr2 = SysAllocStringByteLen(sb2, sizeof(sb2));
4878 lcid = 0;
4879 VARBSTRCMP(bstr,bstr2,0,VARCMP_LT);
4880 SysFreeString(bstr2);
4881 SysFreeString(bstr);
4882
4883 bstr = SysAllocStringByteLen(sbchr0, sizeof(sbchr0));
4884 bstr2 = SysAllocStringByteLen(sbchr00, sizeof(sbchr00));
4885 VARBSTRCMP(bstr,bstrempty,0,VARCMP_GT);
4886 VARBSTRCMP(bstrempty,bstr,0,VARCMP_LT);
4887 VARBSTRCMP(bstr2,bstrempty,0,VARCMP_GT);
4888 VARBSTRCMP(bstr2,bstr,0,VARCMP_GT);
4889 SysFreeString(bstr2);
4890 SysFreeString(bstr);
4891 SysFreeString(bstrempty);
4892}
#define VARBSTRCMP(left, right, flags, result)
Definition: vartype.c:4811
#define VARCMP_LT
Definition: oleauto.h:657
#define VARCMP_EQ
Definition: oleauto.h:658
#define VARCMP_GT
Definition: oleauto.h:659
#define NORM_IGNORECASE
Definition: winnls.h:176

Referenced by START_TEST().

◆ test_VarBstrFromCy()

static void test_VarBstrFromCy ( void  )
static

Definition at line 4701 of file vartype.c.

4702{
4703#define BSTR_CY(a, b, str, lcid) _BSTR_CY(a, b, str, lcid, __LINE__)
4704
4705 LCID en_us, sp;
4706
4709
4710 BSTR_CY(0, 0, "0", en_us);
4711 BSTR_CY(0, 10000, "1", en_us);
4712 BSTR_CY(0, 15000, "1.5", en_us);
4713 BSTR_CY(0xffffffff, ((15000)^0xffffffff)+1, "-1.5", en_us);
4714 /* (1 << 32) - 1 / 1000 */
4715 BSTR_CY(0, 0xffffffff, "429496.7295", en_us);
4716 /* (1 << 32) / 1000 */
4717 BSTR_CY(1, 0, "429496.7296", en_us);
4718 /* ((1 << 63) - 1)/10000 */
4719 BSTR_CY(0x7fffffff, 0xffffffff, "922337203685477.5807", en_us);
4720 BSTR_CY(0, 9, "0.0009", en_us);
4721 BSTR_CY(0, 9, "0,0009", sp);
4722
4723#undef BSTR_CY
4724}
static const WCHAR sp[]
Definition: suminfo.c:287
#define BSTR_CY(a, b, str, lcid)
#define LANG_SPANISH
Definition: nls.h:123

Referenced by START_TEST().

◆ test_VarBstrFromDate()

static void test_VarBstrFromDate ( void  )
static

Definition at line 4657 of file vartype.c.

4658{
4659#define BSTR_DATE(dt,str) _BSTR_DATE(dt,str,__LINE__)
4660
4661 BSTR_DATE(0.0, "12:00:00 AM");
4662 BSTR_DATE(3.34, "1/2/1900 8:09:36 AM");
4663 BSTR_DATE(3339.34, "2/20/1909 8:09:36 AM");
4664 BSTR_DATE(365.00, "12/30/1900");
4665 BSTR_DATE(365.25, "12/30/1900 6:00:00 AM");
4666 BSTR_DATE(1461.0, "12/31/1903");
4667 BSTR_DATE(1461.5, "12/31/1903 12:00:00 PM");
4668 BSTR_DATE(-49192.24, "4/24/1765 5:45:36 AM");
4669 BSTR_DATE(-657434.0, "1/1/100");
4670 BSTR_DATE(2958465.0, "12/31/9999");
4671
4672#undef BSTR_DATE
4673}
#define BSTR_DATE(dt, str)

Referenced by START_TEST().

◆ test_VarBstrFromDec()

static void test_VarBstrFromDec ( void  )
static

Definition at line 4752 of file vartype.c.

4753{
4754#define BSTR_DEC(scale, sign, hi, lo, str, lcid) _BSTR_DEC(scale, sign, hi, 0, lo, str, lcid, __LINE__)
4755#define BSTR_DEC64(scale, sign, hi, mid, lo, str, lcid) _BSTR_DEC(scale, sign, hi, mid, lo, str, lcid, __LINE__)
4756
4757 LCID en_us, sp;
4758
4761
4762 BSTR_DEC(0,0,0,0, "0", en_us);
4763
4764 BSTR_DEC(0,0,0,1, "1", en_us);
4765 BSTR_DEC(1,0,0,10, "1", en_us);
4766 BSTR_DEC(2,0,0,100, "1", en_us);
4767 BSTR_DEC(3,0,0,1000,"1", en_us);
4768
4769 BSTR_DEC(1,0,0,15, "1.5", en_us);
4770 BSTR_DEC(2,0,0,150, "1.5", en_us);
4771 BSTR_DEC(3,0,0,1500,"1.5", en_us);
4772
4773 BSTR_DEC(1,0x80,0,15, "-1.5", en_us);
4774
4775 /* (1 << 32) - 1 */
4776 BSTR_DEC(0,0,0,0xffffffff, "4294967295", en_us);
4777 /* (1 << 32) */
4778 BSTR_DEC64(0,0,0,1,0, "4294967296", en_us);
4779 /* (1 << 64) - 1 */
4780 BSTR_DEC64(0,0,0,0xffffffff,0xffffffff, "18446744073709551615", en_us);
4781 /* (1 << 64) */
4782 BSTR_DEC(0,0,1,0, "18446744073709551616", en_us);
4783 /* (1 << 96) - 1 */
4784 BSTR_DEC64(0,0,0xffffffff,0xffffffff,0xffffffff, "79228162514264337593543950335", en_us);
4785 /* 1 * 10^-10 */
4786 BSTR_DEC(10,0,0,1, "0.0000000001", en_us);
4787 /* ((1 << 96) - 1) * 10^-10 */
4788 BSTR_DEC64(10,0,0xffffffffUL,0xffffffff,0xffffffff, "7922816251426433759.3543950335", en_us);
4789 /* ((1 << 96) - 1) * 10^-28 */
4790 BSTR_DEC64(28,0,0xffffffffUL,0xffffffff,0xffffffff, "7.9228162514264337593543950335", en_us);
4791
4792 /* check leading zeros and decimal sep. for English locale */
4793 BSTR_DEC(4,0,0,9, "0.0009", en_us);
4794 BSTR_DEC(5,0,0,90, "0.0009", en_us);
4795 BSTR_DEC(6,0,0,900, "0.0009", en_us);
4796 BSTR_DEC(7,0,0,9000, "0.0009", en_us);
4797
4798 /* check leading zeros and decimal sep. for Spanish locale */
4799 BSTR_DEC(4,0,0,9, "0,0009", sp);
4800 BSTR_DEC(5,0,0,90, "0,0009", sp);
4801 BSTR_DEC(6,0,0,900, "0,0009", sp);
4802 BSTR_DEC(7,0,0,9000, "0,0009", sp);
4803
4804#undef BSTR_DEC
4805#undef BSTR_DEC64
4806}
#define BSTR_DEC(scale, sign, hi, lo, str, lcid)
#define BSTR_DEC64(scale, sign, hi, mid, lo, str, lcid)

Referenced by START_TEST().

◆ test_VarBstrFromI4()

static void test_VarBstrFromI4 ( void  )
static

Definition at line 4543 of file vartype.c.

4544{
4545 static const WCHAR int_min[] = { '-','2','1','4','7','4','8','3','6','4','8','\0' };
4546 static const WCHAR minus_42[] = { '-','4','2','\0' };
4547 BSTR bstr = NULL;
4548 HRESULT hres;
4549 LONG value;
4550 LCID lcid;
4551
4553
4554#ifdef __REACTOS__
4555 value = (-2147483647 - 1);
4556#else
4557 value = -2147483648;
4558#endif
4560 ok(hres == S_OK, "got hres 0x%08x\n", hres);
4561 if (bstr)
4562 {
4563 ok(memcmp(bstr, int_min, sizeof(int_min)) == 0, "string different\n");
4564 SysFreeString(bstr);
4565 }
4566
4567 value = -42;
4569 ok(hres == S_OK, "got hres 0x%08x\n", hres);
4570 if (bstr)
4571 {
4572 ok(memcmp(bstr, minus_42, sizeof(minus_42)) == 0, "string different\n");
4573 SysFreeString(bstr);
4574 }
4575}
HRESULT WINAPI VarBstrFromI4(LONG lIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
Definition: vartype.c:6445
Definition: pdh_main.c:94

Referenced by START_TEST().

◆ test_VarBstrFromR4()

static void test_VarBstrFromR4 ( void  )
static

Definition at line 4577 of file vartype.c.

4578{
4579 static const WCHAR szNative[] = { '6','5','4','3','2','2','.','3','\0' };
4580 static const WCHAR szZero[] = {'0', '\0'};
4581 static const WCHAR szOneHalf_English[] = { '0','.','5','\0' }; /* uses period */
4582 static const WCHAR szOneHalf_Spanish[] = { '0',',','5','\0' }; /* uses comma */
4583 LCID lcid;
4584 LCID lcid_spanish;
4585 HRESULT hres;
4586 BSTR bstr = NULL;
4587
4588 float f;
4589
4592 f = 654322.23456f;
4593 hres = VarBstrFromR4(f, lcid, 0, &bstr);
4594 ok(hres == S_OK, "got hres 0x%08x\n", hres);
4595 if (bstr)
4596 {
4597 todo_wine {
4598 /* MSDN states that rounding of R4/R8 is dependent on the underlying
4599 * bit pattern of the number and so is architecture dependent. In this
4600 * case Wine returns .2 (which is more correct) and Native returns .3
4601 */
4602 ok(memcmp(bstr, szNative, sizeof(szNative)) == 0, "string different\n");
4603 }
4604 SysFreeString(bstr);
4605 }
4606
4607 f = -0.0;
4608 hres = VarBstrFromR4(f, lcid, 0, &bstr);
4609 ok(hres == S_OK, "got hres 0x%08x\n", hres);
4610 if (bstr)
4611 {
4612 if (bstr[0] == '-')
4613 ok(memcmp(bstr + 1, szZero, sizeof(szZero)) == 0, "negative zero (got %s)\n", wtoascii(bstr));
4614 else
4615 ok(memcmp(bstr, szZero, sizeof(szZero)) == 0, "negative zero (got %s)\n", wtoascii(bstr));
4616 SysFreeString(bstr);
4617 }
4618
4619 /* The following tests that lcid is used for decimal separator even without LOCALE_USE_NLS */
4620 f = 0.5;
4621 hres = VarBstrFromR4(f, lcid, LOCALE_NOUSEROVERRIDE, &bstr);
4622 ok(hres == S_OK, "got hres 0x%08x\n", hres);
4623 if (bstr)
4624 {
4625 ok(memcmp(bstr, szOneHalf_English, sizeof(szOneHalf_English)) == 0, "English locale failed (got %s)\n", wtoascii(bstr));
4626 SysFreeString(bstr);
4627 }
4628 f = 0.5;
4629 hres = VarBstrFromR4(f, lcid_spanish, LOCALE_NOUSEROVERRIDE, &bstr);
4630 ok(hres == S_OK, "got hres 0x%08x\n", hres);
4631 if (bstr)
4632 {
4633 ok(memcmp(bstr, szOneHalf_Spanish, sizeof(szOneHalf_Spanish)) == 0, "Spanish locale failed (got %s)\n", wtoascii(bstr));
4634 SysFreeString(bstr);
4635 }
4636}
HRESULT WINAPI VarBstrFromR4(FLOAT fltIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
Definition: vartype.c:6566
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83
#define todo_wine
Definition: custom.c:89
static const char * wtoascii(LPWSTR lpszIn)
Definition: vartype.c:3144
#define SUBLANG_SPANISH
Definition: nls.h:336

Referenced by START_TEST().

◆ test_VarCyAbs()

static void test_VarCyAbs ( void  )
static

Definition at line 3491 of file vartype.c.

3492{
3493 MATHVARS1;
3494
3495 MATH1(VarCyAbs, 0.5); EXPECTCY(0.5);
3496 MATH1(VarCyAbs, -0.5); EXPECTCY(0.5);
3497 MATH1(VarCyAbs, 922337203685476.0); EXPECTCY64(2147483647ul,4294951488ul);
3498 MATH1(VarCyAbs, -922337203685476.0); EXPECTCY64(2147483647ul,4294951488ul);
3499}
HRESULT WINAPI VarCyAbs(CY cyIn, CY *pCyOut)
Definition: vartype.c:3876
#define EXPECTCY(x)
Definition: vartype.c:3201
#define EXPECTCY64(x, y)
Definition: vartype.c:3205
#define MATHVARS1
Definition: vartype.c:3871
#define MATH1(func, l)
Definition: vartype.c:3875

Referenced by START_TEST().

◆ test_VarCyAdd()

static void test_VarCyAdd ( void  )
static

Definition at line 3451 of file vartype.c.

3452{
3453 MATHVARS2;
3454
3455 MATH2(VarCyAdd, 0.5, 0.5); EXPECTCY(1);
3456 MATH2(VarCyAdd, 0.5, -0.4); EXPECTCY(0.1);
3457 MATH2(VarCyAdd, 0.5, -0.6); EXPECTCY(-0.1);
3458 MATH2(VarCyAdd, -0.5, -0.5); EXPECTCY(-1);
3459 MATH2(VarCyAdd, -922337203685476.0, -922337203685476.0); EXPECT_OVERFLOW;
3460 MATH2(VarCyAdd, -922337203685476.0, 922337203685476.0); EXPECTCY(0);
3461 MATH2(VarCyAdd, 922337203685476.0, -922337203685476.0); EXPECTCY(0);
3462 MATH2(VarCyAdd, 922337203685476.0, 922337203685476.0); EXPECT_OVERFLOW;
3463}
HRESULT WINAPI VarCyAdd(CY cyLeft, CY cyRight, CY *pCyOut)
Definition: vartype.c:3785
#define MATHVARS2
Definition: vartype.c:3873
#define MATH2(func, l, r)
Definition: vartype.c:3877
#define EXPECT_OVERFLOW
Definition: vartype.c:68

Referenced by START_TEST().

◆ test_VarCyCmp()

static void test_VarCyCmp ( void  )
static

Definition at line 3544 of file vartype.c.

3545{
3546 HRESULT hres;
3547 double left = 0.0, right = 0.0;
3548 CY cyLeft, cyRight;
3549
3550 MATHCMP(-1.0, -1.0); EXPECT_EQ;
3551 MATHCMP(-1.0, 0.0); EXPECT_LT;
3552 MATHCMP(-1.0, 1.0); EXPECT_LT;
3553 MATHCMP(-1.0, 2.0); EXPECT_LT;
3554 MATHCMP(0.0, 1.0); EXPECT_LT;
3555 MATHCMP(0.0, 0.0); EXPECT_EQ;
3556 MATHCMP(0.0, -1.0); EXPECT_GT;
3557 MATHCMP(1.0, -1.0); EXPECT_GT;
3558 MATHCMP(1.0, 0.0); EXPECT_GT;
3559 MATHCMP(1.0, 1.0); EXPECT_EQ;
3560 MATHCMP(1.0, 2.0); EXPECT_LT;
3561}
#define EXPECT_LT
Definition: vartype.c:72
#define EXPECT_GT
Definition: vartype.c:73
#define MATHCMP(l, r)
Definition: vartype.c:3541
#define EXPECT_EQ
Definition: vartype.c:74

Referenced by START_TEST().

◆ test_VarCyCmpR8()

static void test_VarCyCmpR8 ( void  )
static

Definition at line 3566 of file vartype.c.

3567{
3568 HRESULT hres;
3569 double left = 0.0;
3570 CY cyLeft;
3571 double right;
3572
3573 MATHCMPR8(-1.0, -1.0); EXPECT_EQ;
3574 MATHCMPR8(-1.0, 0.0); EXPECT_LT;
3575 MATHCMPR8(-1.0, 1.0); EXPECT_LT;
3576 MATHCMPR8(-1.0, 2.0); EXPECT_LT;
3577 MATHCMPR8(0.0, 1.0); EXPECT_LT;
3578 MATHCMPR8(0.0, 0.0); EXPECT_EQ;
3579 MATHCMPR8(0.0, -1.0); EXPECT_GT;
3580 MATHCMPR8(1.0, -1.0); EXPECT_GT;
3581 MATHCMPR8(1.0, 0.0); EXPECT_GT;
3582 MATHCMPR8(1.0, 1.0); EXPECT_EQ;
3583 MATHCMPR8(1.0, 2.0); EXPECT_LT;
3584}
#define MATHCMPR8(l, r)
Definition: vartype.c:3563

Referenced by START_TEST().

◆ test_VarCyFix()

static void test_VarCyFix ( void  )
static

Definition at line 3622 of file vartype.c.

3623{
3624 MATHVARS1;
3625
3626 MATHFIX(-1.0001); EXPECTCY(-1);
3627 MATHFIX(-1.4999); EXPECTCY(-1);
3628 MATHFIX(-1.5001); EXPECTCY(-1);
3629 MATHFIX(-1.9999); EXPECTCY(-1);
3630 MATHFIX(-0.0001); EXPECTCY(0);
3631 MATHFIX(-0.4999); EXPECTCY(0);
3632 MATHFIX(-0.5001); EXPECTCY(0);
3633 MATHFIX(-0.9999); EXPECTCY(0);
3634 MATHFIX(0.0001); EXPECTCY(0);
3635 MATHFIX(0.4999); EXPECTCY(0);
3636 MATHFIX(0.5001); EXPECTCY(0);
3637 MATHFIX(0.9999); EXPECTCY(0);
3638 MATHFIX(1.0001); EXPECTCY(1);
3639 MATHFIX(1.4999); EXPECTCY(1);
3640 MATHFIX(1.5001); EXPECTCY(1);
3641 MATHFIX(1.9999); EXPECTCY(1);
3642}
#define MATHFIX(l)
Definition: vartype.c:3619

Referenced by START_TEST().

◆ test_VarCyFromBool()

static void test_VarCyFromBool ( void  )
static

Definition at line 3345 of file vartype.c.

3346{
3348 int i;
3349
3350 for (i = -32768; i < 32768; i++)
3351 {
3353 }
3354}
HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY *pCyOut)
Definition: vartype.c:3620

Referenced by START_TEST().

◆ test_VarCyFromDate()

static void test_VarCyFromDate ( void  )
static

Definition at line 3407 of file vartype.c.

3408{
3409 CONVVARS(DATE);
3410
3411#if defined(__i386__) && (defined(_MSC_VER) || defined(__GNUC__))
3412 CONVERT(VarCyFromR8, -461168601842738.7904); EXPECTCY64(0xbfffffff, 0xffffff23);
3413#endif
3414
3415 CONVERT(VarCyFromDate, -1.0); EXPECTCY(-1);
3416 CONVERT(VarCyFromDate, -0.0); EXPECTCY(0);
3417 CONVERT(VarCyFromDate, 1.0); EXPECTCY(1);
3418 CONVERT(VarCyFromDate, -4611686018427388416.1); EXPECT_OVERFLOW;
3419 CONVERT(VarCyFromDate, 4611686018427387648.0); EXPECT_OVERFLOW;
3420
3421 /* Rounding */
3422 CONVERT(VarCyFromDate, -1.5f); EXPECTCY(-1.5);
3423 CONVERT(VarCyFromDate, -0.6f); EXPECTCY(-0.6);
3424 CONVERT(VarCyFromDate, -0.5f); EXPECTCY(-0.5);
3425 CONVERT(VarCyFromDate, -0.4f); EXPECTCY(-0.4);
3426 CONVERT(VarCyFromDate, 0.4f); EXPECTCY(0.4);
3427 CONVERT(VarCyFromDate, 0.5f); EXPECTCY(0.5);
3428 CONVERT(VarCyFromDate, 0.6f); EXPECTCY(0.6);
3429 CONVERT(VarCyFromDate, 1.5f); EXPECTCY(1.5);
3430 CONVERT(VarCyFromDate, 1.00009f); EXPECTCY(1.0001);
3431 CONVERT(VarCyFromDate, -1.00001f); EXPECTCY(-1);
3432 CONVERT(VarCyFromDate, -1.00005f); EXPECTCY(-1);
3433 CONVERT(VarCyFromDate, -0.00009f); EXPECTCY(-0.0001);
3434 CONVERT(VarCyFromDate, -0.00005f); EXPECTCY(0);
3435 CONVERT(VarCyFromDate, -0.00001f); EXPECTCY(0);
3436 CONVERT(VarCyFromDate, 0.00001f); EXPECTCY(0);
3437 CONVERT(VarCyFromDate, 0.00005f); EXPECTCY(0);
3438 CONVERT(VarCyFromDate, 0.00009f); EXPECTCY(0.0001);
3439 CONVERT(VarCyFromDate, -1.00001f); EXPECTCY(-1);
3440 CONVERT(VarCyFromDate, -1.00005f); EXPECTCY(-1);
3441 CONVERT(VarCyFromDate, -1.00009f); EXPECTCY(-1.0001);
3442}
HRESULT WINAPI VarCyFromDate(DATE dateIn, CY *pCyOut)
Definition: vartype.c:3553

Referenced by START_TEST().

◆ test_VarCyFromDec()

static void test_VarCyFromDec ( void  )
static

Definition at line 3381 of file vartype.c.

3382{
3384
3386
3387 CONVERT_DEC(VarCyFromDec,0,0x80,0,1); EXPECTCY(-1);
3388 CONVERT_DEC(VarCyFromDec,0,0,0,0); EXPECTCY(0);
3389 CONVERT_DEC(VarCyFromDec,0,0,0,1); EXPECTCY(1);
3390
3391 CONVERT_DEC64(VarCyFromDec,0,0,0,214748, 1566804068); EXPECTCY64(2147483647ul, 4294951488ul);
3392 CONVERT_DEC64(VarCyFromDec,0,0,0,214748, 1566804069); EXPECTCY64(2147483647ul, 4294961488ul);
3393 CONVERT_DEC64(VarCyFromDec,0,0,0,214748, 1566804070); EXPECT_OVERFLOW;
3394 CONVERT_DEC64(VarCyFromDec,0,0,0,214749, 1566804068); EXPECT_OVERFLOW;
3395
3396 CONVERT_DEC(VarCyFromDec,2,0,0,100); EXPECTCY(1);
3397 CONVERT_DEC(VarCyFromDec,2,0x80,0,100); EXPECTCY(-1);
3398 CONVERT_DEC(VarCyFromDec,2,0x80,0,1); EXPECTCY(-0.01);
3399 CONVERT_DEC(VarCyFromDec,2,0,0,1); EXPECTCY(0.01);
3400 CONVERT_DEC(VarCyFromDec,2,0x80,0,1); EXPECTCY(-0.01);
3401 CONVERT_DEC(VarCyFromDec,2,0,0,999); EXPECTCY(9.99);
3402 CONVERT_DEC(VarCyFromDec,2,0x80,0,999); EXPECTCY(-9.99);
3403 CONVERT_DEC(VarCyFromDec,2,0,0,1500); EXPECTCY(15);
3404 CONVERT_DEC(VarCyFromDec,2,0x80,0,1500); EXPECTCY(-15);
3405}
HRESULT WINAPI VarCyFromDec(DECIMAL *pdecIn, CY *pCyOut)
Definition: vartype.c:3704
#define CONVERT_DEC64(func, scl, sgn, hi, mid, lo)
Definition: vartype.c:105

Referenced by START_TEST().

◆ test_VarCyFromI1()

static void test_VarCyFromI1 ( void  )
static

Definition at line 3210 of file vartype.c.

3211{
3212 CONVVARS(signed char);
3213 int i;
3214
3215 for (i = -128; i < 128; i++)
3216 {
3218 }
3219}
HRESULT WINAPI VarCyFromI1(signed char cIn, CY *pCyOut)
Definition: vartype.c:3641

Referenced by START_TEST().

◆ test_VarCyFromI2()

static void test_VarCyFromI2 ( void  )
static

Definition at line 3232 of file vartype.c.

3233{
3234 CONVVARS(SHORT);
3235 int i;
3236
3237 for (i = -16384; i < 16384; i++)
3238 {
3240 }
3241}
HRESULT WINAPI VarCyFromI2(SHORT sIn, CY *pCyOut)
Definition: vartype.c:3441

Referenced by START_TEST().

◆ test_VarCyFromI4()

static void test_VarCyFromI4 ( void  )
static

Definition at line 3254 of file vartype.c.

3255{
3256 CONVVARS(int);
3257
3258 CONVERT(VarCyFromI4, -1); EXPECTCY(-1);
3261 CONVERT(VarCyFromI4, 0x7fffffff); EXPECTCY64(0x1387, 0xffffd8f0);
3262 CONVERT(VarCyFromI4, 0x80000000); EXPECTCY64(0xffffec78, 0);
3263}
HRESULT WINAPI VarCyFromI4(LONG lIn, CY *pCyOut)
Definition: vartype.c:3462

Referenced by START_TEST().

◆ test_VarCyFromI8()

static void test_VarCyFromI8 ( void  )
static

Definition at line 3356 of file vartype.c.

3357{
3359
3360 CONVERT_I8(VarCyFromI8, -214749, 2728163227ul); EXPECT_OVERFLOW;
3361 CONVERT_I8(VarCyFromI8, -214749, 2728163228ul); EXPECTCY64(2147483648ul,15808);
3362 CONVERT(VarCyFromI8, -1); EXPECTCY(-1);
3365 CONVERT_I8(VarCyFromI8, 214748, 1566804068); EXPECTCY64(2147483647ul, 4294951488ul);
3366 CONVERT_I8(VarCyFromI8, 214748, 1566804069); EXPECT_OVERFLOW;
3367}
HRESULT WINAPI VarCyFromI8(LONG64 llIn, CY *pCyOut)
Definition: vartype.c:3742
#define CONVERT_I8(func, hi, lo)
Definition: vartype.c:91

Referenced by START_TEST().

◆ test_VarCyFromR4()

static void test_VarCyFromR4 ( void  )
static

Definition at line 3274 of file vartype.c.

3275{
3276 CONVVARS(FLOAT);
3277
3278 CONVERT(VarCyFromR4, -1.0f); EXPECTCY(-1);
3279 CONVERT(VarCyFromR4, 0.0f); EXPECTCY(0);
3280 CONVERT(VarCyFromR4, 1.0f); EXPECTCY(1);
3281 CONVERT(VarCyFromR4, 1.5f); EXPECTCY(1.5);
3282
3283 CONVERT(VarCyFromR4, -1.5f); EXPECTCY(-1.5);
3284 CONVERT(VarCyFromR4, -0.6f); EXPECTCY(-0.6);
3285 CONVERT(VarCyFromR4, -0.5f); EXPECTCY(-0.5);
3286 CONVERT(VarCyFromR4, -0.4f); EXPECTCY(-0.4);
3287 CONVERT(VarCyFromR4, 0.4f); EXPECTCY(0.4);
3288 CONVERT(VarCyFromR4, 0.5f); EXPECTCY(0.5);
3289 CONVERT(VarCyFromR4, 0.6f); EXPECTCY(0.6);
3290 CONVERT(VarCyFromR4, 1.5f); EXPECTCY(1.5);
3291 CONVERT(VarCyFromR4, 1.00009f); EXPECTCY(1.0001);
3292 CONVERT(VarCyFromR4, -1.00001f); EXPECTCY(-1);
3293 CONVERT(VarCyFromR4, -1.00005f); EXPECTCY(-1);
3294 CONVERT(VarCyFromR4, -0.00009f); EXPECTCY(-0.0001);
3295 CONVERT(VarCyFromR4, -0.00005f); EXPECTCY(0);
3296 CONVERT(VarCyFromR4, -0.00001f); EXPECTCY(0);
3297 CONVERT(VarCyFromR4, 0.00001f); EXPECTCY(0);
3298 CONVERT(VarCyFromR4, 0.00005f); EXPECTCY(0);
3299 CONVERT(VarCyFromR4, 0.00009f); EXPECTCY(0.0001);
3300 CONVERT(VarCyFromR4, -1.00001f); EXPECTCY(-1);
3301 CONVERT(VarCyFromR4, -1.00005f); EXPECTCY(-1);
3302 CONVERT(VarCyFromR4, -1.00009f); EXPECTCY(-1.0001);
3303}
HRESULT WINAPI VarCyFromR4(FLOAT fltIn, CY *pCyOut)
Definition: vartype.c:3483

Referenced by START_TEST().

◆ test_VarCyFromR8()

static void test_VarCyFromR8 ( void  )
static

Definition at line 3305 of file vartype.c.

3306{
3308
3309#if defined(__i386__) && (defined(_MSC_VER) || defined(__GNUC__))
3310 /* Test our rounding is exactly the same. This fails if the special x86
3311 * code is taken out of VarCyFromR8.
3312 */
3313 CONVERT(VarCyFromR8, -461168601842738.7904); EXPECTCY64(0xbfffffff, 0xffffff23);
3314#endif
3315
3316 CONVERT(VarCyFromR8, -4611686018427388416.1); EXPECT_OVERFLOW;
3317 CONVERT(VarCyFromR8, -1.0); EXPECTCY(-1);
3318 CONVERT(VarCyFromR8, -0.0); EXPECTCY(0);
3319 CONVERT(VarCyFromR8, 1.0); EXPECTCY(1);
3320 CONVERT(VarCyFromR8, 4611686018427387648.0); EXPECT_OVERFLOW;
3321
3322 /* Rounding */
3323 CONVERT(VarCyFromR8, -1.5f); EXPECTCY(-1.5);
3324 CONVERT(VarCyFromR8, -0.6f); EXPECTCY(-0.6);
3325 CONVERT(VarCyFromR8, -0.5f); EXPECTCY(-0.5);
3326 CONVERT(VarCyFromR8, -0.4f); EXPECTCY(-0.4);
3327 CONVERT(VarCyFromR8, 0.4f); EXPECTCY(0.4);
3328 CONVERT(VarCyFromR8, 0.5f); EXPECTCY(0.5);
3329 CONVERT(VarCyFromR8, 0.6f); EXPECTCY(0.6);
3330 CONVERT(VarCyFromR8, 1.5f); EXPECTCY(1.5);
3331 CONVERT(VarCyFromR8, 1.00009f); EXPECTCY(1.0001);
3332 CONVERT(VarCyFromR8, -1.00001f); EXPECTCY(-1);
3333 CONVERT(VarCyFromR8, -1.00005f); EXPECTCY(-1);
3334 CONVERT(VarCyFromR8, -0.00009f); EXPECTCY(-0.0001);
3335 CONVERT(VarCyFromR8, -0.00005f); EXPECTCY(0);
3336 CONVERT(VarCyFromR8, -0.00001f); EXPECTCY(0);
3337 CONVERT(VarCyFromR8, 0.00001f); EXPECTCY(0);
3338 CONVERT(VarCyFromR8, 0.00005f); EXPECTCY(0);
3339 CONVERT(VarCyFromR8, 0.00009f); EXPECTCY(0.0001);
3340 CONVERT(VarCyFromR8, -1.00001f); EXPECTCY(-1);
3341 CONVERT(VarCyFromR8, -1.00005f); EXPECTCY(-1);
3342 CONVERT(VarCyFromR8, -1.00009f); EXPECTCY(-1.0001);
3343}

Referenced by START_TEST().

◆ test_VarCyFromUI1()

static void test_VarCyFromUI1 ( void  )
static

Definition at line 3221 of file vartype.c.

3222{
3223 CONVVARS(BYTE);
3224 int i;
3225
3226 for (i = 0; i < 256; i++)
3227 {
3229 }
3230}
HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY *pCyOut)
Definition: vartype.c:3420

Referenced by START_TEST().

◆ test_VarCyFromUI2()

static void test_VarCyFromUI2 ( void  )
static

Definition at line 3243 of file vartype.c.

3244{
3245 CONVVARS(int);
3246 int i;
3247
3248 for (i = 0; i < 32768; i++)
3249 {
3251 }
3252}
HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY *pCyOut)
Definition: vartype.c:3662

Referenced by START_TEST().

◆ test_VarCyFromUI4()

static void test_VarCyFromUI4 ( void  )
static

Definition at line 3265 of file vartype.c.

3266{
3267 CONVVARS(unsigned int);
3268
3271 CONVERT(VarCyFromUI4, 0x80000000); EXPECTCY64(5000, 0);
3272}
HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY *pCyOut)
Definition: vartype.c:3683

Referenced by START_TEST().

◆ test_VarCyFromUI8()

static void test_VarCyFromUI8 ( void  )
static

Definition at line 3369 of file vartype.c.

3370{
3372
3375 CONVERT_I8(VarCyFromUI8, 214748, 1566804068); EXPECTCY64(2147483647ul, 4294951488ul);
3376 CONVERT_I8(VarCyFromUI8, 214748, 1566804069); EXPECTCY64(2147483647ul, 4294961488ul);
3377 CONVERT_I8(VarCyFromUI8, 214748, 1566804070); EXPECT_OVERFLOW;
3378 CONVERT_I8(VarCyFromUI8, 214749, 1566804068); EXPECT_OVERFLOW;
3379}
HRESULT WINAPI VarCyFromUI8(ULONG64 ullIn, CY *pCyOut)
Definition: vartype.c:3764

Referenced by START_TEST().

◆ test_VarCyInt()

static void test_VarCyInt ( void  )
static

Definition at line 3647 of file vartype.c.

3648{
3649 MATHVARS1;
3650
3651 MATHINT(-1.0001); EXPECTCY(-2);
3652 MATHINT(-1.4999); EXPECTCY(-2);
3653 MATHINT(-1.5001); EXPECTCY(-2);
3654 MATHINT(-1.9999); EXPECTCY(-2);
3655 MATHINT(-0.0001); EXPECTCY(-1);
3656 MATHINT(-0.4999); EXPECTCY(-1);
3657 MATHINT(-0.5001); EXPECTCY(-1);
3658 MATHINT(-0.9999); EXPECTCY(-1);
3659 MATHINT(0.0001); EXPECTCY(0);
3660 MATHINT(0.4999); EXPECTCY(0);
3661 MATHINT(0.5001); EXPECTCY(0);
3662 MATHINT(0.9999); EXPECTCY(0);
3663 MATHINT(1.0001); EXPECTCY(1);
3664 MATHINT(1.4999); EXPECTCY(1);
3665 MATHINT(1.5001); EXPECTCY(1);
3666 MATHINT(1.9999); EXPECTCY(1);
3667}
#define MATHINT(l)
Definition: vartype.c:3644

Referenced by START_TEST().

◆ test_VarCyMul()

static void test_VarCyMul ( void  )
static

Definition at line 3465 of file vartype.c.

3466{
3467 MATHVARS2;
3468
3469 MATH2(VarCyMul, 534443.0, 0.0); EXPECTCY(0);
3470 MATH2(VarCyMul, 0.5, 0.5); EXPECTCY(0.25);
3471 MATH2(VarCyMul, 0.5, -0.4); EXPECTCY(-0.2);
3472 MATH2(VarCyMul, 0.5, -0.6); EXPECTCY(-0.3);
3473 MATH2(VarCyMul, -0.5, -0.5); EXPECTCY(0.25);
3474 MATH2(VarCyMul, 922337203685476.0, 20000); EXPECT_OVERFLOW;
3475}
HRESULT WINAPI VarCyMul(CY cyLeft, CY cyRight, CY *pCyOut)
Definition: vartype.c:3808

Referenced by START_TEST().

◆ test_VarCyMulI4()

static void test_VarCyMulI4 ( void  )
static

Definition at line 3514 of file vartype.c.

3515{
3516 MATHVARS1;
3517 LONG right;
3518
3519 MATHMULI4(534443.0, 0); EXPECTCY(0);
3520 MATHMULI4(0.5, 1); EXPECTCY(0.5);
3521 MATHMULI4(0.5, 2); EXPECTCY(1);
3522 MATHMULI4(922337203685476.0, 1); EXPECTCY64(2147483647ul,4294951488ul);
3523 MATHMULI4(922337203685476.0, 2); EXPECT_OVERFLOW;
3524}
#define MATHMULI4(l, r)
Definition: vartype.c:3511

Referenced by START_TEST().

◆ test_VarCyMulI8()

static void test_VarCyMulI8 ( void  )
static

Definition at line 3529 of file vartype.c.

3530{
3531 MATHVARS1;
3532 LONG64 right;
3533
3534 MATHMULI8(534443.0, 0); EXPECTCY(0);
3535 MATHMULI8(0.5, 1); EXPECTCY(0.5);
3536 MATHMULI8(0.5, 2); EXPECTCY(1);
3537 MATHMULI8(922337203685476.0, 1); EXPECTCY64(2147483647ul,4294951488ul);
3538 MATHMULI8(922337203685476.0, 2); EXPECT_OVERFLOW;
3539}
#define MATHMULI8(l, r)
Definition: vartype.c:3526

Referenced by START_TEST().

◆ test_VarCyNeg()

static void test_VarCyNeg ( void  )
static

Definition at line 3501 of file vartype.c.

3502{
3503 MATHVARS1;
3504
3505 MATH1(VarCyNeg, 0.5); EXPECTCY(-0.5);
3506 MATH1(VarCyNeg, -0.5); EXPECTCY(0.5);
3507 MATH1(VarCyNeg, 922337203685476.0); EXPECTCY64(2147483648ul,15808);
3508 MATH1(VarCyNeg, -922337203685476.0); EXPECTCY64(2147483647ul,4294951488ul);
3509}
HRESULT WINAPI VarCyNeg(CY cyIn, CY *pCyOut)
Definition: vartype.c:3951

Referenced by START_TEST().

◆ test_VarCyRound()

static void test_VarCyRound ( void  )
static

Definition at line 3590 of file vartype.c.

3591{
3592 MATHVARS1;
3593 int right;
3594
3595 MATHRND(0.5432, 5); EXPECTCY(0.5432);
3596 MATHRND(0.5432, 4); EXPECTCY(0.5432);
3597 MATHRND(0.5432, 3); EXPECTCY(0.543);
3598 MATHRND(0.5432, 2); EXPECTCY(0.54);
3599 MATHRND(0.5432, 1); EXPECTCY(0.5);
3600 MATHRND(0.5532, 0); EXPECTCY(1);
3601 MATHRND(0.5532, -1); EXPECT_INVALID;
3602
3603 MATHRND(0.5568, 5); EXPECTCY(0.5568);
3604 MATHRND(0.5568, 4); EXPECTCY(0.5568);
3605 MATHRND(0.5568, 3); EXPECTCY(0.557);
3606 MATHRND(0.5568, 2); EXPECTCY(0.56);
3607 MATHRND(0.5568, 1); EXPECTCY(0.6);
3608 MATHRND(0.5568, 0); EXPECTCY(1);
3609 MATHRND(0.5568, -1); EXPECT_INVALID;
3610
3611 MATHRND(0.4999, 0); EXPECTCY(0);
3612 MATHRND(0.5000, 0); EXPECTCY(0);
3613 MATHRND(0.5001, 0); EXPECTCY(1);
3614 MATHRND(1.4999, 0); EXPECTCY(1);
3615 MATHRND(1.5000, 0); EXPECTCY(2);
3616 MATHRND(1.5001, 0); EXPECTCY(2);
3617}
#define MATHRND(l, r)
Definition: vartype.c:3587

Referenced by START_TEST().

◆ test_VarCySub()

static void test_VarCySub ( void  )
static

Definition at line 3477 of file vartype.c.

3478{
3479 MATHVARS2;
3480
3481 MATH2(VarCySub, 0.5, 0.5); EXPECTCY(0);
3482 MATH2(VarCySub, 0.5, -0.4); EXPECTCY(0.9);
3483 MATH2(VarCySub, 0.5, -0.6); EXPECTCY(1.1);
3484 MATH2(VarCySub, -0.5, -0.5); EXPECTCY(0);
3485 MATH2(VarCySub, -922337203685476.0, -922337203685476.0); EXPECTCY(0);
3486 MATH2(VarCySub, -922337203685476.0, 922337203685476.0); EXPECT_OVERFLOW;
3487 MATH2(VarCySub, 922337203685476.0, -922337203685476.0); EXPECT_OVERFLOW;
3488 MATH2(VarCySub, 922337203685476.0, 922337203685476.0); EXPECTCY(0);
3489}
HRESULT WINAPI VarCySub(CY cyLeft, CY cyRight, CY *pCyOut)
Definition: vartype.c:3854

Referenced by START_TEST().

◆ test_VarDateChangeTypeEx()

static void test_VarDateChangeTypeEx ( void  )
static

Definition at line 3151 of file vartype.c.

3152{
3153 static const WCHAR sz25570[] = {
3154 '1','/','2','/','1','9','7','0','\0' };
3155 static const WCHAR sz25570_2[] = {
3156 '1','/','2','/','7','0','\0' };
3157 static const WCHAR sz25570Nls[] = {
3158 '1','/','2','/','1','9','7','0',' ','1','2',':','0','0',':','0','0',' ','A','M','\0' };
3159 HRESULT hres;
3160 DATE in;
3161 VARIANTARG vSrc, vDst;
3162 LCID lcid;
3163
3164 in = 1.0;
3165
3166#ifdef HAS_UINT64_TO_FLOAT
3169#endif
3170
3171 V_VT(&vDst) = VT_EMPTY;
3172 V_VT(&vSrc) = VT_DATE;
3173 V_DATE(&vSrc) = 25570.0;
3175
3176 hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, VARIANT_NOUSEROVERRIDE, VT_BSTR);
3177 ok(hres == S_OK && V_VT(&vDst) == VT_BSTR && V_BSTR(&vDst) &&
3178 (!lstrcmpW(V_BSTR(&vDst), sz25570) || !lstrcmpW(V_BSTR(&vDst), sz25570_2)),
3179 "hres=0x%X, type=%d (should be VT_BSTR), *bstr=%s\n",
3180 hres, V_VT(&vDst), V_BSTR(&vDst) ? wtoascii(V_BSTR(&vDst)) : "?");
3181 VariantClear(&vDst);
3182
3184 if (has_locales)
3185 {
3187 ok(hres == S_OK && V_VT(&vDst) == VT_BSTR && V_BSTR(&vDst) && !lstrcmpW(V_BSTR(&vDst), sz25570Nls),
3188 "hres=0x%X, type=%d (should be VT_BSTR), *bstr=%s\n",
3189 hres, V_VT(&vDst), V_BSTR(&vDst) ? wtoascii(V_BSTR(&vDst)) : "?");
3190 VariantClear(&vDst);
3191 }
3192}
#define VARIANT_USE_NLS
Definition: oleauto.h:317
#define VARIANT_NOUSEROVERRIDE
Definition: oleauto.h:312

Referenced by START_TEST().

◆ test_VarDateCopy()

static void test_VarDateCopy ( void  )
static

Definition at line 3138 of file vartype.c.

3139{
3140 COPYTEST(77665544.0, VT_DATE, V_DATE(&vSrc), V_DATE(&vDst), V_DATEREF(&vSrc),
3141 V_DATEREF(&vDst), "%16.16g");
3142}
#define V_DATEREF(A)
Definition: oleauto.h:232

Referenced by START_TEST().

◆ test_VarDateFromBool()

static void test_VarDateFromBool ( void  )
static

Definition at line 2876 of file vartype.c.

2877{
2879
2880 CONVERT(VarDateFromBool, VARIANT_TRUE); EXPECT(VARIANT_TRUE * 1.0);
2881 CONVERT(VarDateFromBool, VARIANT_FALSE); EXPECT(VARIANT_FALSE * 1.0);
2882}
HRESULT WINAPI VarDateFromBool(VARIANT_BOOL boolIn, DATE *pdateOut)
Definition: vartype.c:7332

Referenced by START_TEST().

◆ test_VarDateFromCy()

static void test_VarDateFromCy ( void  )
static

Definition at line 2884 of file vartype.c.

2885{
2886 CONVVARS(CY);
2887
2888 CONVERT_CY(VarDateFromCy,-32769); EXPECT(-32769.0);
2889 CONVERT_CY(VarDateFromCy,-32768); EXPECT(-32768.0);
2890 CONVERT_CY(VarDateFromCy,-1); EXPECT(-1.0);
2893 CONVERT_CY(VarDateFromCy,32767); EXPECT(32767.0);
2894 CONVERT_CY(VarDateFromCy,32768); EXPECT(32768.0);
2895
2896 CONVERT_CY(VarDateFromCy,-1.5); EXPECT(-1.5);
2897 CONVERT_CY(VarDateFromCy,-0.6); EXPECT(-0.6);
2898 CONVERT_CY(VarDateFromCy,-0.5); EXPECT(-0.5);
2899 CONVERT_CY(VarDateFromCy,-0.4); EXPECT(-0.4);
2900 CONVERT_CY(VarDateFromCy,0.4); EXPECT(0.4);
2901 CONVERT_CY(VarDateFromCy,0.5); EXPECT(0.5);
2902 CONVERT_CY(VarDateFromCy,0.6); EXPECT(0.6);
2903 CONVERT_CY(VarDateFromCy,1.5); EXPECT(1.5);
2904}
HRESULT WINAPI VarDateFromCy(CY cyIn, DATE *pdateOut)
Definition: vartype.c:7349

Referenced by START_TEST().

◆ test_VarDateFromDec()

static void test_VarDateFromDec ( void  )
static

Definition at line 2929 of file vartype.c.

2930{
2932
2934
2935 CONVERT_DEC(VarDateFromDec,0,0x80,0,32768); EXPECT(-32768.0);
2936 CONVERT_DEC(VarDateFromDec,0,0x80,0,1); EXPECT(-1.0);
2937 CONVERT_DEC(VarDateFromDec,0,0,0,0); EXPECT(0.0);
2938 CONVERT_DEC(VarDateFromDec,0,0,0,1); EXPECT(1.0);
2939 CONVERT_DEC(VarDateFromDec,0,0,0,32767); EXPECT(32767.0);
2940
2941 CONVERT_DEC(VarDateFromDec,2,0x80,0,3276800); EXPECT(-32768.0);
2942 CONVERT_DEC(VarDateFromDec,2,0,0,3276700); EXPECT(32767.0);
2943}
HRESULT WINAPI VarDateFromDec(DECIMAL *pdecIn, DATE *pdateOut)
Definition: vartype.c:8005

Referenced by START_TEST().

◆ test_VarDateFromI1()

static void test_VarDateFromI1 ( void  )
static

Definition at line 2795 of file vartype.c.

2796{
2797 CONVVARS(signed char);
2798 int i;
2799
2800 CONVERTRANGE(VarDateFromI1, -128, 128);
2801}
HRESULT WINAPI VarDateFromI1(signed char cIn, DATE *pdateOut)
Definition: vartype.c:7954

Referenced by START_TEST().

◆ test_VarDateFromI2()

static void test_VarDateFromI2 ( void  )
static

Definition at line 2811 of file vartype.c.

2812{
2813 CONVVARS(SHORT);
2814 int i;
2815
2816 CONVERTRANGE(VarDateFromI2, -32768, 32768);
2817}
HRESULT WINAPI VarDateFromI2(short sIn, DATE *pdateOut)
Definition: vartype.c:7241

Referenced by START_TEST().

◆ test_VarDateFromI4()

static void test_VarDateFromI4 ( void  )
static

Definition at line 2827 of file vartype.c.

2828{
2829 CONVVARS(int);
2830
2832 if (hres != DISP_E_TYPEMISMATCH) /* Early versions return this, incorrectly */
2835 CONVERT(VarDateFromI4, -1); EXPECT(-1.0);
2836 CONVERT(VarDateFromI4, 0); EXPECT(0.0);
2837 CONVERT(VarDateFromI4, 1); EXPECT(1.0);
2840 if (hres != DISP_E_TYPEMISMATCH) /* Early versions return this, incorrectly */
2842}
HRESULT WINAPI VarDateFromI4(LONG lIn, DATE *pdateOut)
Definition: vartype.c:7258
#define DATE_MAX
Definition: variant.h:69
#define DATE_MIN
Definition: variant.h:70

Referenced by START_TEST().

◆ test_VarDateFromI8()

static void test_VarDateFromI8 ( void  )
static

Definition at line 2906 of file vartype.c.

2907{
2909
2912 CONVERT(VarDateFromI8, -1); EXPECT(-1.0);
2913 CONVERT(VarDateFromI8, 0); EXPECT(0.0);
2914 CONVERT(VarDateFromI8, 1); EXPECT(1.0);
2917}
HRESULT WINAPI VarDateFromI8(LONG64 llIn, DATE *pdateOut)
Definition: vartype.c:8023

Referenced by START_TEST().

◆ test_VarDateFromR4()

static void test_VarDateFromR4 ( void  )
static

Definition at line 2856 of file vartype.c.

2857{
2858 CONVVARS(FLOAT);
2859
2860 CONVERT(VarDateFromR4, -1.0f); EXPECT(-1.0);
2861 CONVERT(VarDateFromR4, 0.0f); EXPECT(0.0);
2862 CONVERT(VarDateFromR4, 1.0f); EXPECT(1.0);
2863 CONVERT(VarDateFromR4, 1.5f); EXPECT(1.5);
2864}
HRESULT WINAPI VarDateFromR4(FLOAT fltIn, DATE *pdateOut)
Definition: vartype.c:7275

Referenced by START_TEST().

◆ test_VarDateFromR8()

static void test_VarDateFromR8 ( void  )
static

Definition at line 2866 of file vartype.c.

2867{
2868 CONVVARS(double);
2869
2870 CONVERT(VarDateFromR8, -1.0f); EXPECT(-1.0);
2871 CONVERT(VarDateFromR8, 0.0f); EXPECT(0.0);
2872 CONVERT(VarDateFromR8, 1.0f); EXPECT(1.0);
2873 CONVERT(VarDateFromR8, 1.5f); EXPECT(1.5);
2874}
HRESULT WINAPI VarDateFromR8(double dblIn, DATE *pdateOut)
Definition: vartype.c:7292

Referenced by START_TEST().

◆ test_VarDateFromStr()

static void test_VarDateFromStr ( void  )
static

Definition at line 2985 of file vartype.c.

2986{
2987 LCID lcid;
2988 DATE out, relative;
2989 HRESULT hres;
2990 SYSTEMTIME st;
2991 OLECHAR buff[128];
2992 size_t i;
2993 OLECHAR with_ideographic_spaceW[] = { '6','/','3','0','/','2','0','1','1',0x3000,
2994 '1',':','2','0',':','3','4',0 };
2995
2997
2998 /* Some date formats are relative, so we need to find the current year */
2999 GetSystemTime(&st);
3000 st.wHour = st.wMinute = st.wSecond = st.wMilliseconds = 0;
3002
3003 /* Floating point number are not recognised */
3004 DFS("0.0");
3005 if (hres == S_OK)
3006 EXPECT_DBL(0.0); /* Very old versions accept this string */
3007 else
3009
3010 /* 1 element - can only be a time, and only if it has am/pm */
3011 DFS("1 am"); EXPECT_DBL(0.04166666666666666);
3012 /* 2 elements */
3013 /* A decimal point is treated as a time separator.
3014 * The following are converted as hours/minutes.
3015 */
3016 DFS("0.1"); EXPECT_DBL(0.0006944444444444445);
3017 DFS("0.40"); EXPECT_DBL(0.02777777777777778);
3018 DFS("2.5"); EXPECT_DBL(0.08680555555555555);
3019 /* A colon acts as a decimal point */
3020 DFS("0:1"); EXPECT_DBL(0.0006944444444444445);
3021 DFS("0:20"); EXPECT_DBL(0.01388888888888889);
3022 DFS("0:40"); EXPECT_DBL(0.02777777777777778);
3023 DFS("3:5"); EXPECT_DBL(0.1284722222222222);
3024 /* Check the am/pm limits */
3025 DFS("00:00 AM"); EXPECT_DBL(0.0);
3026 DFS("00:00 a"); EXPECT_DBL(0.0);
3027 DFS("12:59 AM"); EXPECT_DBL(0.04097222222222222);
3028 DFS("12:59 A"); EXPECT_DBL(0.04097222222222222);
3029 DFS("00:00 pm"); EXPECT_DBL(0.5);
3030 DFS("00:00 p"); EXPECT_DBL(0.5);
3031 DFS("12:59 pm"); EXPECT_DBL(0.5409722222222222);
3032 DFS("12:59 p"); EXPECT_DBL(0.5409722222222222);
3033 /* AM/PM is ignored if hours > 12 */
3034 DFS("13:00 AM"); EXPECT_DBL(0.5416666666666666);
3035 DFS("13:00 PM"); EXPECT_DBL(0.5416666666666666);
3036
3037 /* Space, dash and slash all indicate a date format. */
3038 /* If both numbers are valid month values => month/day of current year */
3039 DFS("1 2"); MKRELDATE(2,1); EXPECT_DBL(relative);
3040 DFS("2 1"); MKRELDATE(1,2); EXPECT_DBL(relative);
3041 /* one number not valid month, is a valid day, other number valid month:
3042 * that number becomes the day.
3043 */
3044 DFS("14 1"); MKRELDATE(14,1); EXPECT_DBL(relative);
3045 DFS("1 14"); EXPECT_DBL(relative);
3046 /* If the numbers can't be day/month, they are assumed to be year/month */
3047 DFS("30 2"); EXPECT_DBL(10990.0);
3048 DFS("2 30"); EXPECT_DBL(10990.0);
3049 DFS("32 49"); EXPECT_MISMATCH; /* Can't be any format */
3050 DFS("0 49"); EXPECT_MISMATCH; /* Can't be any format */
3051 /* If a month name is given the other number is the day */
3052 DFS("Jan 2"); MKRELDATE(2,1); EXPECT_DBL(relative);
3053 DFS("2 Jan"); EXPECT_DBL(relative);
3054 /* Unless it can't be, in which case it becomes the year */
3055 DFS("Jan 35"); EXPECT_DBL(12785.0);
3056 DFS("35 Jan"); EXPECT_DBL(12785.0);
3057 DFS("Jan-35"); EXPECT_DBL(12785.0);
3058 DFS("35-Jan"); EXPECT_DBL(12785.0);
3059 DFS("Jan/35"); EXPECT_DBL(12785.0);
3060 DFS("35/Jan"); EXPECT_DBL(12785.0);
3061 /* 3 elements */
3062 /* 3 numbers and time separator => h:m:s */
3063 DFS("0.1.0"); EXPECT_DBL(0.0006944444444444445);
3064 DFS("1.5.2"); EXPECT_DBL(0.04516203703703704);
3065 /* 3 numbers => picks date giving preference to lcid format */
3066 DFS("1 2 3"); EXPECT_DBL(37623.0);
3067 DFS("14 2 3"); EXPECT_DBL(41673.0);
3068 DFS("2 14 3"); EXPECT_DBL(37666.0);
3069 DFS("2 3 14"); EXPECT_DBL(41673.0);
3070 DFS("32 2 3"); EXPECT_DBL(11722.0);
3071 DFS("2 3 32"); EXPECT_DBL(11722.0);
3072 DFS("1 2 29"); EXPECT_DBL(47120.0);
3073 /* After 30, two digit dates are expected to be in the 1900's */
3074 DFS("1 2 30"); EXPECT_DBL(10960.0);
3075 DFS("1 2 31"); EXPECT_DBL(11325.0);
3076 DFS("3 am 1 2"); MKRELDATE(2,1); relative += 0.125; EXPECT_DBL(relative);
3077 DFS("1 2 3 am"); EXPECT_DBL(relative);
3078
3079 /* 4 elements -interpreted as 2 digit date & time */
3080 DFS("1.2 3 4"); MKRELDATE(4,3); relative += 0.04305555556; EXPECT_DBL(relative);
3081 DFS("3 4 1.2"); EXPECT_DBL(relative);
3082 /* 5 elements - interpreted as 2 & 3 digit date/times */
3083 DFS("1.2.3 4 5"); MKRELDATE(5,4); relative += 0.04309027778; EXPECT_DBL(relative);
3084 DFS("1.2 3 4 5"); EXPECT_DBL(38415.04305555556);
3085#if 0
3086 /* following throws an exception on winME */
3087 DFS("1 2 3.4.5"); MKRELDATE(2,1); relative += 0.12783564815; EXPECT_DBL(relative);
3088#endif
3089 DFS("1 2 3 4.5"); EXPECT_DBL(37623.17013888889);
3090 /* 6 elements - interpreted as 3 digit date/times */
3091 DFS("1.2.3 4 5 6"); EXPECT_DBL(38812.04309027778);
3092 DFS("1 2 3 4.5.6"); EXPECT_DBL(37623.17020833334);
3093
3094 for (i = 0; i < ARRAY_SIZE(BadDateStrings); i++)
3095 {
3097 }
3098
3099 /* Some normal-ish strings */
3100 DFS("2 January, 1970"); EXPECT_DBL(25570.0);
3101 DFS("2 January 1970"); EXPECT_DBL(25570.0);
3102 DFS("2 Jan 1970"); EXPECT_DBL(25570.0);
3103 DFS("2/Jan/1970"); EXPECT_DBL(25570.0);
3104 DFS("2-Jan-1970"); EXPECT_DBL(25570.0);
3105 DFS("1 2 1970"); EXPECT_DBL(25570.0);
3106 DFS("1/2/1970"); EXPECT_DBL(25570.0);
3107 DFS("1-2-1970"); EXPECT_DBL(25570.0);
3108 DFS("13-1-1970"); EXPECT_DBL(25581.0);
3109 DFS("1970-1-13"); EXPECT_DBL(25581.0);
3110 DFS("6/30/2011 01:20:34"); EXPECT_DBL(40724.05594907407);
3111 DFS("6/30/2011 01:20:34 AM"); EXPECT_DBL(40724.05594907407);
3112 DFS("6/30/2011 01:20:34 PM"); EXPECT_DBL(40724.55594907407);
3113 DFS("2013-05-14 02:04:12"); EXPECT_DBL(41408.08625000001);
3114 DFS("2013-05-14 02:04:12.017000000"); EXPECT_MISMATCH;
3115 /* Native fails "1999 January 3, 9AM". I consider that a bug in native */
3116
3117 /* test a data with ideographic space */
3118 out = 0.0;
3119 hres = VarDateFromStr(with_ideographic_spaceW, lcid, LOCALE_NOUSEROVERRIDE, &out);
3120 EXPECT_DBL(40724.05594907407);
3121
3122 /* test a non-english data string */
3123 DFS("02.01.1970"); EXPECT_MISMATCH;
3124 DFS("02.01.1970 00:00:00"); EXPECT_MISMATCH;
3126 DFS("02.01.1970"); EXPECT_DBL(25570.0);
3127 DFS("02.13.1970"); EXPECT_DBL(25612.0);
3128 DFS("02-13-1970"); EXPECT_DBL(25612.0);
3129 DFS("2020-01-11"); EXPECT_DBL(43841.0);
3130 DFS("2173-10-14"); EXPECT_DBL(100000.0);
3131
3132 DFS("02.01.1970 00:00:00"); EXPECT_DBL(25570.0);
3134 DFS("02.01.1970"); EXPECT_MISMATCH;
3135 DFS("02.01.1970 00:00:00"); EXPECT_MISMATCH;
3136}
VOID WINAPI GetSystemTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:327
#define EXPECT_DBL(x)
Definition: vartype.c:79
#define MKRELDATE(day, mth)
Definition: vartype.c:2950
#define DFS(str)
Definition: vartype.c:2945
static const char *const BadDateStrings[]
Definition: vartype.c:2953
#define LANG_GERMAN
Definition: nls.h:62
#define SUBLANG_GERMAN
Definition: nls.h:251
WORD wMilliseconds
Definition: winbase.h:936
WORD wHour
Definition: winbase.h:933
WORD wSecond
Definition: winbase.h:935
WORD wMinute
Definition: winbase.h:934

Referenced by START_TEST().

◆ test_VarDateFromUI1()

static void test_VarDateFromUI1 ( void  )
static

Definition at line 2803 of file vartype.c.

2804{
2805 CONVVARS(BYTE);
2806 int i;
2807
2809}
HRESULT WINAPI VarDateFromUI1(BYTE bIn, DATE *pdateOut)
Definition: vartype.c:7224

Referenced by START_TEST().

◆ test_VarDateFromUI2()

static void test_VarDateFromUI2 ( void  )
static

Definition at line 2819 of file vartype.c.

2820{
2822 int i;
2823
2824 CONVERTRANGE(VarDateFromUI2, 0, 65536);
2825}
HRESULT WINAPI VarDateFromUI2(USHORT uiIn, DATE *pdateOut)
Definition: vartype.c:7971

Referenced by START_TEST().

◆ test_VarDateFromUI4()

static void test_VarDateFromUI4 ( void  )
static

Definition at line 2844 of file vartype.c.

2845{
2846 CONVVARS(unsigned int);
2847
2848 CONVERT(VarDateFromUI4, 0); EXPECT(0.0);
2849 CONVERT(VarDateFromUI4, 1); EXPECT(1.0);
2852 if (hres != DISP_E_TYPEMISMATCH) /* Early versions return this, incorrectly */
2854}
HRESULT WINAPI VarDateFromUI4(ULONG ulIn, DATE *pdateOut)
Definition: vartype.c:7988

Referenced by START_TEST().

◆ test_VarDateFromUI8()

static void test_VarDateFromUI8 ( void  )
static

Definition at line 2919 of file vartype.c.

2920{
2922
2923 CONVERT(VarDateFromUI8, 0); EXPECT(0.0);
2924 CONVERT(VarDateFromUI8, 1); EXPECT(1.0);
2927}
HRESULT WINAPI VarDateFromUI8(ULONG64 ullIn, DATE *pdateOut)
Definition: vartype.c:8043

Referenced by START_TEST().

◆ test_VarDecAbs()

static void test_VarDecAbs ( void  )
static

Definition at line 3881 of file vartype.c.

3882{
3883 MATHVARS1;
3884
3885 SETDEC(l,0,0x80,0,1); MATH1(VarDecAbs); EXPECTDEC(0,0,0,1);
3886 SETDEC(l,0,0,0,0); MATH1(VarDecAbs); EXPECTDEC(0,0,0,0);
3887 SETDEC(l,0,0x80,0,0); MATH1(VarDecAbs); EXPECTDEC(0,0,0,0);
3888 SETDEC(l,0,0,0,1); MATH1(VarDecAbs); EXPECTDEC(0,0,0,1);
3889
3890 /* Doesn't check for invalid input */
3891 SETDEC(l,0,0x7f,0,1); MATH1(VarDecAbs); EXPECTDEC(0,0x7f,0,1);
3892 SETDEC(l,0,0x80,29,1); MATH1(VarDecAbs); EXPECTDEC(0,0,29,1);
3893}
HRESULT WINAPI VarDecAbs(const DECIMAL *pDecIn, DECIMAL *pDecOut)
Definition: vartype.c:5698
#define SETDEC(dec, scl, sgn, hi, lo)
Definition: vartype.c:97
#define EXPECTDEC(scl, sgn, hi, lo)
Definition: vartype.c:3676

Referenced by START_TEST().

◆ test_VarDecAdd()

static void test_VarDecAdd ( void  )
static

Definition at line 3910 of file vartype.c.

3911{
3912 MATHVARS2;
3913
3914 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,0); MATH2(VarDecAdd); EXPECTDEC(0,0,0,0);
3915 SETDEC(l,0,0,0,0); SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0x80,0,1);
3916 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,0,1);
3917
3918 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,0); MATH2(VarDecAdd); EXPECTDEC(0,0,0,1);
3919 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,0,2);
3920 SETDEC(l,0,0,0,1); SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd); EXPECTDECZERO();
3921 SETDEC(l,0,0,0,1); SETDEC(r,0,0x80,0,2); MATH2(VarDecAdd); EXPECTDEC(0,0x80,0,1);
3922
3923 SETDEC(l,0,0x80,0,0); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,0,1);
3924 SETDEC(l,0,0x80,0,1); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDECZERO();
3925 SETDEC(l,0,0x80,0,1); SETDEC(r,0,0,0,2); MATH2(VarDecAdd); EXPECTDEC(0,0,0,1);
3926 SETDEC(l,0,0x80,0,1); SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0x80,0,2);
3927 SETDEC(l,0,0x80,0,2); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0x80,0,1);
3928
3929 SETDEC(l,0,0,0,0xffffffff); SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,0,0xfffffffe);
3930 SETDEC(l,0,0,0,0xffffffff); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,0,(ULONG64)1 << 32);
3931 SETDEC(l,0,0,0,0xffffffff); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,0,(ULONG64)1 << 32);
3932
3933 SETDEC64(l,0,0,0,0xffffffff,0); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC64(0,0,0,0xffffffff,1);
3934 SETDEC64(l,0,0,0,0xffffffff,0); SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd);
3935 EXPECTDEC64(0,0,0,0xfffffffe,0xffffffff);
3936
3937 SETDEC64(l,0,0,0,0xffffffff,0xffffffff); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,1,0);
3938 SETDEC64(l,0,0,0,0xffffffff,0xffffffff); SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd);
3939 EXPECTDEC64(0,0,0,0xffffffff,0xfffffffe);
3940
3941 SETDEC(l,0,0,0xffffffff,0); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(0,0,0xffffffff,1);
3942 SETDEC(l,0,0,0xffffffff,0); SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd);
3943 EXPECTDEC64(0,0,0xfffffffe,0xffffffff,0xffffffff);
3944
3945 SETDEC64(l,0,0,0xffffffff,0xffffffff,0xffffffff);SETDEC(r,0,0x80,0,1); MATH2(VarDecAdd);
3946 EXPECTDEC64(0,0,0xffffffff,0xffffffff,0xfffffffe);
3947 SETDEC64(l,0,0,0xffffffff,0xffffffff,0xffffffff);SETDEC(r,0,0,0,1); MATH2(VarDecAdd);
3948 ok(hres == DISP_E_OVERFLOW,"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
3949 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
3950
3951 SETDEC64(l,1,0,0xffffffff,0xffffffff,0xffffffff);SETDEC(r,1,0,0,1); MATH2(VarDecAdd);
3952 todo_wine EXPECTDEC64(0,0,0x19999999,0x99999999,0x9999999A);
3953
3954 SETDEC64(l,0,0,0xe22ea493,0xb30310a7,0x70000000);SETDEC64(r,0,0,0xe22ea493,0xb30310a7,0x70000000); MATH2(VarDecAdd);
3955 ok(hres == DISP_E_OVERFLOW,"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
3956 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
3957
3958 SETDEC64(l,1,0,0xe22ea493,0xb30310a7,0x70000000);SETDEC64(r,1,0,0xe22ea493,0xb30310a7,0x70000000); MATH2(VarDecAdd);
3959 todo_wine EXPECTDEC64(0,0,0x2d3c8750,0xbd670354,0xb0000000);
3960
3961 SETDEC(l,3,128,0,123456); SETDEC64(r,0,0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF);
3962 MATH2(VarDecAdd); EXPECTDEC64(0,0,-1,0xFFFFFFFF,0xFFFFFF84);
3963
3964 SETDEC(l,3,0,0,123456); SETDEC64(r,0,0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF); MATH2(VarDecAdd);
3965 ok(hres == DISP_E_OVERFLOW,"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
3966 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
3967
3968 SETDEC(l,4,0,0,123456); SETDEC64(r,0,0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF); MATH2(VarDecAdd);
3969 ok(hres == DISP_E_OVERFLOW,"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
3970 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
3971
3972 SETDEC(l,5,0,0,123456); SETDEC64(r,0,0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF); MATH2(VarDecAdd);
3973 ok(hres == DISP_E_OVERFLOW,"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
3974 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
3975
3976 SETDEC(l,6,0,0,123456); SETDEC64(r,0,0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF);
3977 MATH2(VarDecAdd); EXPECTDEC64(0,0,-1,0xFFFFFFFF,0xFFFFFFFF);
3978
3979 SETDEC(l,3,128,0,123456); SETDEC64(r,0,0,0x19999999,0x99999999,0x99999999);
3980 MATH2(VarDecAdd); EXPECTDEC64(1,0,-1,0xFFFFFFFF,0xFFFFFB27);
3981
3982 SETDEC(l,3,128,0,123567); SETDEC64(r,0,0,0x19999999,0x99999999,0x99999999);
3983 MATH2(VarDecAdd); EXPECTDEC64(1,0,-1,0xFFFFFFFF,0xFFFFFB26);
3984
3985 /* Promotes to the highest scale, so here the results are in the scale of 2 */
3986 SETDEC(l,2,0,0,0); SETDEC(r,0,0,0,0); MATH2(VarDecAdd); EXPECTDEC(2,0,0,0);
3987 SETDEC(l,2,0,0,100); SETDEC(r,0,0,0,1); MATH2(VarDecAdd); EXPECTDEC(2,0,0,200);
3988}
HRESULT WINAPI VarDecAdd(const DECIMAL *pDecLeft, const DECIMAL *pDecRight, DECIMAL *pDecOut)
Definition: vartype.c:4588
#define EXPECTDEC64(scl, sgn, hi, mid, lo)
Definition: vartype.c:3683
#define EXPECTDECZERO()
Definition: vartype.c:3692
#define DISP_E_OVERFLOW
Definition: winerror.h:2519

Referenced by START_TEST().

◆ test_VarDecCmp()

static void test_VarDecCmp ( void  )
static

Definition at line 4099 of file vartype.c.

4100{
4101 MATHVARS1;
4102
4103 SETDEC(l,0,0,0,1); SETDEC(out,0,0,0,1); MATH1(VarDecCmp); EXPECT_EQ;
4104 SETDEC(l,0,0,0,1); SETDEC(out,0,0,0,0); MATH1(VarDecCmp); EXPECT_GT;
4105 SETDEC(l,0,0,0,1); SETDEC(out,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4106
4107 SETDEC(l,0,0,0,1); SETDEC(out,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_GT;
4108 SETDEC(l,0,0,0,1); SETDEC(out,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_GT;
4109 SETDEC(l,0,0,0,1); SETDEC(out,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4110
4111 SETDEC(l,0,DECIMAL_NEG,0,1); SETDEC(out,0,0,0,1); MATH1(VarDecCmp); EXPECT_LT;
4112 SETDEC(l,0,DECIMAL_NEG,0,1); SETDEC(out,0,0,0,0); MATH1(VarDecCmp); EXPECT_LT;
4113 SETDEC(l,0,DECIMAL_NEG,0,1); SETDEC(out,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4114
4115 SETDEC(l,0,DECIMAL_NEG,0,1); SETDEC(out,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_EQ;
4116 SETDEC(l,0,DECIMAL_NEG,0,1); SETDEC(out,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_LT;
4117 SETDEC(l,0,DECIMAL_NEG,0,1); SETDEC(out,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4118
4119 SETDEC(l,0,0,0,0); SETDEC(out,0,0,0,1); MATH1(VarDecCmp); EXPECT_LT;
4120 SETDEC(l,0,0,0,0); SETDEC(out,0,0,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4121 SETDEC(l,0,0,0,0); SETDEC(out,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4122
4123 SETDEC(l,0,0,0,0); SETDEC(out,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_GT;
4124 SETDEC(l,0,0,0,0); SETDEC(out,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4125 SETDEC(l,0,0,0,0); SETDEC(out,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4126
4127 SETDEC(l,0,DECIMAL_NEG,0,0); SETDEC(out,0,0,0,1); MATH1(VarDecCmp); EXPECT_LT;
4128 SETDEC(l,0,DECIMAL_NEG,0,0); SETDEC(out,0,0,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4129 SETDEC(l,0,DECIMAL_NEG,0,0); SETDEC(out,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4130
4131 SETDEC(l,0,DECIMAL_NEG,0,0); SETDEC(out,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_GT;
4132 SETDEC(l,0,DECIMAL_NEG,0,0); SETDEC(out,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4133 SETDEC(l,0,DECIMAL_NEG,0,0); SETDEC(out,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4134
4135 SETDEC(l,0,0,-1,-1); SETDEC(out,0,0,0,1); MATH1(VarDecCmp); EXPECT_GT;
4136 SETDEC(l,0,0,-1,-1); SETDEC(out,0,0,0,0); MATH1(VarDecCmp); EXPECT_GT;
4137 SETDEC(l,0,0,-1,-1); SETDEC(out,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_EQ;
4138
4139 SETDEC(l,0,0,-1,-1); SETDEC(out,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_GT;
4140 SETDEC(l,0,0,-1,-1); SETDEC(out,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_GT;
4141 SETDEC(l,0,0,-1,-1); SETDEC(out,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4142
4143 SETDEC(l,0,DECIMAL_NEG,-1,-1); SETDEC(out,0,0,0,1); MATH1(VarDecCmp); EXPECT_LT;
4144 SETDEC(l,0,DECIMAL_NEG,-1,-1); SETDEC(out,0,0,0,0); MATH1(VarDecCmp); EXPECT_LT;
4145 SETDEC(l,0,DECIMAL_NEG,-1,-1); SETDEC(out,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4146
4147 SETDEC(l,0,DECIMAL_NEG,-1,-1); SETDEC(out,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_LT;
4148 SETDEC(l,0,DECIMAL_NEG,-1,-1); SETDEC(out,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_LT;
4149 SETDEC(l,0,DECIMAL_NEG,-1,-1); SETDEC(out,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_EQ;
4150
4151
4152 SETDEC(out,0,0,0,1); SETDEC(l,0,0,0,1); MATH1(VarDecCmp); EXPECT_EQ;
4153 SETDEC(out,0,0,0,1); SETDEC(l,0,0,0,0); MATH1(VarDecCmp); EXPECT_LT;
4154 SETDEC(out,0,0,0,1); SETDEC(l,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4155
4156 SETDEC(out,0,0,0,1); SETDEC(l,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_LT;
4157 SETDEC(out,0,0,0,1); SETDEC(l,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_LT;
4158 SETDEC(out,0,0,0,1); SETDEC(l,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4159
4160 SETDEC(out,0,DECIMAL_NEG,0,1); SETDEC(l,0,0,0,1); MATH1(VarDecCmp); EXPECT_GT;
4161 SETDEC(out,0,DECIMAL_NEG,0,1); SETDEC(l,0,0,0,0); MATH1(VarDecCmp); EXPECT_GT;
4162 SETDEC(out,0,DECIMAL_NEG,0,1); SETDEC(l,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4163
4164 SETDEC(out,0,DECIMAL_NEG,0,1); SETDEC(l,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_EQ;
4165 SETDEC(out,0,DECIMAL_NEG,0,1); SETDEC(l,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_GT;
4166 SETDEC(out,0,DECIMAL_NEG,0,1); SETDEC(l,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4167
4168 SETDEC(out,0,0,0,0); SETDEC(l,0,0,0,1); MATH1(VarDecCmp); EXPECT_GT;
4169 SETDEC(out,0,0,0,0); SETDEC(l,0,0,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4170 SETDEC(out,0,0,0,0); SETDEC(l,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4171
4172 SETDEC(out,0,0,0,0); SETDEC(l,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_LT;
4173 SETDEC(out,0,0,0,0); SETDEC(l,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4174 SETDEC(out,0,0,0,0); SETDEC(l,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4175
4176 SETDEC(out,0,DECIMAL_NEG,0,0); SETDEC(l,0,0,0,1); MATH1(VarDecCmp); EXPECT_GT;
4177 SETDEC(out,0,DECIMAL_NEG,0,0); SETDEC(l,0,0,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4178 SETDEC(out,0,DECIMAL_NEG,0,0); SETDEC(l,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4179
4180 SETDEC(out,0,DECIMAL_NEG,0,0); SETDEC(l,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_LT;
4181 SETDEC(out,0,DECIMAL_NEG,0,0); SETDEC(l,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_EQ;
4182 SETDEC(out,0,DECIMAL_NEG,0,0); SETDEC(l,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4183
4184 SETDEC(out,0,0,-1,-1); SETDEC(l,0,0,0,1); MATH1(VarDecCmp); EXPECT_LT;
4185 SETDEC(out,0,0,-1,-1); SETDEC(l,0,0,0,0); MATH1(VarDecCmp); EXPECT_LT;
4186 SETDEC(out,0,0,-1,-1); SETDEC(l,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_EQ;
4187
4188 SETDEC(out,0,0,-1,-1); SETDEC(l,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_LT;
4189 SETDEC(out,0,0,-1,-1); SETDEC(l,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_LT;
4190 SETDEC(out,0,0,-1,-1); SETDEC(l,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_LT;
4191
4192 SETDEC(out,0,DECIMAL_NEG,-1,-1); SETDEC(l,0,0,0,1); MATH1(VarDecCmp); EXPECT_GT;
4193 SETDEC(out,0,DECIMAL_NEG,-1,-1); SETDEC(l,0,0,0,0); MATH1(VarDecCmp); EXPECT_GT;
4194 SETDEC(out,0,DECIMAL_NEG,-1,-1); SETDEC(l,0,0,-1,-1); MATH1(VarDecCmp); EXPECT_GT;
4195
4196 SETDEC(out,0,DECIMAL_NEG,-1,-1); SETDEC(l,0,DECIMAL_NEG,0,1); MATH1(VarDecCmp); EXPECT_GT;
4197 SETDEC(out,0,DECIMAL_NEG,-1,-1); SETDEC(l,0,DECIMAL_NEG,0,0); MATH1(VarDecCmp); EXPECT_GT;
4198 SETDEC(out,0,DECIMAL_NEG,-1,-1); SETDEC(l,0,DECIMAL_NEG,-1,-1); MATH1(VarDecCmp); EXPECT_EQ;
4199
4200 SETDEC(l,3,0,0,123456); SETDEC64(out,0,0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF);
4202}
HRESULT WINAPI VarDecCmp(const DECIMAL *pDecLeft, const DECIMAL *pDecRight)
Definition: vartype.c:5866

Referenced by START_TEST().

◆ test_VarDecCmpR8()

static void test_VarDecCmpR8 ( void  )
static

Definition at line 4204 of file vartype.c.

4205{
4206 HRESULT hres;
4207 DECIMAL l;
4208 double r;
4209
4210 SETDEC(l,0,0,0,1); r = 0.0; MATH3(VarDecCmpR8); EXPECT_GT;
4211 SETDEC(l,0,0,0,1); r = 0.1; MATH3(VarDecCmpR8); EXPECT_GT;
4212 SETDEC(l,0,0,0,1); r = -0.1; MATH3(VarDecCmpR8); EXPECT_GT;
4213
4214 SETDEC(l,0,DECIMAL_NEG,0,1); r = 0.0; MATH3(VarDecCmpR8); EXPECT_LT;
4215 SETDEC(l,0,DECIMAL_NEG,0,1); r = 0.1; MATH3(VarDecCmpR8); EXPECT_LT;
4216 SETDEC(l,0,DECIMAL_NEG,0,1); r = -0.1; MATH3(VarDecCmpR8); EXPECT_LT;
4217
4218 SETDEC(l,0,0,0,0); r = 0.0; MATH3(VarDecCmpR8); EXPECT_EQ;
4219 SETDEC(l,0,0,0,0); r = 0.1; MATH3(VarDecCmpR8); EXPECT_LT;
4220 SETDEC(l,0,0,0,0); r = -0.1; MATH3(VarDecCmpR8); EXPECT_GT;
4221
4222 SETDEC(l,0,DECIMAL_NEG,0,0); r = 0.0; MATH3(VarDecCmpR8); EXPECT_EQ;
4223 SETDEC(l,0,DECIMAL_NEG,0,0); r = 0.1; MATH3(VarDecCmpR8); EXPECT_LT;
4224 SETDEC(l,0,DECIMAL_NEG,0,0); r = -0.1; MATH3(VarDecCmpR8); EXPECT_GT;
4225
4226 SETDEC(l,0,0,0,1); r = DECIMAL_NEG; MATH3(VarDecCmpR8); EXPECT_LT;
4227 SETDEC(l,0,DECIMAL_NEG,0,0); r = DECIMAL_NEG; MATH3(VarDecCmpR8); EXPECT_LT;
4228 SETDEC(l,0,0,-1,-1); r = DECIMAL_NEG; MATH3(VarDecCmpR8); EXPECT_GT;
4229 SETDEC(l,0,DECIMAL_NEG,-1,-1); r = DECIMAL_NEG; MATH3(VarDecCmpR8); EXPECT_LT;
4230}
HRESULT WINAPI VarDecCmpR8(const DECIMAL *pDecLeft, double dblRight)
Definition: vartype.c:5912
#define MATH3(func)
Definition: vartype.c:3879

Referenced by START_TEST().

◆ test_VarDecDiv()

static void test_VarDecDiv ( void  )
static

Definition at line 4050 of file vartype.c.

4051{
4052 MATHVARS2;
4053
4054 /* identity divisions */
4055 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,1); MATH2(VarDecDiv); EXPECTDEC(0,0,0,0);
4056 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,1); MATH2(VarDecDiv); EXPECTDEC(0,0,0,1);
4057 SETDEC(l,1,0,0,1); SETDEC(r,0,0,0,1); MATH2(VarDecDiv); EXPECTDEC(1,0,0,1);
4058
4059 /* exact divisions */
4060 SETDEC(l,0,0,0,45); SETDEC(r,0,0,0,9); MATH2(VarDecDiv); EXPECTDEC(0,0,0,5);
4061 SETDEC(l,1,0,0,45); SETDEC(r,0,0,0,9); MATH2(VarDecDiv); EXPECTDEC(1,0,0,5);
4062 SETDEC(l,0,0,0,45); SETDEC(r,1,0,0,9); MATH2(VarDecDiv); EXPECTDEC(0,0,0,50);
4063 SETDEC(l,1,0,0,45); SETDEC(r,2,0,0,9); MATH2(VarDecDiv); EXPECTDEC(0,0,0,50);
4064 /* these last three results suggest that native oleaut32 scales both operands down to zero
4065 before the division, but does not always try to scale the result, even if it is possible -
4066 analogous to multiplication behavior.
4067 */
4068 SETDEC(l,1,0,0,45); SETDEC(r,1,0,0,9); MATH2(VarDecDiv); EXPECTDEC(0,0,0,5);
4069 SETDEC(l,2,0,0,450); SETDEC(r,1,0,0,9); MATH2(VarDecDiv);
4070 if (S(U(out)).scale == 1) EXPECTDEC(1,0,0,50);
4071 else EXPECTDEC(0,0,0,5);
4072
4073 /* inexact divisions */
4074 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,3); MATH2(VarDecDiv); EXPECTDEC64(28,0,180700362,0x14b700cb,0x05555555);
4075 SETDEC(l,1,0,0,1); SETDEC(r,0,0,0,3); MATH2(VarDecDiv); EXPECTDEC64(28,0,18070036,0x35458014,0x4d555555);
4076 SETDEC(l,0,0,0,1); SETDEC(r,1,0,0,3); MATH2(VarDecDiv); EXPECTDEC64(28,0,1807003620,0xcf2607ee,0x35555555);
4077 SETDEC(l,1,0,0,1); SETDEC(r,2,0,0,3); MATH2(VarDecDiv); EXPECTDEC64(28,0,1807003620,0xcf2607ee,0x35555555);
4078 SETDEC(l,1,0,0,1); SETDEC(r,1,0,0,3); MATH2(VarDecDiv); EXPECTDEC64(28,0,180700362,0x14b700cb,0x05555555);
4079 SETDEC(l,2,0,0,10); SETDEC(r,1,0,0,3); MATH2(VarDecDiv); EXPECTDEC64(28,0,180700362,0x14b700cb,0x05555555);
4080
4081 /* this one shows that native oleaut32 rounds up the result */
4082 SETDEC(l,0,0,0,2); SETDEC(r,0,0,0,3); MATH2(VarDecDiv); EXPECTDEC64(28,0,361400724,0x296e0196,0x0aaaaaab);
4083
4084 /* sign tests */
4085 SETDEC(l,0,0x80,0,45); SETDEC(r,0,0,0,9); MATH2(VarDecDiv); EXPECTDEC(0,0x80,0,5);
4086 SETDEC(l,0,0,0,45); SETDEC(r,0,0x80,0,9); MATH2(VarDecDiv);EXPECTDEC(0,0x80,0,5);
4087 SETDEC(l,0,0x80,0,45); SETDEC(r,0,0x80,0,9); MATH2(VarDecDiv);EXPECTDEC(0,0,0,5);
4088
4089 /* oddballs */
4090 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,0); MATH2(VarDecDiv);/* indeterminate */
4091 ok(hres == DISP_E_DIVBYZERO,"Expected division-by-zero, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
4092 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
4093 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,0); MATH2(VarDecDiv);/* division by zero */
4094 ok(hres == DISP_E_DIVBYZERO,"Expected division-by-zero, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
4095 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
4096
4097}
HRESULT WINAPI VarDecDiv(const DECIMAL *pDecLeft, const DECIMAL *pDecRight, DECIMAL *pDecOut)
Definition: vartype.c:5601
#define DISP_E_DIVBYZERO
Definition: winerror.h:2527

Referenced by START_TEST().

◆ test_VarDecFromBool()

static void test_VarDecFromBool ( void  )
static

Definition at line 3787 of file vartype.c.

3788{
3789 CONVVARS(SHORT);
3790 int i;
3791
3792 /* Test all possible type values. Note that the result is reduced to 0 or -1 */
3793 for (i = -32768; i < 0; i++)
3794 {
3796 if (i)
3797 EXPECTDEC(0,0x80,0,1);
3798 else
3799 EXPECTDEC(0,0,0,0);
3800 }
3801}
HRESULT WINAPI VarDecFromBool(VARIANT_BOOL bIn, DECIMAL *pDecOut)
Definition: vartype.c:4312

Referenced by START_TEST().

◆ test_VarDecFromCy()

static void test_VarDecFromCy ( void  )
static

Definition at line 3860 of file vartype.c.

3861{
3862 CONVVARS(CY);
3863
3864 CONVERT_CY(VarDecFromCy, -1); EXPECTDEC(4,0x80,0,10000);
3865 CONVERT_CY(VarDecFromCy, 0); EXPECTDEC(4,0,0,0);
3866 CONVERT_CY(VarDecFromCy, 1); EXPECTDEC(4,0,0,10000);
3867 CONVERT_CY(VarDecFromCy, 0.5); EXPECTDEC(4,0,0,5000);
3868}
HRESULT WINAPI VarDecFromCy(CY cyIn, DECIMAL *pDecOut)
Definition: vartype.c:4239

Referenced by START_TEST().

◆ test_VarDecFromDate()

static void test_VarDecFromDate ( void  )
static

Definition at line 3829 of file vartype.c.

3830{
3831 CONVVARS(DATE);
3832
3833 CONVERT(VarDecFromDate,-0.6); EXPECTDEC(1,0x80,0,6);
3834 CONVERT(VarDecFromDate,-0.5); EXPECTDEC(1,0x80,0,5);
3835 CONVERT(VarDecFromDate,-0.4); EXPECTDEC(1,0x80,0,4);
3836 CONVERT(VarDecFromDate,0.0); EXPECTDEC(0,0,0,0);
3837 CONVERT(VarDecFromDate,0.4); EXPECTDEC(1,0,0,4);
3838 CONVERT(VarDecFromDate,0.5); EXPECTDEC(1,0,0,5);
3839 CONVERT(VarDecFromDate,0.6); EXPECTDEC(1,0,0,6);
3840}
HRESULT WINAPI VarDecFromDate(DATE dateIn, DECIMAL *pDecOut)
Definition: vartype.c:4222

Referenced by START_TEST().

◆ test_VarDecFromI1()

static void test_VarDecFromI1 ( void  )
static

Definition at line 3699 of file vartype.c.

3700{
3701 CONVVARS(signed char);
3702 int i;
3703
3704 for (i = -128; i < 128; i++)
3705 {
3707 }
3708}
HRESULT WINAPI VarDecFromI1(signed char cIn, DECIMAL *pDecOut)
Definition: vartype.c:4341
#define EXPECTDECI
Definition: vartype.c:3697

Referenced by START_TEST().

◆ test_VarDecFromI2()

static void test_VarDecFromI2 ( void  )
static

Definition at line 3710 of file vartype.c.

3711{
3712 CONVVARS(SHORT);
3713 int i;
3714
3715 for (i = -32768; i < 32768; i++)
3716 {
3718 }
3719}
HRESULT WINAPI VarDecFromI2(SHORT sIn, DECIMAL *pDecOut)
Definition: vartype.c:4114

Referenced by START_TEST().

◆ test_VarDecFromI4()

static void test_VarDecFromI4 ( void  )
static

Definition at line 3721 of file vartype.c.

3722{
3723 CONVVARS(LONG);
3724 int i;
3725
3726 for (i = -32768; i < 32768; i++)
3727 {
3729 }
3730}
HRESULT WINAPI VarDecFromI4(LONG lIn, DECIMAL *pDecOut)
Definition: vartype.c:4131

Referenced by START_TEST().

◆ test_VarDecFromI8()

static void test_VarDecFromI8 ( void  )
static

Definition at line 3732 of file vartype.c.

3733{
3735 int i;
3736
3737 for (i = -32768; i < 32768; i++)
3738 {
3740 }
3741}
HRESULT WINAPI VarDecFromI8(LONG64 llIn, DECIMAL *pDecOut)
Definition: vartype.c:4396

Referenced by START_TEST().

◆ test_VarDecFromR4()

static void test_VarDecFromR4 ( void  )
static

Definition at line 3803 of file vartype.c.

3804{
3805 CONVVARS(float);
3806
3807 CONVERT(VarDecFromR4,-0.6f); EXPECTDEC(1,0x80,0,6);
3808 CONVERT(VarDecFromR4,-0.5f); EXPECTDEC(1,0x80,0,5);
3809 CONVERT(VarDecFromR4,-0.4f); EXPECTDEC(1,0x80,0,4);
3810 CONVERT(VarDecFromR4,0.0f); EXPECTDEC(0,0,0,0);
3811 CONVERT(VarDecFromR4,0.4f); EXPECTDEC(1,0,0,4);
3812 CONVERT(VarDecFromR4,0.5f); EXPECTDEC(1,0,0,5);
3813 CONVERT(VarDecFromR4,0.6f); EXPECTDEC(1,0,0,6);
3814}
HRESULT WINAPI VarDecFromR4(FLOAT fltIn, DECIMAL *pDecOut)
Definition: vartype.c:4178

Referenced by START_TEST().

◆ test_VarDecFromR8()

static void test_VarDecFromR8 ( void  )
static

Definition at line 3816 of file vartype.c.

3817{
3818 CONVVARS(double);
3819
3820 CONVERT(VarDecFromR8,-0.6); EXPECTDEC(1,0x80,0,6);
3821 CONVERT(VarDecFromR8,-0.5); EXPECTDEC(1,0x80,0,5);
3822 CONVERT(VarDecFromR8,-0.4); EXPECTDEC(1,0x80,0,4);
3823 CONVERT(VarDecFromR8,0.0); EXPECTDEC(0,0,0,0);
3824 CONVERT(VarDecFromR8,0.4); EXPECTDEC(1,0,0,4);
3825 CONVERT(VarDecFromR8,0.5); EXPECTDEC(1,0,0,5);
3826 CONVERT(VarDecFromR8,0.6); EXPECTDEC(1,0,0,6);
3827}
HRESULT WINAPI VarDecFromR8(double dblIn, DECIMAL *pDecOut)
Definition: vartype.c:4200

Referenced by START_TEST().

◆ test_VarDecFromStr()

static void test_VarDecFromStr ( void  )
static

Definition at line 3842 of file vartype.c.

3843{
3844 CONVVARS(LCID);
3845 OLECHAR buff[128];
3846
3848
3855 CONVERT_STR(VarDecFromStr,"18446744073709551616", LOCALE_NOUSEROVERRIDE); EXPECTDEC(0,0,1,0);
3856 CONVERT_STR(VarDecFromStr,"4294967296.0", LOCALE_NOUSEROVERRIDE); EXPECTDEC64(0,0,0,1,0);
3857 CONVERT_STR(VarDecFromStr,"18446744073709551616.0", LOCALE_NOUSEROVERRIDE); EXPECTDEC(0,0,1,0);
3858}
HRESULT WINAPI VarDecFromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, DECIMAL *pDecOut)
Definition: vartype.c:4273

Referenced by START_TEST().

◆ test_VarDecFromUI1()

static void test_VarDecFromUI1 ( void  )
static

Definition at line 3743 of file vartype.c.

3744{
3745 CONVVARS(BYTE);
3746 int i;
3747
3748 for (i = 0; i < 256; i++)
3749 {
3751 }
3752}
HRESULT WINAPI VarDecFromUI1(BYTE bIn, DECIMAL *pDecOut)
Definition: vartype.c:4097

Referenced by START_TEST().

◆ test_VarDecFromUI2()

static void test_VarDecFromUI2 ( void  )
static

Definition at line 3754 of file vartype.c.

3755{
3757 int i;
3758
3759 for (i = 0; i < 65536; i++)
3760 {
3762 }
3763}
HRESULT WINAPI VarDecFromUI2(USHORT usIn, DECIMAL *pDecOut)
Definition: vartype.c:4358

Referenced by START_TEST().

◆ test_VarDecFromUI4()

static void test_VarDecFromUI4 ( void  )
static

Definition at line 3765 of file vartype.c.

3766{
3767 CONVVARS(ULONG);
3768 int i;
3769
3770 for (i = 0; i < 65536; i++)
3771 {
3773 }
3774}
HRESULT WINAPI VarDecFromUI4(ULONG ulIn, DECIMAL *pDecOut)
Definition: vartype.c:4375

Referenced by START_TEST().

◆ test_VarDecFromUI8()

static void test_VarDecFromUI8 ( void  )
static

Definition at line 3776 of file vartype.c.

3777{
3779 int i;
3780
3781 for (i = 0; i < 65536; i++)
3782 {
3784 }
3785}
HRESULT WINAPI VarDecFromUI8(ULONG64 ullIn, DECIMAL *pDecOut)
Definition: vartype.c:4429

Referenced by START_TEST().

◆ test_VarDecMul()

static void test_VarDecMul ( void  )
static

Definition at line 4000 of file vartype.c.

4001{
4002 MATHVARS2;
4003
4004 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,0); MATH2(VarDecMul); EXPECTDEC(0,0,0,0);
4005 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,0); MATH2(VarDecMul); EXPECTDEC(0,0,0,0);
4006 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,1); MATH2(VarDecMul); EXPECTDEC(0,0,0,0);
4007 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,1); MATH2(VarDecMul); EXPECTDEC(0,0,0,1);
4008 SETDEC(l,0,0,0,45000);SETDEC(r,0,0,0,2); MATH2(VarDecMul); EXPECTDEC(0,0,0,90000);
4009 SETDEC(l,0,0,0,2); SETDEC(r,0,0,0,45000); MATH2(VarDecMul); EXPECTDEC(0,0,0,90000);
4010
4011 SETDEC(l,0,0x80,0,2); SETDEC(r,0,0,0,2); MATH2(VarDecMul); EXPECTDEC(0,0x80,0,4);
4012 SETDEC(l,0,0,0,2); SETDEC(r,0,0x80,0,2); MATH2(VarDecMul); EXPECTDEC(0,0x80,0,4);
4013 SETDEC(l,0,0x80,0,2); SETDEC(r,0,0x80,0,2); MATH2(VarDecMul); EXPECTDEC(0,0,0,4);
4014
4015 SETDEC(l,4,0,0,2); SETDEC(r,0,0,0,2); MATH2(VarDecMul); EXPECTDEC(4,0,0,4);
4016 SETDEC(l,0,0,0,2); SETDEC(r,3,0,0,2); MATH2(VarDecMul); EXPECTDEC(3,0,0,4);
4017 SETDEC(l,4,0,0,2); SETDEC(r,3,0,0,2); MATH2(VarDecMul); EXPECTDEC(7,0,0,4);
4018 /* this last one shows that native oleaut32 does *not* gratuitously seize opportunities
4019 to reduce the scale if possible - the canonical result for the expected value is (6,0,0,1)
4020 */
4021 SETDEC(l,4,0,0,5); SETDEC(r,3,0,0,2); MATH2(VarDecMul); EXPECTDEC(7,0,0,10);
4022
4023 SETDEC64(l,0,0,0,0xFFFFFFFF,0xFFFFFFFF); SETDEC(r,0,0,0,2); MATH2(VarDecMul); EXPECTDEC64(0,0,1,0xFFFFFFFF,0xFFFFFFFE);
4024 SETDEC(l,0,0,0,2); SETDEC64(r,0,0,0,0xFFFFFFFF,0xFFFFFFFF); MATH2(VarDecMul); EXPECTDEC64(0,0,1,0xFFFFFFFF,0xFFFFFFFE);
4025 SETDEC(l,0,0,1,1); SETDEC(r,0,0,0,0x80000000); MATH2(VarDecMul); EXPECTDEC(0,0,0x80000000,0x80000000);
4026 SETDEC(l,0,0,0,0x80000000); SETDEC(r,0,0,1,1); MATH2(VarDecMul); EXPECTDEC(0,0,0x80000000,0x80000000);
4027
4028 /* near-overflow, used as a reference */
4029 SETDEC64(l,0,0,0,0xFFFFFFFF,0xFFFFFFFF); SETDEC(r,0,0,0,2000000000); MATH2(VarDecMul);EXPECTDEC64(0,0,1999999999,0xFFFFFFFF,0x88CA6C00);
4030 /* actual overflow - right operand is 10 times the previous value */
4031 SETDEC64(l,0,0,0,0xFFFFFFFF,0xFFFFFFFF); SETDEC64(r,0,0,0,4,0xA817C800); MATH2(VarDecMul);
4032 ok(hres == DISP_E_OVERFLOW,"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
4033 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
4034 /* here, native oleaut32 has an opportunity to avert the overflow, by reducing the scale of the result */
4035 SETDEC64(l,1,0,0,0xFFFFFFFF,0xFFFFFFFF); SETDEC64(r,0,0,0,4,0xA817C800); MATH2(VarDecMul);EXPECTDEC64(0,0,1999999999,0xFFFFFFFF,0x88CA6C00);
4036
4037 /* near-overflow, used as a reference */
4038 SETDEC64(l,0,0,1,0xFFFFFFFF,0xFFFFFFFE); SETDEC(r,0,0,0,1000000000); MATH2(VarDecMul);EXPECTDEC64(0,0,1999999999,0xFFFFFFFF,0x88CA6C00);
4039 /* actual overflow - right operand is 10 times the previous value */
4040 SETDEC64(l,0,0,1,0xFFFFFFFF,0xFFFFFFFE); SETDEC64(r,0,0,0,2,0x540BE400); MATH2(VarDecMul);
4041 ok(hres == DISP_E_OVERFLOW,"Expected overflow, got (%d,%d,%d,(%8x,%8x)x) hres 0x%08x\n",
4042 S(U(out)).scale, S(U(out)).sign, out.Hi32, S1(U1(out)).Mid32, S1(U1(out)).Lo32, hres);
4043 /* here, native oleaut32 has an opportunity to avert the overflow, by reducing the scale of the result */
4044 SETDEC64(l,1,0,1,0xFFFFFFFF,0xFFFFFFFE); SETDEC64(r,0,0,0,2,0x540BE400); MATH2(VarDecMul);EXPECTDEC64(0,0,1999999999,0xFFFFFFFF,0x88CA6C00);
4045
4046 /* this one shows that native oleaut32 is willing to lose significant digits in order to avert an overflow */
4047 SETDEC64(l,2,0,0,0xFFFFFFFF,0xFFFFFFFF); SETDEC64(r,0,0,0,9,0x502F9001); MATH2(VarDecMul);EXPECTDEC64(1,0,0xee6b2800,0x19999998,0xab2e719a);
4048}
HRESULT WINAPI VarDecMul(const DECIMAL *pDecLeft, const DECIMAL *pDecRight, DECIMAL *pDecOut)
Definition: vartype.c:5622

Referenced by START_TEST().

◆ test_VarDecNeg()

static void test_VarDecNeg ( void  )
static

Definition at line 3895 of file vartype.c.

3896{
3897 MATHVARS1;
3898
3899 SETDEC(l,0,0x80,0,1); MATH1(VarDecNeg); EXPECTDEC(0,0,0,1);
3900 SETDEC(l,0,0,0,0); MATH1(VarDecNeg); EXPECTDEC(0,0x80,0,0); /* '-0'! */
3901 SETDEC(l,0,0x80,0,0); MATH1(VarDecNeg); EXPECTDEC(0,0,0,0);
3902 SETDEC(l,0,0,0,1); MATH1(VarDecNeg); EXPECTDEC(0,0x80,0,1);
3903
3904 /* Doesn't check for invalid input */
3905 SETDEC(l,0,0x7f,0,1); MATH1(VarDecNeg); EXPECTDEC(0,0xff,0,1);
3906 SETDEC(l,0,0x80,29,1); MATH1(VarDecNeg); EXPECTDEC(0,0,29,1);
3907 SETDEC(l,0,0,29,1); MATH1(VarDecNeg); EXPECTDEC(0,0x80,29,1);
3908}
HRESULT WINAPI VarDecNeg(const DECIMAL *pDecIn, DECIMAL *pDecOut)
Definition: vartype.c:5794

Referenced by START_TEST().

◆ test_VarDecRound()

static void test_VarDecRound ( void  )
static

Definition at line 4234 of file vartype.c.

4235{
4236 HRESULT hres;
4237 DECIMAL l, out;
4238
4239 CLEAR(out); SETDEC(l, 0, 0, 0, 1); hres = VarDecRound(&l, 3, &out); EXPECTDEC(0, 0, 0, 1);
4240
4241 CLEAR(out); SETDEC(l, 0, 0, 0, 1); hres = VarDecRound(&l, 0, &out); EXPECTDEC(0, 0, 0, 1);
4242 CLEAR(out); SETDEC(l, 1, 0, 0, 1); hres = VarDecRound(&l, 0, &out); EXPECTDEC(0, 0, 0, 0);
4243 CLEAR(out); SETDEC(l, 1, 0, 0, 1); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 1);
4244 CLEAR(out); SETDEC(l, 2, 0, 0, 11); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 1);
4245 CLEAR(out); SETDEC(l, 2, 0, 0, 15); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 2);
4246 CLEAR(out); SETDEC(l, 6, 0, 0, 550001); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 6);
4247
4248 CLEAR(out); SETDEC(l, 0, DECIMAL_NEG, 0, 1); hres = VarDecRound(&l, 0, &out); EXPECTDEC(0, DECIMAL_NEG, 0, 1);
4249 CLEAR(out); SETDEC(l, 1, DECIMAL_NEG, 0, 1); hres = VarDecRound(&l, 0, &out); EXPECTDEC(0, DECIMAL_NEG, 0, 0);
4250 CLEAR(out); SETDEC(l, 1, DECIMAL_NEG, 0, 1); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 1);
4251 CLEAR(out); SETDEC(l, 2, DECIMAL_NEG, 0, 11); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 1);
4252 CLEAR(out); SETDEC(l, 2, DECIMAL_NEG, 0, 15); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 2);
4253 CLEAR(out); SETDEC(l, 6, DECIMAL_NEG, 0, 550001); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, DECIMAL_NEG, 0, 6);
4254
4255 CLEAR(out); SETDEC64(l, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff); hres = VarDecRound(&l, 0, &out); EXPECTDEC64(0, 0, 0xffffffff, 0xffffffff, 0xffffffff);
4256 CLEAR(out); SETDEC64(l, 28, 0, 0xffffffff, 0xffffffff, 0xffffffff); hres = VarDecRound(&l, 0, &out); EXPECTDEC64(0, 0, 0, 0, 8);
4257 CLEAR(out); SETDEC64(l, 0, DECIMAL_NEG, 0xffffffff, 0xffffffff, 0xffffffff); hres = VarDecRound(&l, 0, &out); EXPECTDEC64(0, DECIMAL_NEG, 0xffffffff, 0xffffffff, 0xffffffff);
4258 CLEAR(out); SETDEC64(l, 28, DECIMAL_NEG, 0xffffffff, 0xffffffff, 0xffffffff); hres = VarDecRound(&l, 0, &out); EXPECTDEC64(0, DECIMAL_NEG, 0, 0, 8);
4259
4260 CLEAR(out); SETDEC(l, 2, 0, 0, 0); hres = VarDecRound(&l, 1, &out); EXPECTDEC(1, 0, 0, 0);
4261}
HRESULT WINAPI VarDecRound(const DECIMAL *pDecIn, int cDecimals, DECIMAL *pDecOut)
Definition: vartype.c:5815
#define CLEAR(x)
Definition: vartype.c:4232

Referenced by START_TEST().

◆ test_VarDecSub()

static void test_VarDecSub ( void  )
static

Definition at line 3990 of file vartype.c.

3991{
3992 MATHVARS2;
3993
3994 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,0); MATH2(VarDecSub); EXPECTDECZERO();
3995 SETDEC(l,0,0,0,0); SETDEC(r,0,0,0,1); MATH2(VarDecSub); EXPECTDEC(0,0x80,0,1);
3996 SETDEC(l,0,0,0,1); SETDEC(r,0,0,0,1); MATH2(VarDecSub); EXPECTDECZERO();
3997 SETDEC(l,0,0,0,1); SETDEC(r,0,0x80,0,1); MATH2(VarDecSub); EXPECTDEC(0,0,0,2);
3998}
HRESULT WINAPI VarDecSub(const DECIMAL *pDecLeft, const DECIMAL *pDecRight, DECIMAL *pDecOut)
Definition: vartype.c:5677

Referenced by START_TEST().

◆ test_VarI1ChangeTypeEx()

static void test_VarI1ChangeTypeEx ( void  )
static

Definition at line 629 of file vartype.c.

630{
632 signed char in;
633 VARIANTARG vSrc, vDst;
634
635 in = 1;
636
640}
#define NEGATIVE_TYPETEST(vt, val, fs, vtneg, valneg)
Definition: vartype.c:168

Referenced by START_TEST().

◆ test_VarI1Copy()

static void test_VarI1Copy ( void  )
static

Definition at line 624 of file vartype.c.

625{
626 COPYTEST(1, VT_I1, V_I1(&vSrc), V_I1(&vDst), V_I1REF(&vSrc), V_I1REF(&vDst), "%d");
627}
#define V_I1REF(A)
Definition: oleauto.h:244

Referenced by START_TEST().

◆ test_VarI1FromBool()

static void test_VarI1FromBool ( void  )
static

Definition at line 475 of file vartype.c.

476{
478 int i;
479
480 /* Note that conversions from bool wrap around! */
481 CONVERT(VarI1FromBool, -129); EXPECT(127);
482 CONVERTRANGE(VarI1FromBool, -128, 128);
483 CONVERT(VarI1FromBool, 128); EXPECT(-128);
484}
HRESULT WINAPI VarI1FromBool(VARIANT_BOOL boolIn, signed char *pcOut)
Definition: vartype.c:465

Referenced by START_TEST().

◆ test_VarI1FromCy()

static void test_VarI1FromCy ( void  )
static

Definition at line 560 of file vartype.c.

561{
562 CONVVARS(CY);
563
565 CONVERT_CY(VarI1FromCy,-128); EXPECT(128);
569 CONVERT_CY(VarI1FromCy,127); EXPECT(127);
571
572 CONVERT_CY(VarI1FromCy,-1.5); EXPECT(-2);
573 CONVERT_CY(VarI1FromCy,-0.6); EXPECT(-1);
574 CONVERT_CY(VarI1FromCy,-0.5); EXPECT(0);
575 CONVERT_CY(VarI1FromCy,-0.4); EXPECT(0);
580}
HRESULT WINAPI VarI1FromCy(CY cyIn, signed char *pcOut)
Definition: vartype.c:402

Referenced by START_TEST().

◆ test_VarI1FromDate()

static void test_VarI1FromDate ( void  )
static

Definition at line 538 of file vartype.c.

539{
540 CONVVARS(DATE);
541
543 CONVERT(VarI1FromDate, -128.0); EXPECT(-128);
544 CONVERT(VarI1FromDate, -1.0); EXPECT(-1);
545 CONVERT(VarI1FromDate, 0.0); EXPECT(0);
546 CONVERT(VarI1FromDate, 1.0); EXPECT(1);
547 CONVERT(VarI1FromDate, 127.0); EXPECT(127);
549
550 CONVERT(VarI1FromDate, -1.5); EXPECT(-2);
551 CONVERT(VarI1FromDate, -0.6); EXPECT(-1);
552 CONVERT(VarI1FromDate, -0.5); EXPECT(0);
553 CONVERT(VarI1FromDate, -0.4); EXPECT(0);
554 CONVERT(VarI1FromDate, 0.4); EXPECT(0);
555 CONVERT(VarI1FromDate, 0.5); EXPECT(0);
556 CONVERT(VarI1FromDate, 0.6); EXPECT(1);
557 CONVERT(VarI1FromDate, 1.5); EXPECT(2);
558}
HRESULT WINAPI VarI1FromDate(DATE dateIn, signed char *pcOut)
Definition: vartype.c:383

Referenced by START_TEST().

◆ test_VarI1FromDec()

static void test_VarI1FromDec ( void  )
static

Definition at line 582 of file vartype.c.

583{
585
587
589 CONVERT_DEC(VarI1FromDec,0,0x80,0,128); EXPECT(-128);
590 CONVERT_DEC(VarI1FromDec,0,0x80,0,1); EXPECT(-1);
591 CONVERT_DEC(VarI1FromDec,0,0,0,0); EXPECT(0);
592 CONVERT_DEC(VarI1FromDec,0,0,0,1); EXPECT(1);
593 CONVERT_DEC(VarI1FromDec,0,0,0,127); EXPECT(127);
595
596 CONVERT_DEC(VarI1FromDec,2,0x80,0,12800); EXPECT(-128);
597 CONVERT_DEC(VarI1FromDec,2,0,0,12700); EXPECT(127);
598}
HRESULT WINAPI VarI1FromDec(DECIMAL *pdecIn, signed char *pcOut)
Definition: vartype.c:523

Referenced by START_TEST().

◆ test_VarI1FromI2()

static void test_VarI1FromI2 ( void  )
static

Definition at line 409 of file vartype.c.

410{
412 int i;
413
414 OVERFLOWRANGE(VarI1FromI2, -32768, -128);
415 CONVERTRANGE(VarI1FromI2, -128, 128);
416 OVERFLOWRANGE(VarI1FromI2, 129, 32768);
417}
HRESULT WINAPI VarI1FromI2(SHORT sIn, signed char *pcOut)
Definition: vartype.c:301
#define OVERFLOWRANGE(func, start, end)
Definition: vartype.c:84

Referenced by START_TEST().

◆ test_VarI1FromI4()

static void test_VarI1FromI4 ( void  )
static

Definition at line 419 of file vartype.c.

420{
421 CONVVARS(LONG);
422 int i;
423
425 CONVERTRANGE(VarI1FromI4, -128, 128);
427}
HRESULT WINAPI VarI1FromI4(LONG iIn, signed char *pcOut)
Definition: vartype.c:320

Referenced by START_TEST().

◆ test_VarI1FromI8()

static void test_VarI1FromI8 ( void  )
static

Definition at line 429 of file vartype.c.

430{
432 int i;
433
435 CONVERTRANGE(VarI1FromI8, -127, 128);
437}
HRESULT WINAPI VarI1FromI8(LONG64 llIn, signed char *pcOut)
Definition: vartype.c:549

Referenced by START_TEST().

◆ test_VarI1FromR4()

static void test_VarI1FromR4 ( void  )
static

Definition at line 486 of file vartype.c.

487{
489
492 CONVERT(VarI1FromR4, -128.5f); EXPECT(-128);
493 CONVERT(VarI1FromR4, -128.0f); EXPECT(-128);
494 CONVERT(VarI1FromR4, -1.0f); EXPECT(-1);
495 CONVERT(VarI1FromR4, 0.0f); EXPECT(0);
496 CONVERT(VarI1FromR4, 1.0f); EXPECT(1);
497 CONVERT(VarI1FromR4, 127.0f); EXPECT(127);
498 CONVERT(VarI1FromR4, 127.49f); EXPECT(127);
501
502 CONVERT(VarI1FromR4, -1.5f); EXPECT(-2);
503 CONVERT(VarI1FromR4, -0.6f); EXPECT(-1);
504 CONVERT(VarI1FromR4, -0.5f); EXPECT(0);
505 CONVERT(VarI1FromR4, -0.4f); EXPECT(0);
506 CONVERT(VarI1FromR4, 0.4f); EXPECT(0);
507 CONVERT(VarI1FromR4, 0.5f); EXPECT(0);
508 CONVERT(VarI1FromR4, 0.6f); EXPECT(1);
509 CONVERT(VarI1FromR4, 1.5f); EXPECT(2);
510}
HRESULT WINAPI VarI1FromR4(FLOAT fltIn, signed char *pcOut)
Definition: vartype.c:339

Referenced by START_TEST().

◆ test_VarI1FromR8()

static void test_VarI1FromR8 ( void  )
static

Definition at line 512 of file vartype.c.

513{
515
518 CONVERT(VarI1FromR8, -128.5); EXPECT(-128);
519 CONVERT(VarI1FromR8, -128.0); EXPECT(-128);
520 CONVERT(VarI1FromR8, -1.0); EXPECT(-1);
521 CONVERT(VarI1FromR8, 0.0); EXPECT(0);
522 CONVERT(VarI1FromR8, 1.0); EXPECT(1);
523 CONVERT(VarI1FromR8, 127.0); EXPECT(127);
524 CONVERT(VarI1FromR8, 127.49); EXPECT(127);
527
528 CONVERT(VarI1FromR8, -1.5); EXPECT(-2);
529 CONVERT(VarI1FromR8, -0.6); EXPECT(-1);
530 CONVERT(VarI1FromR8, -0.5); EXPECT(0);
531 CONVERT(VarI1FromR8, -0.4); EXPECT(0);
532 CONVERT(VarI1FromR8, 0.4); EXPECT(0);
533 CONVERT(VarI1FromR8, 0.5); EXPECT(0);
534 CONVERT(VarI1FromR8, 0.6); EXPECT(1);
535 CONVERT(VarI1FromR8, 1.5); EXPECT(2);
536}
HRESULT WINAPI VarI1FromR8(double dblIn, signed char *pcOut)
Definition: vartype.c:361

Referenced by START_TEST().

◆ test_VarI1FromStr()

static void test_VarI1FromStr ( void  )
static

Definition at line 600 of file vartype.c.

Referenced by START_TEST().

◆ test_VarI1FromUI1()

static void test_VarI1FromUI1 ( void  )
static

Definition at line 439 of file vartype.c.

440{
441 CONVVARS(BYTE);
442 int i;
443
444 CONVERTRANGE(VarI1FromUI1, 0, 127);
445 OVERFLOWRANGE(VarI1FromUI1, 128, 255);
446}
HRESULT WINAPI VarI1FromUI1(BYTE bIn, signed char *pcOut)
Definition: vartype.c:282

Referenced by START_TEST().

◆ test_VarI1FromUI2()

static void test_VarI1FromUI2 ( void  )
static

Definition at line 448 of file vartype.c.

449{
451 int i;
452
453 CONVERTRANGE(VarI1FromUI2, 0, 127);
454 OVERFLOWRANGE(VarI1FromUI2, 128, 32768);
455}
HRESULT WINAPI VarI1FromUI2(USHORT usIn, signed char *pcOut)
Definition: vartype.c:484

Referenced by START_TEST().

◆ test_VarI1FromUI4()

static void test_VarI1FromUI4 ( void  )
static

Definition at line 457 of file vartype.c.

458{
460 int i;
461
462 CONVERTRANGE(VarI1FromUI4, 0, 127);
464}
HRESULT WINAPI VarI1FromUI4(ULONG ulIn, signed char *pcOut)
Definition: vartype.c:504

Referenced by START_TEST().

◆ test_VarI1FromUI8()

static void test_VarI1FromUI8 ( void  )
static

Definition at line 466 of file vartype.c.

467{
469 int i;
470
471 CONVERTRANGE(VarI1FromUI8, 0, 127);
473}
HRESULT WINAPI VarI1FromUI8(ULONG64 ullIn, signed char *pcOut)
Definition: vartype.c:568

Referenced by START_TEST().

◆ test_VarI2ChangeTypeEx()

static void test_VarI2ChangeTypeEx ( void  )
static

Definition at line 1159 of file vartype.c.

1160{
1161 HRESULT hres;
1162 SHORT in;
1163 VARIANTARG vSrc, vDst;
1164
1165 in = 1;
1166
1167 INITIAL_TYPETEST(VT_I2, V_I2, "%d");
1170}

Referenced by START_TEST().

◆ test_VarI2Copy()

static void test_VarI2Copy ( void  )
static

Definition at line 1154 of file vartype.c.

1155{
1156 COPYTEST(1, VT_I2, V_I2(&vSrc), V_I2(&vDst), V_I2REF(&vSrc), V_I2REF(&vDst), "%d");
1157}
#define V_I2REF(A)
Definition: oleauto.h:246

Referenced by START_TEST().

◆ test_VarI2FromBool()

static void test_VarI2FromBool ( void  )
static

Definition at line 1002 of file vartype.c.

1003{
1005 int i;
1006
1007 CONVERTRANGE(VarI2FromBool, -32768, 32768);
1008}
HRESULT WINAPI VarI2FromBool(VARIANT_BOOL boolIn, SHORT *psOut)
Definition: vartype.c:1059

Referenced by START_TEST().

◆ test_VarI2FromCy()

static void test_VarI2FromCy ( void  )
static

Definition at line 1087 of file vartype.c.

1088{
1089 CONVVARS(CY);
1090
1092 CONVERT_CY(VarI2FromCy,-32768); EXPECT(32768);
1093 CONVERT_CY(VarI2FromCy,-1); EXPECT(-1);
1096 CONVERT_CY(VarI2FromCy,32767); EXPECT(32767);
1098
1099 /* Rounding */
1100 CONVERT_CY(VarI2FromCy,-1.5); EXPECT(-2);
1101 CONVERT_CY(VarI2FromCy,-0.6); EXPECT(-1);
1102 CONVERT_CY(VarI2FromCy,-0.5); EXPECT(0);
1103 CONVERT_CY(VarI2FromCy,-0.4); EXPECT(0);
1104 CONVERT_CY(VarI2FromCy,0.4); EXPECT(0);
1105 CONVERT_CY(VarI2FromCy,0.5); EXPECT(0);
1106 CONVERT_CY(VarI2FromCy,0.6); EXPECT(1);
1107 CONVERT_CY(VarI2FromCy,1.5); EXPECT(2);
1108}
HRESULT WINAPI VarI2FromCy(CY cyIn, SHORT *psOut)
Definition: vartype.c:978

Referenced by START_TEST().

◆ test_VarI2FromDate()

static void test_VarI2FromDate ( void  )
static

Definition at line 1064 of file vartype.c.

1065{
1066 CONVVARS(DATE);
1067
1069 CONVERT(VarI2FromDate, -32768.0); EXPECT(-32768);
1070 CONVERT(VarI2FromDate, -1.0); EXPECT(-1);
1071 CONVERT(VarI2FromDate, 0.0); EXPECT(0);
1072 CONVERT(VarI2FromDate, 1.0); EXPECT(1);
1073 CONVERT(VarI2FromDate, 32767.0); EXPECT(32767);
1075
1076 /* Rounding */
1077 CONVERT(VarI2FromDate, -1.5); EXPECT(-2);
1078 CONVERT(VarI2FromDate, -0.6); EXPECT(-1);
1079 CONVERT(VarI2FromDate, -0.5); EXPECT(0);
1080 CONVERT(VarI2FromDate, -0.4); EXPECT(0);
1081 CONVERT(VarI2FromDate, 0.4); EXPECT(0);
1082 CONVERT(VarI2FromDate, 0.5); EXPECT(0);
1083 CONVERT(VarI2FromDate, 0.6); EXPECT(1);
1084 CONVERT(VarI2FromDate, 1.5); EXPECT(2);
1085}
HRESULT WINAPI VarI2FromDate(DATE dateIn, SHORT *psOut)
Definition: vartype.c:999

Referenced by START_TEST().

◆ test_VarI2FromDec()

static void test_VarI2FromDec ( void  )
static

Definition at line 1110 of file vartype.c.

1111{
1113
1115
1116 CONVERT_DEC(VarI2FromDec,0,0x80,0,32769); EXPECT_OVERFLOW;
1117 CONVERT_DEC(VarI2FromDec,0,0x80,0,32768); EXPECT(-32768);
1118 CONVERT_DEC(VarI2FromDec,0,0x80,0,1); EXPECT(-1);
1119 CONVERT_DEC(VarI2FromDec,0,0,0,0); EXPECT(0);
1120 CONVERT_DEC(VarI2FromDec,0,0,0,1); EXPECT(1);
1121 CONVERT_DEC(VarI2FromDec,0,0,0,32767); EXPECT(32767);
1123
1124 CONVERT_DEC(VarI2FromDec,2,0x80,0,3276800); EXPECT(-32768);
1125 CONVERT_DEC(VarI2FromDec,2,0,0,3276700); EXPECT(32767);
1127}
HRESULT WINAPI VarI2FromDec(DECIMAL *pdecIn, SHORT *psOut)
Definition: vartype.c:1131

Referenced by START_TEST().

◆ test_VarI2FromI1()

static void test_VarI2FromI1 ( void  )
static

Definition at line 939 of file vartype.c.

940{
941 CONVVARS(signed char);
942 int i;
943
944 CONVERTRANGE(VarI2FromI1, -128, 128);
945}
HRESULT WINAPI VarI2FromI1(signed char cIn, SHORT *psOut)
Definition: vartype.c:1076

Referenced by START_TEST().

◆ test_VarI2FromI4()

static void test_VarI2FromI4 ( void  )
static

Definition at line 947 of file vartype.c.

948{
949 CONVVARS(LONG);
950 int i;
951
953 CONVERTRANGE(VarI2FromI4, -32768, 32768);
955}
HRESULT WINAPI VarI2FromI4(LONG iIn, SHORT *psOut)
Definition: vartype.c:918

Referenced by START_TEST().

◆ test_VarI2FromI8()

static void test_VarI2FromI8 ( void  )
static

Definition at line 957 of file vartype.c.

958{
960
962 CONVERT(VarI2FromI8, -32768); EXPECT(-32768);
963 CONVERT(VarI2FromI8, 32767); EXPECT(32767);
965}
HRESULT WINAPI VarI2FromI8(LONG64 llIn, SHORT *psOut)
Definition: vartype.c:1156

Referenced by START_TEST().

◆ test_VarI2FromR4()

static void test_VarI2FromR4 ( void  )
static

Definition at line 1010 of file vartype.c.

1011{
1012 CONVVARS(FLOAT);
1013
1014 CONVERT(VarI2FromR4, -32769.0f); EXPECT_OVERFLOW;
1015 CONVERT(VarI2FromR4, -32768.51f); EXPECT_OVERFLOW;
1016 CONVERT(VarI2FromR4, -32768.5f); EXPECT(-32768);
1017 CONVERT(VarI2FromR4, -32768.0f); EXPECT(-32768);
1018 CONVERT(VarI2FromR4, -1.0f); EXPECT(-1);
1019 CONVERT(VarI2FromR4, 0.0f); EXPECT(0);
1020 CONVERT(VarI2FromR4, 1.0f); EXPECT(1);
1021 CONVERT(VarI2FromR4, 32767.0f); EXPECT(32767);
1022 CONVERT(VarI2FromR4, 32767.49f); EXPECT(32767);
1025
1026 /* Rounding */
1027 CONVERT(VarI2FromR4, -1.5f); EXPECT(-2);
1028 CONVERT(VarI2FromR4, -0.6f); EXPECT(-1);
1029 CONVERT(VarI2FromR4, -0.5f); EXPECT(0);
1030 CONVERT(VarI2FromR4, -0.4f); EXPECT(0);
1031 CONVERT(VarI2FromR4, 0.4f); EXPECT(0);
1032 CONVERT(VarI2FromR4, 0.5f); EXPECT(0);
1033 CONVERT(VarI2FromR4, 0.6f); EXPECT(1);
1034 CONVERT(VarI2FromR4, 1.5f); EXPECT(2);
1035}
HRESULT WINAPI VarI2FromR4(FLOAT fltIn, SHORT *psOut)
Definition: vartype.c:936

Referenced by START_TEST().

◆ test_VarI2FromR8()

static void test_VarI2FromR8 ( void  )
static

Definition at line 1037 of file vartype.c.

1038{
1040
1042 CONVERT(VarI2FromR8, -32768.51); EXPECT_OVERFLOW;
1043 CONVERT(VarI2FromR8, -32768.5); EXPECT(-32768);
1044 CONVERT(VarI2FromR8, -32768.0); EXPECT(-32768);
1045 CONVERT(VarI2FromR8, -1.0); EXPECT(-1);
1046 CONVERT(VarI2FromR8, 0.0); EXPECT(0);
1047 CONVERT(VarI2FromR8, 1.0); EXPECT(1);
1048 CONVERT(VarI2FromR8, 32767.0); EXPECT(32767);
1049 CONVERT(VarI2FromR8, 32767.49); EXPECT(32767);
1052
1053 /* Rounding */
1054 CONVERT(VarI2FromR8, -1.5); EXPECT(-2);
1055 CONVERT(VarI2FromR8, -0.6); EXPECT(-1);
1056 CONVERT(VarI2FromR8, -0.5); EXPECT(0);
1057 CONVERT(VarI2FromR8, -0.4); EXPECT(0);
1058 CONVERT(VarI2FromR8, 0.4); EXPECT(0);
1059 CONVERT(VarI2FromR8, 0.5); EXPECT(0);
1060 CONVERT(VarI2FromR8, 0.6); EXPECT(1);
1061 CONVERT(VarI2FromR8, 1.5); EXPECT(2);
1062}
HRESULT WINAPI VarI2FromR8(double dblIn, SHORT *psOut)
Definition: vartype.c:957

Referenced by START_TEST().

◆ test_VarI2FromStr()

static void test_VarI2FromStr ( void  )
static

Definition at line 1129 of file vartype.c.

1130{
1131 CONVVARS(LCID);
1132 OLECHAR buff[128];
1133
1135
1137 CONVERT_STR(VarI2FromStr,"0", 0); EXPECT(0);
1139 CONVERT_STR(VarI2FromStr,"-32768", 0); EXPECT(-32768);
1140 CONVERT_STR(VarI2FromStr,"32767", 0); EXPECT(32767);
1142
1143 /* Rounding */
1152}
HRESULT WINAPI VarI2FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, SHORT *psOut)
Definition: vartype.c:1021

Referenced by START_TEST().

◆ test_VarI2FromUI1()

static void test_VarI2FromUI1 ( void  )
static

Definition at line 967 of file vartype.c.

968{
969 CONVVARS(BYTE);
970 int i;
971
972 CONVERTRANGE(VarI2FromUI1, 0, 256);
973}
HRESULT WINAPI VarI2FromUI1(BYTE bIn, SHORT *psOut)
Definition: vartype.c:900

Referenced by START_TEST().

◆ test_VarI2FromUI2()

static void test_VarI2FromUI2 ( void  )
static

Definition at line 975 of file vartype.c.

976{
978 int i;
979
980 CONVERTRANGE(VarI2FromUI2, 0, 32768);
982}
HRESULT WINAPI VarI2FromUI2(USHORT usIn, SHORT *psOut)
Definition: vartype.c:1094

Referenced by START_TEST().

◆ test_VarI2FromUI4()

static void test_VarI2FromUI4 ( void  )
static

Definition at line 984 of file vartype.c.

985{
987 int i;
988
989 CONVERTRANGE(VarI2FromUI4, 0, 32768);
991}
HRESULT WINAPI VarI2FromUI4(ULONG ulIn, SHORT *psOut)
Definition: vartype.c:1112

Referenced by START_TEST().

◆ test_VarI2FromUI8()

static void test_VarI2FromUI8 ( void  )
static

Definition at line 993 of file vartype.c.

994{
996 int i;
997
998 CONVERTRANGE(VarI2FromUI8, 0, 32768);
1000}
HRESULT WINAPI VarI2FromUI8(ULONG64 ullIn, SHORT *psOut)
Definition: vartype.c:1174

Referenced by START_TEST().

◆ test_VarI4ChangeTypeEx()

static void test_VarI4ChangeTypeEx ( void  )
static

Definition at line 1623 of file vartype.c.

1624{
1625 HRESULT hres;
1626 LONG in;
1627 VARIANTARG vSrc, vDst;
1628
1629 in = 1;
1630
1631 INITIAL_TYPETEST(VT_I4, V_I4, "%d");
1634}

Referenced by START_TEST().

◆ test_VarI4Copy()

static void test_VarI4Copy ( void  )
static

Definition at line 1618 of file vartype.c.

1619{
1620 COPYTEST(1, VT_I4, V_I4(&vSrc), V_I4(&vDst), V_I4REF(&vSrc), V_I4REF(&vDst), "%d");
1621}
#define V_I4REF(A)
Definition: oleauto.h:248

Referenced by START_TEST().

◆ test_VarI4FromBool()

static void test_VarI4FromBool ( void  )
static

Definition at line 1474 of file vartype.c.

1475{
1477 int i;
1478
1479 CONVERTRANGE(VarI4FromBool, -32768, 32768);
1480}
HRESULT WINAPI VarI4FromBool(VARIANT_BOOL boolIn, LONG *piOut)
Definition: vartype.c:1649

Referenced by START_TEST().

◆ test_VarI4FromCy()

static void test_VarI4FromCy ( void  )
static

Definition at line 1549 of file vartype.c.

1550{
1551 CONVVARS(CY);
1552
1553 CONVERT_CY(VarI4FromCy,-1); EXPECT(-1);
1556
1557 CONVERT_CY64(VarI4FromCy,-1,2147483647ul); EXPECT_OVERFLOW;
1558 CONVERT_CY64(VarI4FromCy,-1,2147483648ul); EXPECT(-2147483647 - 1);
1559 CONVERT_CY64(VarI4FromCy,0,2147483647ul); EXPECT(2147483647ul);
1560 CONVERT_CY64(VarI4FromCy,0,2147483648ul); EXPECT_OVERFLOW;
1561
1562 CONVERT_CY(VarI4FromCy,-1.5); EXPECT(-2);
1563 CONVERT_CY(VarI4FromCy,-0.6); EXPECT(-1);
1564 CONVERT_CY(VarI4FromCy,-0.5); EXPECT(0);
1565 CONVERT_CY(VarI4FromCy,-0.4); EXPECT(0);
1566 CONVERT_CY(VarI4FromCy,0.4); EXPECT(0);
1567 CONVERT_CY(VarI4FromCy,0.5); EXPECT(0);
1568 CONVERT_CY(VarI4FromCy,0.6); EXPECT(1);
1569 CONVERT_CY(VarI4FromCy,1.5); EXPECT(2);
1570}
HRESULT WINAPI VarI4FromCy(CY cyIn, LONG *piOut)
Definition: vartype.c:1570
#define CONVERT_CY64(func, hi, lo)
Definition: vartype.c:95

Referenced by START_TEST().

◆ test_VarI4FromDate()

static void test_VarI4FromDate ( void  )
static

Definition at line 1527 of file vartype.c.

1528{
1529 CONVVARS(DATE);
1530
1531 CONVERT(VarI4FromDate, -2147483649.0); EXPECT_OVERFLOW;
1532 CONVERT(VarI4FromDate, -2147483648.0); EXPECT(-2147483647 - 1);
1533 CONVERT(VarI4FromDate, -1.0); EXPECT(-1);
1534 CONVERT(VarI4FromDate, 0.0); EXPECT(0);
1535 CONVERT(VarI4FromDate, 1.0); EXPECT(1);
1536 CONVERT(VarI4FromDate, 2147483647.0); EXPECT(2147483647);
1537 CONVERT(VarI4FromDate, 2147483648.0); EXPECT_OVERFLOW;
1538
1539 CONVERT(VarI4FromDate, -1.5); EXPECT(-2);
1540 CONVERT(VarI4FromDate, -0.6); EXPECT(-1);
1541 CONVERT(VarI4FromDate, -0.5); EXPECT(0);
1542 CONVERT(VarI4FromDate, -0.4); EXPECT(0);
1543 CONVERT(VarI4FromDate, 0.4); EXPECT(0);
1544 CONVERT(VarI4FromDate, 0.5); EXPECT(0);
1545 CONVERT(VarI4FromDate, 0.6); EXPECT(1);
1546 CONVERT(VarI4FromDate, 1.5); EXPECT(2);
1547}
HRESULT WINAPI VarI4FromDate(DATE dateIn, LONG *piOut)
Definition: vartype.c:1589

Referenced by START_TEST().

◆ test_VarI4FromDec()

static void test_VarI4FromDec ( void  )
static

Definition at line 1572 of file vartype.c.

1573{
1575
1577
1578 CONVERT_DEC(VarI4FromDec,0,0x80,0,1); EXPECT(-1);
1579 CONVERT_DEC(VarI4FromDec,0,0,0,0); EXPECT(0);
1580 CONVERT_DEC(VarI4FromDec,0,0,0,1); EXPECT(1);
1581
1582 CONVERT_DEC64(VarI4FromDec,0,0x80,0,0,2147483649ul); EXPECT_OVERFLOW;
1583 CONVERT_DEC64(VarI4FromDec,0,0x80,0,0,2147483648ul); EXPECT(-2147483647 - 1);
1584 CONVERT_DEC64(VarI4FromDec,0,0,0,0,2147483647ul); EXPECT(2147483647ul);
1585 CONVERT_DEC64(VarI4FromDec,0,0,0,0,2147483648ul); EXPECT_OVERFLOW;
1586
1587 CONVERT_DEC64(VarI4FromDec,2,0x80,0,50,100); EXPECT_OVERFLOW;
1588 CONVERT_DEC64(VarI4FromDec,2,0x80,0,50,0); EXPECT(-2147483647 - 1);
1589 CONVERT_DEC64(VarI4FromDec,2,0,0,49,4294967196ul); EXPECT(2147483647);
1591}
HRESULT WINAPI VarI4FromDec(DECIMAL *pdecIn, LONG *piOut)
Definition: vartype.c:1720

Referenced by START_TEST().

◆ test_VarI4FromI1()

static void test_VarI4FromI1 ( void  )
static

Definition at line 1408 of file vartype.c.

1409{
1410 CONVVARS(signed char);
1411 int i;
1412
1413 CONVERTRANGE(VarI4FromI1, -128, 128);
1414}
HRESULT WINAPI VarI4FromI1(signed char cIn, LONG *piOut)
Definition: vartype.c:1666

Referenced by START_TEST().

◆ test_VarI4FromI2()

static void test_VarI4FromI2 ( void  )
static

Definition at line 1416 of file vartype.c.

1417{
1418 CONVVARS(SHORT);
1419 int i;
1420
1421 CONVERTRANGE(VarI4FromI2, -32768, 32768);
1422}
HRESULT WINAPI VarI4FromI2(SHORT sIn, LONG *piOut)
Definition: vartype.c:1510

Referenced by START_TEST().

◆ test_VarI4FromI8()

static void test_VarI4FromI8 ( void  )
static

Definition at line 1424 of file vartype.c.

1425{
1427
1428 CONVERT(VarI4FromI8, -1); EXPECT(-1);
1429 CONVERT(VarI4FromI8, 0); EXPECT(0);
1430 CONVERT(VarI4FromI8, 1); EXPECT(1);
1431
1432 CONVERT_I8(VarI4FromI8, -1, 2147483647ul); EXPECT_OVERFLOW;
1433 CONVERT_I8(VarI4FromI8, -1, 2147483648ul); EXPECT(-2147483647 - 1);
1434 CONVERT_I8(VarI4FromI8, 0, 2147483647ul); EXPECT(2147483647);
1435 CONVERT_I8(VarI4FromI8, 0, 2147483648ul); EXPECT_OVERFLOW;
1436}
HRESULT WINAPI VarI4FromI8(LONG64 llIn, LONG *piOut)
Definition: vartype.c:1745

Referenced by START_TEST().

◆ test_VarI4FromR4()

static void test_VarI4FromR4 ( void  )
static

Definition at line 1482 of file vartype.c.

1483{
1484 CONVVARS(FLOAT);
1485
1486 /* min/max values are not exactly representable in a float */
1487 CONVERT(VarI4FromR4, -1.0f); EXPECT(-1);
1488 CONVERT(VarI4FromR4, 0.0f); EXPECT(0);
1489 CONVERT(VarI4FromR4, 1.0f); EXPECT(1);
1490
1491 CONVERT(VarI4FromR4, -1.5f); EXPECT(-2);
1492 CONVERT(VarI4FromR4, -0.6f); EXPECT(-1);
1493 CONVERT(VarI4FromR4, -0.5f); EXPECT(0);
1494 CONVERT(VarI4FromR4, -0.4f); EXPECT(0);
1495 CONVERT(VarI4FromR4, 0.4f); EXPECT(0);
1496 CONVERT(VarI4FromR4, 0.5f); EXPECT(0);
1497 CONVERT(VarI4FromR4, 0.6f); EXPECT(1);
1498 CONVERT(VarI4FromR4, 1.5f); EXPECT(2);
1499}
HRESULT WINAPI VarI4FromR4(FLOAT fltIn, LONG *piOut)
Definition: vartype.c:1528

Referenced by START_TEST().

◆ test_VarI4FromR8()

static void test_VarI4FromR8 ( void  )
static

Definition at line 1501 of file vartype.c.

1502{
1504
1505 CONVERT(VarI4FromR8, -2147483649.0); EXPECT_OVERFLOW;
1506 CONVERT(VarI4FromR8, -2147483648.51); EXPECT_OVERFLOW;
1507 CONVERT(VarI4FromR8, -2147483648.5); EXPECT(-2147483647 - 1);
1508 CONVERT(VarI4FromR8, -2147483648.0); EXPECT(-2147483647 - 1);
1509 CONVERT(VarI4FromR8, -1.0); EXPECT(-1);
1510 CONVERT(VarI4FromR8, 0.0); EXPECT(0);
1511 CONVERT(VarI4FromR8, 1.0); EXPECT(1);
1512 CONVERT(VarI4FromR8, 2147483647.0); EXPECT(2147483647);
1513 CONVERT(VarI4FromR8, 2147483647.49); EXPECT(2147483647);
1514 CONVERT(VarI4FromR8, 2147483647.5); EXPECT_OVERFLOW;
1515 CONVERT(VarI4FromR8, 2147483648.0); EXPECT_OVERFLOW;
1516
1517 CONVERT(VarI4FromR8, -1.5); EXPECT(-2);
1518 CONVERT(VarI4FromR8, -0.6); EXPECT(-1);
1519 CONVERT(VarI4FromR8, -0.5); EXPECT(0);
1520 CONVERT(VarI4FromR8, -0.4); EXPECT(0);
1521 CONVERT(VarI4FromR8, 0.4); EXPECT(0);
1522 CONVERT(VarI4FromR8, 0.5); EXPECT(0);
1523 CONVERT(VarI4FromR8, 0.6); EXPECT(1);
1524 CONVERT(VarI4FromR8, 1.5); EXPECT(2);
1525}
HRESULT WINAPI VarI4FromR8(double dblIn, LONG *piOut)
Definition: vartype.c:1549

Referenced by START_TEST().

◆ test_VarI4FromStr()

static void test_VarI4FromStr ( void  )
static

Definition at line 1593 of file vartype.c.

1594{
1595 CONVVARS(LCID);
1596 OLECHAR buff[128];
1597
1599
1601 CONVERT_STR(VarI4FromStr,"0",0); EXPECT(0);
1602 CONVERT_STR(VarI4FromStr,"-2147483649",0); EXPECT_OVERFLOW;
1603 CONVERT_STR(VarI4FromStr,"-2147483648",0); EXPECT(-2147483647 -1);
1604 CONVERT_STR(VarI4FromStr,"2147483647",0); EXPECT(2147483647);
1605 CONVERT_STR(VarI4FromStr,"2147483648",0); EXPECT_OVERFLOW;
1606
1607 /* Rounding */
1616}
HRESULT WINAPI VarI4FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, LONG *piOut)
Definition: vartype.c:1611

Referenced by START_TEST().

◆ test_VarI4FromUI1()

static void test_VarI4FromUI1 ( void  )
static

Definition at line 1438 of file vartype.c.

1439{
1440 CONVVARS(BYTE);
1441 int i;
1442
1443 CONVERTRANGE(VarI4FromUI1, 0, 256);
1444}
HRESULT WINAPI VarI4FromUI1(BYTE bIn, LONG *piOut)
Definition: vartype.c:1491

Referenced by START_TEST().

◆ test_VarI4FromUI2()

static void test_VarI4FromUI2 ( void  )
static

Definition at line 1446 of file vartype.c.

1447{
1449 int i;
1450
1451 CONVERTRANGE(VarI4FromUI2, 0, 65536);
1452}
HRESULT WINAPI VarI4FromUI2(USHORT usIn, LONG *piOut)
Definition: vartype.c:1683

Referenced by START_TEST().

◆ test_VarI4FromUI4()

static void test_VarI4FromUI4 ( void  )
static

Definition at line 1454 of file vartype.c.

1455{
1456 CONVVARS(ULONG);
1457
1458 CONVERT(VarI4FromUI4, 0); EXPECT(0);
1459 CONVERT(VarI4FromUI4, 1); EXPECT(1);
1460 CONVERT(VarI4FromUI4, 2147483647); EXPECT(2147483647);
1461 CONVERT(VarI4FromUI4, 2147483648ul); EXPECT_OVERFLOW;
1462}
HRESULT WINAPI VarI4FromUI4(ULONG ulIn, LONG *piOut)
Definition: vartype.c:1701

Referenced by START_TEST().

◆ test_VarI4FromUI8()

static void test_VarI4FromUI8 ( void  )
static

Definition at line 1464 of file vartype.c.

1465{
1467
1468 CONVERT(VarI4FromUI8, 0); EXPECT(0);
1469 CONVERT(VarI4FromUI8, 1); EXPECT(1);
1470 CONVERT(VarI4FromUI8, 2147483647); EXPECT(2147483647);
1471 CONVERT(VarI4FromUI8, 2147483648ul); EXPECT_OVERFLOW;
1472}
HRESULT WINAPI VarI4FromUI8(ULONG64 ullIn, LONG *piOut)
Definition: vartype.c:1763

Referenced by START_TEST().

◆ test_VarI8ChangeTypeEx()

static void test_VarI8ChangeTypeEx ( void  )
static

Definition at line 2100 of file vartype.c.

2101{
2102 HRESULT hres;
2103 LONG64 in;
2104 VARIANTARG vSrc, vDst;
2105
2106 if (!has_i8)
2107 {
2108 win_skip("I8 and UI8 data types are not available\n");
2109 return;
2110 }
2111
2112 in = 1;
2113
2116}
#define INITIAL_TYPETESTI8(vt, val)
Definition: vartype.c:176
#define win_skip
Definition: test.h:163

Referenced by START_TEST().

◆ test_VarI8Copy()

static void test_VarI8Copy ( void  )
static

Definition at line 2069 of file vartype.c.

2070{
2071 HRESULT hres;
2072 VARIANTARG vSrc, vDst;
2073 LONGLONG in = 1;
2074
2075 if (!has_i8)
2076 {
2077 win_skip("I8 and UI8 data types are not available\n");
2078 return;
2079 }
2080
2081 VariantInit(&vSrc);
2082 VariantInit(&vDst);
2083 V_VT(&vSrc) = VT_I8;
2084 V_I8(&vSrc) = in;
2085 hres = VariantCopy(&vDst, &vSrc);
2086 ok(hres == S_OK && V_VT(&vDst) == VT_I8 && V_I8(&vDst) == in,
2087 "copy hres 0x%X, type %d, value (%x%08x) %x%08x\n",
2088 hres, V_VT(&vDst), (UINT)(in >> 32), (UINT)in, (UINT)(V_I8(&vDst) >> 32), (UINT)V_I8(&vDst) );
2089 V_VT(&vSrc) = VT_I8|VT_BYREF;
2090 V_I8REF(&vSrc) = &in;
2091 hres = VariantCopy(&vDst, &vSrc);
2092 ok(hres == S_OK && V_VT(&vDst) == (VT_I8|VT_BYREF) && V_I8REF(&vDst) == &in,
2093 "ref hres 0x%X, type %d, ref (%p) %p\n", hres, V_VT(&vDst), &in, V_I8REF(&vDst));
2094 hres = VariantCopyInd(&vDst, &vSrc);
2095 ok(hres == S_OK && V_VT(&vDst) == VT_I8 && V_I8(&vDst) == in,
2096 "copy hres 0x%X, type %d, value (%x%08x) %x%08x\n",
2097 hres, V_VT(&vDst), (UINT)(in >> 32), (UINT)in, (UINT)(V_I8(&vDst) >> 32), (UINT)V_I8(&vDst) );
2098}
#define V_I8REF(A)
Definition: oleauto.h:250

Referenced by START_TEST().

◆ test_VarI8FromBool()

static void test_VarI8FromBool ( void  )
static

Definition at line 1990 of file vartype.c.

1991{
1993 int i;
1994
1995 for (i = -32768; i < 32768; i++)
1996 {
1998 }
1999}
HRESULT WINAPI VarI8FromBool(VARIANT_BOOL boolIn, LONG64 *pi64Out)
Definition: vartype.c:2265
#define EXPECTI8(x)
Definition: vartype.c:1865

Referenced by START_TEST().

◆ test_VarI8FromCy()

static void test_VarI8FromCy ( void  )
static

Definition at line 2011 of file vartype.c.

2012{
2013 CONVVARS(CY);
2014
2015 CONVERT_CY(VarI8FromCy,-128); EXPECTI8(-129);
2019 CONVERT_CY(VarI8FromCy,127); EXPECTI8(127);
2020
2021 CONVERT_CY(VarI8FromCy,-1.5); EXPECTI8(-2);
2022 CONVERT_CY(VarI8FromCy,-0.6); EXPECTI8(-1);
2023 CONVERT_CY(VarI8FromCy,-0.5); EXPECTI8(-1);
2024 CONVERT_CY(VarI8FromCy,-0.4); EXPECTI8(-1);
2029}
HRESULT WINAPI VarI8FromCy(CY cyIn, LONG64 *pi64Out)
Definition: vartype.c:2174

Referenced by START_TEST().

◆ test_VarI8FromDate()

static void test_VarI8FromDate ( void  )
static

Definition at line 1970 of file vartype.c.

1971{
1972 CONVVARS(DATE);
1973
1974 CONVERT(VarI8FromDate, -128.0); EXPECTI8(-128);
1975 CONVERT(VarI8FromDate, -1.0); EXPECTI8(-1);
1976 CONVERT(VarI8FromDate, 0.0); EXPECTI8(0);
1977 CONVERT(VarI8FromDate, 1.0); EXPECTI8(1);
1978 CONVERT(VarI8FromDate, 127.0); EXPECTI8(127);
1979
1980 CONVERT(VarI8FromDate, -1.5); EXPECTI8(-2);
1981 CONVERT(VarI8FromDate, -0.6); EXPECTI8(-1);
1982 CONVERT(VarI8FromDate, -0.5); EXPECTI8(0);
1983 CONVERT(VarI8FromDate, -0.4); EXPECTI8(0);
1984 CONVERT(VarI8FromDate, 0.4); EXPECTI8(0);
1985 CONVERT(VarI8FromDate, 0.5); EXPECTI8(0);
1986 CONVERT(VarI8FromDate, 0.6); EXPECTI8(1);
1987 CONVERT(VarI8FromDate, 1.5); EXPECTI8(2);
1988}
HRESULT WINAPI VarI8FromDate(DATE dateIn, LONG64 *pi64Out)
Definition: vartype.c:2205

Referenced by START_TEST().

◆ test_VarI8FromDec()

static void test_VarI8FromDec ( void  )
static

Definition at line 2031 of file vartype.c.

2032{
2034
2036
2037 CONVERT_DEC(VarI8FromDec,0,0x80,0,128); EXPECTI8(-128);
2038 CONVERT_DEC(VarI8FromDec,0,0x80,0,1); EXPECTI8(-1);
2039 CONVERT_DEC(VarI8FromDec,0,0,0,0); EXPECTI8(0);
2040 CONVERT_DEC(VarI8FromDec,0,0,0,1); EXPECTI8(1);
2041 CONVERT_DEC(VarI8FromDec,0,0,0,127); EXPECTI8(127);
2042
2043 CONVERT_DEC(VarI8FromDec,2,0x80,0,12700); EXPECTI8(-127);
2044 CONVERT_DEC(VarI8FromDec,2,0,0,12700); EXPECTI8(127);
2045}
HRESULT WINAPI VarI8FromDec(DECIMAL *pdecIn, LONG64 *pi64Out)
Definition: vartype.c:2335

Referenced by START_TEST().

◆ test_VarI8FromI1()

static void test_VarI8FromI1 ( void  )
static

Definition at line 1877 of file vartype.c.

1878{
1879 CONVVARS(signed char);
1880 int i;
1881
1882 for (i = -128; i < 128; i++)
1883 {
1885 }
1886}
HRESULT WINAPI VarI8FromI1(signed char cIn, LONG64 *pi64Out)
Definition: vartype.c:2282

Referenced by START_TEST().

◆ test_VarI8FromI2()

static void test_VarI8FromI2 ( void  )
static

Definition at line 1899 of file vartype.c.

1900{
1901 CONVVARS(SHORT);
1902 int i;
1903
1904 for (i = -32768; i < 32768; i++)
1905 {
1907 }
1908}
HRESULT WINAPI VarI8FromI2(SHORT sIn, LONG64 *pi64Out)
Definition: vartype.c:2093

Referenced by START_TEST().

◆ test_VarI8FromR4()

static void test_VarI8FromR4 ( void  )
static

Definition at line 1930 of file vartype.c.

1931{
1932 CONVVARS(FLOAT);
1933
1934 CONVERT(VarI8FromR4, -128.0f); EXPECTI8(-128);
1935 CONVERT(VarI8FromR4, -1.0f); EXPECTI8(-1);
1936 CONVERT(VarI8FromR4, 0.0f); EXPECTI8(0);
1937 CONVERT(VarI8FromR4, 1.0f); EXPECTI8(1);
1938 CONVERT(VarI8FromR4, 127.0f); EXPECTI8(127);
1939
1940 CONVERT(VarI8FromR4, -1.5f); EXPECTI8(-2);
1941 CONVERT(VarI8FromR4, -0.6f); EXPECTI8(-1);
1942 CONVERT(VarI8FromR4, -0.5f); EXPECTI8(0);
1943 CONVERT(VarI8FromR4, -0.4f); EXPECTI8(0);
1944 CONVERT(VarI8FromR4, 0.4f); EXPECTI8(0);
1945 CONVERT(VarI8FromR4, 0.5f); EXPECTI8(0);
1946 CONVERT(VarI8FromR4, 0.6f); EXPECTI8(1);
1947 CONVERT(VarI8FromR4, 1.5f); EXPECTI8(2);
1948}
HRESULT WINAPI VarI8FromR4(FLOAT fltIn, LONG64 *pi64Out)
Definition: vartype.c:2112

Referenced by START_TEST().

◆ test_VarI8FromR8()

static void test_VarI8FromR8 ( void  )
static

Definition at line 1950 of file vartype.c.

1951{
1953
1954 CONVERT(VarI8FromR8, -128.0); EXPECTI8(-128);
1955 CONVERT(VarI8FromR8, -1.0); EXPECTI8(-1);
1956 CONVERT(VarI8FromR8, 0.0); EXPECTI8(0);
1957 CONVERT(VarI8FromR8, 1.0); EXPECTI8(1);
1958 CONVERT(VarI8FromR8, 127.0); EXPECTI8(127);
1959
1960 CONVERT(VarI8FromR8, -1.5); EXPECTI8(-2);
1961 CONVERT(VarI8FromR8, -0.6); EXPECTI8(-1);
1962 CONVERT(VarI8FromR8, -0.5); EXPECTI8(0);
1963 CONVERT(VarI8FromR8, -0.4); EXPECTI8(0);
1964 CONVERT(VarI8FromR8, 0.4); EXPECTI8(0);
1965 CONVERT(VarI8FromR8, 0.5); EXPECTI8(0);
1966 CONVERT(VarI8FromR8, 0.6); EXPECTI8(1);
1967 CONVERT(VarI8FromR8, 1.5); EXPECTI8(2);
1968}
HRESULT WINAPI VarI8FromR8(double dblIn, LONG64 *pi64Out)
Definition: vartype.c:2148

Referenced by START_TEST().

◆ test_VarI8FromStr()

static void test_VarI8FromStr ( void  )
static

Definition at line 2047 of file vartype.c.

Referenced by START_TEST().

◆ test_VarI8FromUI1()

static void test_VarI8FromUI1 ( void  )
static

Definition at line 1888 of file vartype.c.

1889{
1890 CONVVARS(BYTE);
1891 int i;
1892
1893 for (i = 0; i < 256; i++)
1894 {
1896 }
1897}
HRESULT WINAPI VarI8FromUI1(BYTE bIn, LONG64 *pi64Out)
Definition: vartype.c:2075

Referenced by START_TEST().

◆ test_VarI8FromUI2()

static void test_VarI8FromUI2 ( void  )
static

Definition at line 1910 of file vartype.c.

1911{
1913 int i;
1914
1915 for (i = -0; i < 65535; i++)
1916 {
1918 }
1919}
HRESULT WINAPI VarI8FromUI2(USHORT usIn, LONG64 *pi64Out)
Definition: vartype.c:2299

Referenced by START_TEST().

◆ test_VarI8FromUI4()

static void test_VarI8FromUI4 ( void  )
static

Definition at line 1921 of file vartype.c.

1922{
1923 CONVVARS(ULONG);
1924
1927 CONVERT(VarI8FromUI4, 4294967295ul); EXPECTI8(4294967295ul);
1928}
HRESULT WINAPI VarI8FromUI4(ULONG ulIn, LONG64 *pi64Out)
Definition: vartype.c:2316

Referenced by START_TEST().

◆ test_VarI8FromUI8()

static void test_VarI8FromUI8 ( void  )
static

Definition at line 2001 of file vartype.c.

2002{
2004
2007 CONVERT_I8(VarI8FromUI8, 0x7fffffff, 0xffffffff); EXPECTI864(0x7fffffff, 0xffffffff);
2008 CONVERT_I8(VarI8FromUI8, 0x80000000, 0); EXPECT_OVERFLOW;
2009}
HRESULT WINAPI VarI8FromUI8(ULONG64 ullIn, LONG64 *pi64Out)
Definition: vartype.c:2378
#define EXPECTI864(x, y)
Definition: vartype.c:1871

Referenced by START_TEST().

◆ test_VarR4ChangeTypeEx()

static void test_VarR4ChangeTypeEx ( void  )
static

Definition at line 2547 of file vartype.c.

2548{
2549#ifdef HAS_UINT64_TO_FLOAT
2550 HRESULT hres;
2551 float in;
2552 VARIANTARG vSrc, vDst;
2553
2554 in = 1.0f;
2555
2556 INITIAL_TYPETEST(VT_R4, V_R4, "%f");
2558#endif
2559}

Referenced by START_TEST().

◆ test_VarR4Copy()

static void test_VarR4Copy ( void  )
static

Definition at line 2542 of file vartype.c.

2543{
2544 COPYTEST(77665544.0f, VT_R4, V_R4(&vSrc), V_R4(&vDst), V_R4REF(&vSrc),V_R4REF(&vDst), "%15.15f");
2545}
#define V_R4REF(A)
Definition: oleauto.h:261

Referenced by START_TEST().

◆ test_VarR4FromBool()

static void test_VarR4FromBool ( void  )
static

Definition at line 2447 of file vartype.c.

2448{
2450
2451 CONVERT(VarR4FromBool, VARIANT_TRUE); EXPECT(VARIANT_TRUE * 1.0f);
2452 CONVERT(VarR4FromBool, VARIANT_FALSE); EXPECT(VARIANT_FALSE * 1.0f);
2453}
HRESULT WINAPI VarR4FromBool(VARIANT_BOOL boolIn, float *pFltOut)
Definition: vartype.c:2868

Referenced by START_TEST().

◆ test_VarR4FromCy()

static void test_VarR4FromCy ( void  )
static

Definition at line 2455 of file vartype.c.

2456{
2457 CONVVARS(CY);
2458
2459 CONVERT_CY(VarR4FromCy,-32768); EXPECT(-32768.0f);
2460 CONVERT_CY(VarR4FromCy,-1); EXPECT(-1.0f);
2461 CONVERT_CY(VarR4FromCy,0); EXPECT(0.0f);
2462 CONVERT_CY(VarR4FromCy,1); EXPECT(1.0f);
2463 CONVERT_CY(VarR4FromCy,32768); EXPECT(32768.0f);
2464
2465 CONVERT_CY(VarR4FromCy,-1.5); EXPECT(-1.5f);
2466 CONVERT_CY(VarR4FromCy,-0.6); EXPECT(-0.6f);
2467 CONVERT_CY(VarR4FromCy,-0.5); EXPECT(-0.5f);
2468 CONVERT_CY(VarR4FromCy,-0.4); EXPECT(-0.4f);
2469 CONVERT_CY(VarR4FromCy,0.4); EXPECT(0.4f);
2470 CONVERT_CY(VarR4FromCy,0.5); EXPECT(0.5f);
2471 CONVERT_CY(VarR4FromCy,0.6); EXPECT(0.6f);
2472 CONVERT_CY(VarR4FromCy,1.5); EXPECT(1.5f);
2473}
HRESULT WINAPI VarR4FromCy(CY cyIn, float *pFltOut)
Definition: vartype.c:2790

Referenced by START_TEST().

◆ test_VarR4FromDate()

static void test_VarR4FromDate ( void  )
static

Definition at line 2511 of file vartype.c.

2512{
2513 CONVVARS(DATE);
2514
2515 CONVERT(VarR4FromDate, -1.0); EXPECT(-1.0f);
2516 CONVERT(VarR4FromDate, 0.0); EXPECT(0.0f);
2517 CONVERT(VarR4FromDate, 1.0); EXPECT(1.0f);
2518}
HRESULT WINAPI VarR4FromDate(DATE dateIn, float *pFltOut)
Definition: vartype.c:2809

Referenced by START_TEST().

◆ test_VarR4FromDec()

static void test_VarR4FromDec ( void  )
static

Definition at line 2492 of file vartype.c.

2493{
2495
2497
2498 CONVERT_DEC(VarR4FromDec,0,0x80,0,32768); EXPECT(-32768.0f);
2499 CONVERT_DEC(VarR4FromDec,0,0x80,0,1); EXPECT(-1.0f);
2500 CONVERT_DEC(VarR4FromDec,0,0,0,0); EXPECT(0.0f);
2501 CONVERT_DEC(VarR4FromDec,0,0,0,1); EXPECT(1.0f);
2502 CONVERT_DEC(VarR4FromDec,0,0,0,32767); EXPECT(32767.0f);
2503
2504 CONVERT_DEC(VarR4FromDec,2,0x80,0,3276800); EXPECT(-32768.0f);
2505 CONVERT_DEC(VarR4FromDec,2,0,0,3276700); EXPECT(32767.0f);
2506 CONVERT_DEC(VarR4FromDec,10,0,0,3276700); EXPECT(0.00032767f);
2507
2508 CONVERT_DEC(VarR4FromDec,0,0,1,0); EXPECT(18446744073709551616.0f);
2509}
HRESULT WINAPI VarR4FromDec(DECIMAL *pDecIn, float *pFltOut)
Definition: vartype.c:2946

Referenced by START_TEST().

◆ test_VarR4FromI1()

static void test_VarR4FromI1 ( void  )
static

Definition at line 2381 of file vartype.c.

2382{
2383 CONVVARS(signed char);
2384 int i;
2385
2386 CONVERTRANGE(VarR4FromI1, -128, 128);
2387}
HRESULT WINAPI VarR4FromI1(signed char cIn, float *pFltOut)
Definition: vartype.c:2888

Referenced by START_TEST().

◆ test_VarR4FromI2()

static void test_VarR4FromI2 ( void  )
static

Definition at line 2397 of file vartype.c.

2398{
2399 CONVVARS(SHORT);
2400 int i;
2401
2402 CONVERTRANGE(VarR4FromI2, -32768, 32768);
2403}
HRESULT WINAPI VarR4FromI2(SHORT sIn, float *pFltOut)
Definition: vartype.c:2735

Referenced by START_TEST().

◆ test_VarR4FromI4()

static void test_VarR4FromI4 ( void  )
static

Definition at line 2413 of file vartype.c.

2414{
2415 CONVVARS(int);
2416
2417 CONVERT(VarR4FromI4, -2147483647-1); EXPECT(-2147483648.0f);
2418 CONVERT(VarR4FromI4, -1); EXPECT(-1.0f);
2419 CONVERT(VarR4FromI4, 0); EXPECT(0.0f);
2420 CONVERT(VarR4FromI4, 1); EXPECT(1.0f);
2421 CONVERT(VarR4FromI4, 2147483647); EXPECT(2147483647.0f);
2422}
HRESULT WINAPI VarR4FromI4(LONG lIn, float *pFltOut)
Definition: vartype.c:2752

Referenced by START_TEST().

◆ test_VarR4FromI8()

static void test_VarR4FromI8 ( void  )
static

Definition at line 2475 of file vartype.c.

2476{
2478
2479 CONVERT(VarR4FromI8, -1); EXPECT(-1.0f);
2480 CONVERT(VarR4FromI8, 0); EXPECT(0.0f);
2481 CONVERT(VarR4FromI8, 1); EXPECT(1.0f);
2482}
HRESULT WINAPI VarR4FromI8(LONG64 llIn, float *pFltOut)
Definition: vartype.c:2986

Referenced by START_TEST().

◆ test_VarR4FromR8()

static void test_VarR4FromR8 ( void  )
static

Definition at line 2435 of file vartype.c.

2436{
2437 CONVVARS(FLOAT);
2438
2439 CONVERT(VarR4FromR8, -1.0); EXPECT(-1.0f);
2440 CONVERT(VarR4FromR8, 0.0); EXPECT(0.0f);
2441 CONVERT(VarR4FromR8, 1.0); EXPECT(1.0f);
2442 CONVERT(VarR4FromR8, 1.5); EXPECT(1.5f);
2443
2444 /* Skip rounding tests - no rounding is done */
2445}
HRESULT WINAPI VarR4FromR8(double dblIn, float *pFltOut)
Definition: vartype.c:2770

Referenced by START_TEST().

◆ test_VarR4FromStr()

static void test_VarR4FromStr ( void  )
static

Definition at line 2520 of file vartype.c.

2521{
2522 CONVVARS(LCID);
2523 OLECHAR buff[128];
2524
2526
2528 CONVERT_STR(VarR4FromStr,"-1", 0); EXPECT(-1.0f);
2529 CONVERT_STR(VarR4FromStr,"0", 0); EXPECT(0.0f);
2530 CONVERT_STR(VarR4FromStr,"1", 0); EXPECT(1.0f);
2531
2540}
HRESULT WINAPI VarR4FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, float *pFltOut)
Definition: vartype.c:2830

Referenced by START_TEST().

◆ test_VarR4FromUI1()

static void test_VarR4FromUI1 ( void  )
static

Definition at line 2389 of file vartype.c.

2390{
2391 CONVVARS(BYTE);
2392 int i;
2393
2394 CONVERTRANGE(VarR4FromUI1, 0, 256);
2395}
HRESULT WINAPI VarR4FromUI1(BYTE bIn, float *pFltOut)
Definition: vartype.c:2718

Referenced by START_TEST().

◆ test_VarR4FromUI2()

static void test_VarR4FromUI2 ( void  )
static

Definition at line 2405 of file vartype.c.

2406{
2408 int i;
2409
2410 CONVERTRANGE(VarR4FromUI2, 0, 65536);
2411}
HRESULT WINAPI VarR4FromUI2(USHORT usIn, float *pFltOut)
Definition: vartype.c:2908

Referenced by START_TEST().

◆ test_VarR4FromUI4()

static void test_VarR4FromUI4 ( void  )
static

Definition at line 2424 of file vartype.c.

2425{
2426 CONVVARS(unsigned int);
2427
2428 CONVERT(VarR4FromUI4, 0); EXPECT(0.0f);
2429 CONVERT(VarR4FromUI4, 1); EXPECT(1.0f);
2430#if defined(__i386__) && (defined(_MSC_VER) || defined(__GNUC__))
2431 CONVERT(VarR4FromUI4, 0xffffffff); EXPECT(4294967296.0f);
2432#endif
2433}
HRESULT WINAPI VarR4FromUI4(ULONG ulIn, float *pFltOut)
Definition: vartype.c:2928

Referenced by START_TEST().

◆ test_VarR4FromUI8()

static void test_VarR4FromUI8 ( void  )
static

Definition at line 2484 of file vartype.c.

2485{
2487
2488 CONVERT(VarR4FromUI8, 0); EXPECT(0.0f);
2489 CONVERT(VarR4FromUI8, 1); EXPECT(1.0f);
2490}
HRESULT WINAPI VarR4FromUI8(ULONG64 ullIn, float *pFltOut)
Definition: vartype.c:3003

Referenced by START_TEST().

◆ test_VarR8ChangeTypeEx()

static void test_VarR8ChangeTypeEx ( void  )
static

Definition at line 2742 of file vartype.c.

2743{
2744#ifdef HAS_UINT64_TO_FLOAT
2745 HRESULT hres;
2746 double in;
2747 VARIANTARG vSrc, vDst;
2748
2749 in = 1.0;
2750
2751 INITIAL_TYPETEST(VT_R8, V_R8, "%g");
2753#endif
2754}

Referenced by START_TEST().

◆ test_VarR8Copy()

static void test_VarR8Copy ( void  )
static

Definition at line 2737 of file vartype.c.

2738{
2739 COPYTEST(77665544.0, VT_R8, V_R8(&vSrc), V_R8(&vDst), V_R8REF(&vSrc),V_R8REF(&vDst), "%16.16g");
2740}
#define V_R8REF(A)
Definition: oleauto.h:263

Referenced by START_TEST().

◆ test_VarR8FromBool()

static void test_VarR8FromBool ( void  )
static

Definition at line 2632 of file vartype.c.

2633{
2635
2636 CONVERT(VarR8FromBool, VARIANT_TRUE); EXPECT(VARIANT_TRUE * 1.0);
2637 CONVERT(VarR8FromBool, VARIANT_FALSE); EXPECT(VARIANT_FALSE * 1.0);
2638}
HRESULT WINAPI VarR8FromBool(VARIANT_BOOL boolIn, double *pDblOut)
Definition: vartype.c:3189

Referenced by START_TEST().

◆ test_VarR8FromCy()

static void test_VarR8FromCy ( void  )
static

Definition at line 2640 of file vartype.c.

2641{
2642 CONVVARS(CY);
2643
2644 CONVERT_CY(VarR8FromCy,-32769); EXPECT(-32769.0);
2645 CONVERT_CY(VarR8FromCy,-32768); EXPECT(-32768.0);
2646 CONVERT_CY(VarR8FromCy,-1); EXPECT(-1.0);
2647 CONVERT_CY(VarR8FromCy,0); EXPECT(0.0);
2648 CONVERT_CY(VarR8FromCy,1); EXPECT(1.0);
2649 CONVERT_CY(VarR8FromCy,32767); EXPECT(32767.0);
2650 CONVERT_CY(VarR8FromCy,32768); EXPECT(32768.0);
2651
2652 CONVERT_CY(VarR8FromCy,-1.5); EXPECT(-1.5);
2653 CONVERT_CY(VarR8FromCy,-0.6); EXPECT(-0.6);
2654 CONVERT_CY(VarR8FromCy,-0.5); EXPECT(-0.5);
2655 CONVERT_CY(VarR8FromCy,-0.4); EXPECT(-0.4);
2656 CONVERT_CY(VarR8FromCy,0.4); EXPECT(0.4);
2657 CONVERT_CY(VarR8FromCy,0.5); EXPECT(0.5);
2658 CONVERT_CY(VarR8FromCy,0.6); EXPECT(0.6);
2659 CONVERT_CY(VarR8FromCy,1.5); EXPECT(1.5);
2660}
HRESULT WINAPI VarR8FromCy(CY cyIn, double *pDblOut)
Definition: vartype.c:3113

Referenced by START_TEST().

◆ test_VarR8FromDate()

static void test_VarR8FromDate ( void  )
static

Definition at line 2703 of file vartype.c.

2704{
2705 CONVVARS(DATE);
2706
2707 CONVERT(VarR8FromDate, -1.0); EXPECT(-1.0);
2708 CONVERT(VarR8FromDate, -0.0); EXPECT(0.0);
2709 CONVERT(VarR8FromDate, 1.0); EXPECT(1.0);
2710}
HRESULT WINAPI VarR8FromDate(DATE dateIn, double *pDblOut)
Definition: vartype.c:3130

Referenced by START_TEST().

◆ test_VarR8FromDec()

static void test_VarR8FromDec ( void  )
static

Definition at line 2685 of file vartype.c.

2686{
2688
2690
2691 CONVERT_DEC(VarR8FromDec,0,0x80,0,32768); EXPECT(-32768.0);
2692 CONVERT_DEC(VarR8FromDec,0,0x80,0,1); EXPECT(-1.0);
2693 CONVERT_DEC(VarR8FromDec,0,0,0,0); EXPECT(0.0);
2694 CONVERT_DEC(VarR8FromDec,0,0,0,1); EXPECT(1.0);
2695 CONVERT_DEC(VarR8FromDec,0,0,0,32767); EXPECT(32767.0);
2696
2697 CONVERT_DEC(VarR8FromDec,2,0x80,0,3276800); EXPECT(-32768.0);
2698 CONVERT_DEC(VarR8FromDec,2,0,0,3276700); EXPECT(32767.0);
2699
2700 CONVERT_DEC(VarR8FromDec,0,0,1,0); EXPECT(18446744073709551616.0);
2701}
HRESULT WINAPI VarR8FromDec(const DECIMAL *pDecIn, double *pDblOut)
Definition: vartype.c:3267

Referenced by START_TEST().

◆ test_VarR8FromI1()

static void test_VarR8FromI1 ( void  )
static

Definition at line 2568 of file vartype.c.

2569{
2570 CONVVARS(signed char);
2571 int i;
2572
2573 CONVERTRANGE(VarR8FromI1, -128, 128);
2574}
HRESULT WINAPI VarR8FromI1(signed char cIn, double *pDblOut)
Definition: vartype.c:3209

Referenced by START_TEST().

◆ test_VarR8FromI2()

static void test_VarR8FromI2 ( void  )
static

Definition at line 2584 of file vartype.c.

2585{
2586 CONVVARS(SHORT);
2587 int i;
2588
2589 CONVERTRANGE(VarR8FromI2, -32768, 32768);
2590}
HRESULT WINAPI VarR8FromI2(SHORT sIn, double *pDblOut)
Definition: vartype.c:3062

Referenced by START_TEST().

◆ test_VarR8FromI4()

static void test_VarR8FromI4 ( void  )
static

Definition at line 2600 of file vartype.c.

2601{
2602 CONVVARS(int);
2603
2604 CONVERT(VarR8FromI4, -2147483647-1); EXPECT(-2147483648.0);
2605 CONVERT(VarR8FromI4, -1); EXPECT(-1.0);
2606 CONVERT(VarR8FromI4, 0); EXPECT(0.0);
2607 CONVERT(VarR8FromI4, 1); EXPECT(1.0);
2608 CONVERT(VarR8FromI4, 0x7fffffff); EXPECT(2147483647.0);
2609}
HRESULT WINAPI VarR8FromI4(LONG lIn, double *pDblOut)
Definition: vartype.c:3079

Referenced by START_TEST().

◆ test_VarR8FromI8()

static void test_VarR8FromI8 ( void  )
static

Definition at line 2662 of file vartype.c.

2663{
2665
2666 CONVERT(VarR8FromI8, -1); EXPECT(-1.0);
2667 CONVERT(VarR8FromI8, 0); EXPECT(0.0);
2668 CONVERT(VarR8FromI8, 1); EXPECT(1.0);
2669#if defined(__i386__) && (defined(_MSC_VER) || defined(__GNUC__))
2670 CONVERT_I8(VarR8FromI8, 0x7fffffff,0xffffffff); EXPECT(9223372036854775808.0);
2671#endif
2672}
HRESULT WINAPI VarR8FromI8(LONG64 llIn, double *pDblOut)
Definition: vartype.c:3306

Referenced by START_TEST().

◆ test_VarR8FromR4()

static void test_VarR8FromR4 ( void  )
static

Definition at line 2620 of file vartype.c.

2621{
2622 CONVVARS(FLOAT);
2623
2624 CONVERT(VarR8FromR4, -1.0f); EXPECT(-1.0);
2625 CONVERT(VarR8FromR4, 0.0f); EXPECT(0.0);
2626 CONVERT(VarR8FromR4, 1.0f); EXPECT(1.0);
2627 CONVERT(VarR8FromR4, 1.5f); EXPECT(1.5);
2628
2629 /* Skip rounding tests - no rounding is done */
2630}
HRESULT WINAPI VarR8FromR4(FLOAT fltIn, double *pDblOut)
Definition: vartype.c:3096

Referenced by START_TEST().

◆ test_VarR8FromStr()

static void test_VarR8FromStr ( void  )
static

Definition at line 2712 of file vartype.c.

2713{
2714 CONVVARS(LCID);
2715 OLECHAR buff[128];
2716
2718
2722
2733
2734 /* We already have exhaustive tests for number parsing, so skip those tests here */
2735}
HRESULT WINAPI VarR8FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, double *pDblOut)
Definition: vartype.c:3151

Referenced by START_TEST().

◆ test_VarR8FromUI1()

static void test_VarR8FromUI1 ( void  )
static

Definition at line 2576 of file vartype.c.

2577{
2578 CONVVARS(BYTE);
2579 int i;
2580
2581 CONVERTRANGE(VarR8FromUI1, 0, 256);
2582}
HRESULT WINAPI VarR8FromUI1(BYTE bIn, double *pDblOut)
Definition: vartype.c:3045

Referenced by START_TEST().

◆ test_VarR8FromUI2()

static void test_VarR8FromUI2 ( void  )
static

Definition at line 2592 of file vartype.c.

2593{
2595 int i;
2596
2597 CONVERTRANGE(VarR8FromUI2, 0, 65536);
2598}
HRESULT WINAPI VarR8FromUI2(USHORT usIn, double *pDblOut)
Definition: vartype.c:3229

Referenced by START_TEST().

◆ test_VarR8FromUI4()

static void test_VarR8FromUI4 ( void  )
static

Definition at line 2611 of file vartype.c.

2612{
2613 CONVVARS(unsigned int);
2614
2615 CONVERT(VarR8FromUI4, 0); EXPECT(0.0);
2616 CONVERT(VarR8FromUI4, 1); EXPECT(1.0);
2617 CONVERT(VarR8FromUI4, 0xffffffff); EXPECT(4294967295.0);
2618}
HRESULT WINAPI VarR8FromUI4(ULONG ulIn, double *pDblOut)
Definition: vartype.c:3249

Referenced by START_TEST().

◆ test_VarR8FromUI8()

static void test_VarR8FromUI8 ( void  )
static

Definition at line 2674 of file vartype.c.

2675{
2677
2678 CONVERT(VarR8FromUI8, 0); EXPECT(0.0);
2679 CONVERT(VarR8FromUI8, 1); EXPECT(1.0);
2680#if defined(__i386__) && (defined(_MSC_VER) || defined(__GNUC__))
2681 CONVERT_I8(VarR8FromUI8, 0x80000000,0); EXPECT(9223372036854775808.0);
2682#endif
2683}
HRESULT WINAPI VarR8FromUI8(ULONG64 ullIn, double *pDblOut)
Definition: vartype.c:3323

Referenced by START_TEST().

◆ test_VarR8Round()

static void test_VarR8Round ( void  )
static

Definition at line 2758 of file vartype.c.

2759{
2760 HRESULT hres;
2761 double left = 0.0, out;
2762 int right;
2763
2764 MATHRND(0.5432, 5); EXPECT(0.5432);
2765 MATHRND(0.5432, 4); EXPECT(0.5432);
2766 MATHRND(0.5432, 3); EXPECT(0.543);
2767 MATHRND(0.5432, 2); EXPECT(0.54);
2768 MATHRND(0.5432, 1); EXPECT(0.5);
2769 MATHRND(0.5532, 0); EXPECT(1);
2770 MATHRND(0.5532, -1); EXPECT_INVALID;
2771
2772 MATHRND(0.5568, 5); EXPECT(0.5568);
2773 MATHRND(0.5568, 4); EXPECT(0.5568);
2774 MATHRND(0.5568, 3); EXPECT(0.557);
2775 MATHRND(0.5568, 2); EXPECT(0.56);
2776 MATHRND(0.5568, 1); EXPECT(0.6);
2777 MATHRND(0.5568, 0); EXPECT(1);
2778 MATHRND(0.5568, -1); EXPECT_INVALID;
2779
2780 MATHRND(0.4999, 0); EXPECT(0);
2781 MATHRND(0.5000, 0); EXPECT(0);
2782 MATHRND(0.5001, 0); EXPECT(1);
2783 MATHRND(1.4999, 0); EXPECT(1);
2784 MATHRND(1.5000, 0); EXPECT(2);
2785 MATHRND(1.5001, 0); EXPECT(2);
2786}

Referenced by START_TEST().

◆ test_VarUI1ChangeTypeEx()

static void test_VarUI1ChangeTypeEx ( void  )
static

Definition at line 919 of file vartype.c.

920{
922 BYTE in;
923 VARIANTARG vSrc, vDst;
924
925 in = 1;
926
930}

Referenced by START_TEST().

◆ test_VarUI1Copy()

static void test_VarUI1Copy ( void  )
static

Definition at line 914 of file vartype.c.

915{
916 COPYTEST(1, VT_UI1, V_UI1(&vSrc), V_UI1(&vDst), V_UI1REF(&vSrc), V_UI1REF(&vDst), "%d");
917}
#define V_UI1REF(A)
Definition: oleauto.h:267

Referenced by START_TEST().

◆ test_VarUI1FromBool()

static void test_VarUI1FromBool ( void  )
static

Definition at line 711 of file vartype.c.

712{
714 int i;
715
716 /* Note that conversions from bool overflow! */
717 CONVERT(VarUI1FromBool, -1); EXPECT(255);
719 CONVERT(VarUI1FromBool, 256); EXPECT(0);
720}
HRESULT WINAPI VarUI1FromBool(VARIANT_BOOL boolIn, BYTE *pbOut)
Definition: vartype.c:758

Referenced by START_TEST().

◆ test_VarUI1FromCy()

static void test_VarUI1FromCy ( void  )
static

Definition at line 793 of file vartype.c.

794{
795 CONVVARS(CY);
796
800 CONVERT_CY(VarUI1FromCy,255); EXPECT(255);
802
803 /* Rounding */
812}
HRESULT WINAPI VarUI1FromCy(CY cyIn, BYTE *pbOut)
Definition: vartype.c:676

Referenced by START_TEST().

◆ test_VarUI1FromDate()

static void test_VarUI1FromDate ( void  )
static

Definition at line 772 of file vartype.c.

773{
774 CONVVARS(DATE);
775
777 CONVERT(VarUI1FromDate, 0.0); EXPECT(0);
778 CONVERT(VarUI1FromDate, 1.0); EXPECT(1);
779 CONVERT(VarUI1FromDate, 255.0); EXPECT(255);
781
782 /* Rounding */
785 CONVERT(VarUI1FromDate, -0.5); EXPECT(0);
786 CONVERT(VarUI1FromDate, -0.4); EXPECT(0);
787 CONVERT(VarUI1FromDate, 0.4); EXPECT(0);
788 CONVERT(VarUI1FromDate, 0.5); EXPECT(0);
789 CONVERT(VarUI1FromDate, 0.6); EXPECT(1);
790 CONVERT(VarUI1FromDate, 1.5); EXPECT(2);
791}
HRESULT WINAPI VarUI1FromDate(DATE dateIn, BYTE *pbOut)
Definition: vartype.c:698

Referenced by START_TEST().

◆ test_VarUI1FromDec()

static void test_VarUI1FromDec ( void  )
static

Definition at line 814 of file vartype.c.

815{
817
819
821 CONVERT_DEC(VarUI1FromDec,0,0,0,0); EXPECT(0);
822 CONVERT_DEC(VarUI1FromDec,0,0,0,1); EXPECT(1);
823 CONVERT_DEC(VarUI1FromDec,0,0,0,255); EXPECT(255);
825
827 CONVERT_DEC(VarUI1FromDec,2,0,0,25500); EXPECT(255);
828}
HRESULT WINAPI VarUI1FromDec(DECIMAL *pdecIn, BYTE *pbOut)
Definition: vartype.c:834

Referenced by START_TEST().

◆ test_VarUI1FromDisp()

static void test_VarUI1FromDisp ( void  )
static

Definition at line 854 of file vartype.c.

855{
857 CONVVARS(LCID);
858 VARIANTARG vSrc, vDst;
859
860 /* FIXME
861 * Conversions from IDispatch should get the default 'value' property
862 * from the IDispatch pointer and return it. The following tests this.
863 * However, I can't get these tests to return a valid value under native
864 * oleaut32, regardless of the value returned in response to the Invoke()
865 * call (early versions of oleaut32 call AddRef/Release, but not Invoke.
866 * I'm obviously missing something, as these conversions work fine
867 * when called through VBA on an object to get its default value property.
868 *
869 * Should this test be corrected so that it works under native it should be
870 * generalised and the remaining types checked as well.
871 */
873
874 VariantInit(&vSrc);
875 VariantInit(&vDst);
876
878 V_VT(&vSrc) = VT_DISPATCH;
879 V_DISPATCH(&vSrc) = &dispatch.IDispatch_iface;
880
881 SET_EXPECT(dispatch_invoke);
882 out = 10;
883 hres = VarUI1FromDisp(&dispatch.IDispatch_iface, in, &out);
884 ok(broken(hres == DISP_E_BADVARTYPE) || hres == S_OK, "got 0x%08x\n", hres);
885 ok(broken(out == 10) || out == 1, "got %d\n", out);
886 CHECK_CALLED(dispatch_invoke);
887
888 SET_EXPECT(dispatch_invoke);
889 V_VT(&vDst) = VT_EMPTY;
890 V_UI1(&vDst) = 0;
891 hres = VariantChangeTypeEx(&vDst, &vSrc, in, 0, VT_UI1);
892 ok(hres == S_OK, "got 0x%08x\n", hres);
893 ok(V_VT(&vDst) == VT_UI1, "got %d\n", V_VT(&vDst));
894 ok(V_UI1(&vDst) == 1, "got %d\n", V_UI1(&vDst));
895 CHECK_CALLED(dispatch_invoke);
896
897 dispatch.bFailInvoke = TRUE;
898
899 SET_EXPECT(dispatch_invoke);
900 out = 10;
901 hres = VarUI1FromDisp(&dispatch.IDispatch_iface, in, &out);
902 ok(hres == DISP_E_TYPEMISMATCH, "got 0x%08x\n", hres);
903 ok(out == 10, "got %d\n", out);
904 CHECK_CALLED(dispatch_invoke);
905
906 SET_EXPECT(dispatch_invoke);
907 V_VT(&vDst) = VT_EMPTY;
908 hres = VariantChangeTypeEx(&vDst, &vSrc, in, 0, VT_UI1);
909 ok(hres == DISP_E_TYPEMISMATCH, "got 0x%08x\n", hres);
910 ok(V_VT(&vDst) == VT_EMPTY, "got %d\n", V_VT(&vDst));
911 CHECK_CALLED(dispatch_invoke);
912}
#define broken(x)
Definition: atltest.h:178
HRESULT WINAPI VarUI1FromDisp(IDispatch *pdispIn, LCID lcid, BYTE *pbOut)
Definition: vartype.c:741
#define SET_EXPECT(func)
Definition: vartype.c:253
#define CHECK_CALLED(func)
Definition: vartype.c:268

Referenced by START_TEST().

◆ test_VarUI1FromI1()

static void test_VarUI1FromI1 ( void  )
static

Definition at line 645 of file vartype.c.

646{
647 CONVVARS(signed char);
648 int i;
649
650 OVERFLOWRANGE(VarUI1FromI1, -128, 0);
651 CONVERTRANGE(VarUI1FromI1, 0, 128);
652}
HRESULT WINAPI VarUI1FromI1(signed char cIn, BYTE *pbOut)
Definition: vartype.c:777

Referenced by START_TEST().

◆ test_VarUI1FromI2()

static void test_VarUI1FromI2 ( void  )
static

Definition at line 654 of file vartype.c.

655{
657 int i;
658
659 OVERFLOWRANGE(VarUI1FromI2, -32768, 0);
660 CONVERTRANGE(VarUI1FromI2, 0, 256);
661 OVERFLOWRANGE(VarUI1FromI2, 256, 32768);
662}
HRESULT WINAPI VarUI1FromI2(SHORT sIn, BYTE *pbOut)
Definition: vartype.c:590

Referenced by START_TEST().

◆ test_VarUI1FromI4()

static void test_VarUI1FromI4 ( void  )
static

Definition at line 664 of file vartype.c.

665{
666 CONVVARS(LONG);
667 int i;
668
670 CONVERTRANGE(VarUI1FromI4, 0, 256);
672}
HRESULT WINAPI VarUI1FromI4(LONG iIn, BYTE *pbOut)
Definition: vartype.c:609

Referenced by START_TEST().

◆ test_VarUI1FromI8()

static void test_VarUI1FromI8 ( void  )
static

Definition at line 674 of file vartype.c.

675{
677 int i;
678
680 CONVERTRANGE(VarUI1FromI8, 0, 256);
682}
HRESULT WINAPI VarUI1FromI8(LONG64 llIn, BYTE *pbOut)
Definition: vartype.c:860

Referenced by START_TEST().

◆ test_VarUI1FromR4()

static void test_VarUI1FromR4 ( void  )
static

Definition at line 722 of file vartype.c.

723{
725
728 CONVERT(VarUI1FromR4, -0.5f); EXPECT(0);
729 CONVERT(VarUI1FromR4, 0.0f); EXPECT(0);
730 CONVERT(VarUI1FromR4, 1.0f); EXPECT(1);
731 CONVERT(VarUI1FromR4, 255.0f); EXPECT(255);
732 CONVERT(VarUI1FromR4, 255.49f); EXPECT(255);
735
736 /* Rounding */
739 CONVERT(VarUI1FromR4, -0.5f); EXPECT(0);
740 CONVERT(VarUI1FromR4, -0.4f); EXPECT(0);
741 CONVERT(VarUI1FromR4, 0.4f); EXPECT(0);
742 CONVERT(VarUI1FromR4, 0.5f); EXPECT(0);
743 CONVERT(VarUI1FromR4, 0.6f); EXPECT(1);
744 CONVERT(VarUI1FromR4, 1.5f); EXPECT(2);
745}
HRESULT WINAPI VarUI1FromR4(FLOAT fltIn, BYTE *pbOut)
Definition: vartype.c:629

Referenced by START_TEST().

◆ test_VarUI1FromR8()

static void test_VarUI1FromR8 ( void  )
static

Definition at line 747 of file vartype.c.

748{
750
753 CONVERT(VarUI1FromR8, -0.5); EXPECT(0);
754 CONVERT(VarUI1FromR8, 0.0); EXPECT(0);
755 CONVERT(VarUI1FromR8, 1.0); EXPECT(1);
756 CONVERT(VarUI1FromR8, 255.0); EXPECT(255);
757 CONVERT(VarUI1FromR8, 255.49); EXPECT(255);
760
761 /* Rounding */
764 CONVERT(VarUI1FromR8, -0.5); EXPECT(0);
765 CONVERT(VarUI1FromR8, -0.4); EXPECT(0);
766 CONVERT(VarUI1FromR8, 0.4); EXPECT(0);
767 CONVERT(VarUI1FromR8, 0.5); EXPECT(0);
768 CONVERT(VarUI1FromR8, 0.6); EXPECT(1);
769 CONVERT(VarUI1FromR8, 1.5); EXPECT(2);
770}
HRESULT WINAPI VarUI1FromR8(double dblIn, BYTE *pbOut)
Definition: vartype.c:651

Referenced by START_TEST().

◆ test_VarUI1FromStr()

static void test_VarUI1FromStr ( void  )
static

◆ test_VarUI1FromUI2()

static void test_VarUI1FromUI2 ( void  )
static

Definition at line 684 of file vartype.c.

685{
687 int i;
688
690 OVERFLOWRANGE(VarUI1FromUI2, 256, 65536);
691}
HRESULT WINAPI VarUI1FromUI2(USHORT usIn, BYTE *pbOut)
Definition: vartype.c:796

Referenced by START_TEST().

◆ test_VarUI1FromUI4()

static void test_VarUI1FromUI4 ( void  )
static

Definition at line 693 of file vartype.c.

694{
696 int i;
697
700}
HRESULT WINAPI VarUI1FromUI4(ULONG ulIn, BYTE *pbOut)
Definition: vartype.c:815

Referenced by START_TEST().

◆ test_VarUI1FromUI8()

static void test_VarUI1FromUI8 ( void  )
static

Definition at line 702 of file vartype.c.

703{
705 int i;
706
709}
HRESULT WINAPI VarUI1FromUI8(ULONG64 ullIn, BYTE *pbOut)
Definition: vartype.c:879

Referenced by START_TEST().

◆ test_VarUI2ChangeTypeEx()

static void test_VarUI2ChangeTypeEx ( void  )
static

Definition at line 1388 of file vartype.c.

1389{
1390 HRESULT hres;
1391 USHORT in;
1392 VARIANTARG vSrc, vDst;
1393
1394 in = 1;
1395
1399}

Referenced by START_TEST().

◆ test_VarUI2Copy()

static void test_VarUI2Copy ( void  )
static

Definition at line 1383 of file vartype.c.

1384{
1385 COPYTEST(1, VT_UI2, V_UI2(&vSrc), V_UI2(&vDst), V_UI2REF(&vSrc), V_UI2REF(&vDst), "%d");
1386}
#define V_UI2REF(A)
Definition: oleauto.h:269

Referenced by START_TEST().

◆ test_VarUI2FromBool()

static void test_VarUI2FromBool ( void  )
static

Definition at line 1241 of file vartype.c.

1242{
1244 int i;
1245
1246 CONVERT(VarUI2FromBool, -1); EXPECT(65535); /* Wraps! */
1247 CONVERTRANGE(VarUI2FromBool, 0, 32768);
1248}
HRESULT WINAPI VarUI2FromBool(VARIANT_BOOL boolIn, USHORT *pusOut)
Definition: vartype.c:1373

Referenced by START_TEST().

◆ test_VarUI2FromCy()

static void test_VarUI2FromCy ( void  )
static

Definition at line 1321 of file vartype.c.

1322{
1323 CONVVARS(CY);
1324
1328 CONVERT_CY(VarUI2FromCy,65535); EXPECT(65535);
1330
1331 /* Rounding */
1334 CONVERT_CY(VarUI2FromCy,-0.5); EXPECT(0);
1335 CONVERT_CY(VarUI2FromCy,-0.4); EXPECT(0);
1340}
HRESULT WINAPI VarUI2FromCy(CY cyIn, USHORT *pusOut)
Definition: vartype.c:1311

Referenced by START_TEST().

◆ test_VarUI2FromDate()

static void test_VarUI2FromDate ( void  )
static

Definition at line 1300 of file vartype.c.

1301{
1302 CONVVARS(DATE);
1303
1305 CONVERT(VarUI2FromDate, 0.0); EXPECT(0);
1306 CONVERT(VarUI2FromDate, 1.0); EXPECT(1);
1307 CONVERT(VarUI2FromDate, 65535.0); EXPECT(65535);
1309
1310 /* Rounding */
1313 CONVERT(VarUI2FromDate, -0.5); EXPECT(0);
1314 CONVERT(VarUI2FromDate, -0.4); EXPECT(0);
1315 CONVERT(VarUI2FromDate, 0.4); EXPECT(0);
1316 CONVERT(VarUI2FromDate, 0.5); EXPECT(0);
1317 CONVERT(VarUI2FromDate, 0.6); EXPECT(1);
1318 CONVERT(VarUI2FromDate, 1.5); EXPECT(2);
1319}
HRESULT WINAPI VarUI2FromDate(DATE dateIn, USHORT *pusOut)
Definition: vartype.c:1290

Referenced by START_TEST().

◆ test_VarUI2FromDec()

static void test_VarUI2FromDec ( void  )
static

Definition at line 1342 of file vartype.c.

1343{
1345
1347
1349 CONVERT_DEC(VarUI2FromDec,0,0,0,0); EXPECT(0);
1350 CONVERT_DEC(VarUI2FromDec,0,0,0,1); EXPECT(1);
1351 CONVERT_DEC(VarUI2FromDec,0,0,0,65535); EXPECT(65535);
1353
1355 CONVERT_DEC(VarUI2FromDec,2,0,0,6553500); EXPECT(65535);
1357}
HRESULT WINAPI VarUI2FromDec(DECIMAL *pdecIn, USHORT *pusOut)
Definition: vartype.c:1428

Referenced by START_TEST().

◆ test_VarUI2FromI1()

static void test_VarUI2FromI1 ( void  )
static

Definition at line 1175 of file vartype.c.

1176{
1177 CONVVARS(signed char);
1178 int i;
1179
1180 OVERFLOWRANGE(VarUI2FromI1, -128, 0);
1181 CONVERTRANGE(VarUI2FromI1, 0, 128);
1182}
HRESULT WINAPI VarUI2FromI1(signed char cIn, USHORT *pusOut)
Definition: vartype.c:1391

Referenced by START_TEST().

◆ test_VarUI2FromI2()

static void test_VarUI2FromI2 ( void  )
static

Definition at line 1184 of file vartype.c.

1185{
1186 CONVVARS(SHORT);
1187 int i;
1188
1189 OVERFLOWRANGE(VarUI2FromI2, -32768, 0);
1190 CONVERTRANGE(VarUI2FromI2, 0, 32768);
1191}
HRESULT WINAPI VarUI2FromI2(SHORT sIn, USHORT *pusOut)
Definition: vartype.c:1212

Referenced by START_TEST().

◆ test_VarUI2FromI4()

static void test_VarUI2FromI4 ( void  )
static

Definition at line 1193 of file vartype.c.

1194{
1195 CONVVARS(LONG);
1196 int i;
1197
1198 OVERFLOWRANGE(VarUI2FromI4, -32768, 0);
1199 CONVERT(VarUI2FromI4, 0); EXPECT(0);
1200 CONVERT(VarUI2FromI4, 65535); EXPECT(65535);
1202}
HRESULT WINAPI VarUI2FromI4(LONG iIn, USHORT *pusOut)
Definition: vartype.c:1230

Referenced by START_TEST().

◆ test_VarUI2FromI8()

static void test_VarUI2FromI8 ( void  )
static

Definition at line 1204 of file vartype.c.

1205{
1207 int i;
1208
1209 OVERFLOWRANGE(VarUI2FromI8, -32768, 0);
1210 CONVERT(VarUI2FromI8, 0); EXPECT(0);
1211 CONVERT(VarUI2FromI8, 65535); EXPECT(65535);
1213}
HRESULT WINAPI VarUI2FromI8(LONG64 llIn, USHORT *pusOut)
Definition: vartype.c:1453

Referenced by START_TEST().

◆ test_VarUI2FromR4()

static void test_VarUI2FromR4 ( void  )
static

Definition at line 1250 of file vartype.c.

1251{
1252 CONVVARS(FLOAT);
1253
1256 CONVERT(VarUI2FromR4, -0.5f); EXPECT(0);
1257 CONVERT(VarUI2FromR4, 0.0f); EXPECT(0);
1258 CONVERT(VarUI2FromR4, 1.0f); EXPECT(1);
1259 CONVERT(VarUI2FromR4, 65535.0f); EXPECT(65535);
1260 CONVERT(VarUI2FromR4, 65535.49f); EXPECT(65535);
1263
1264 /* Rounding */
1267 CONVERT(VarUI2FromR4, -0.5f); EXPECT(0);
1268 CONVERT(VarUI2FromR4, -0.4f); EXPECT(0);
1269 CONVERT(VarUI2FromR4, 0.4f); EXPECT(0);
1270 CONVERT(VarUI2FromR4, 0.5f); EXPECT(0);
1271 CONVERT(VarUI2FromR4, 0.6f); EXPECT(1);
1272 CONVERT(VarUI2FromR4, 1.5f); EXPECT(2);
1273}
HRESULT WINAPI VarUI2FromR4(FLOAT fltIn, USHORT *pusOut)
Definition: vartype.c:1248

Referenced by START_TEST().

◆ test_VarUI2FromR8()

static void test_VarUI2FromR8 ( void  )
static

Definition at line 1275 of file vartype.c.

1276{
1278
1281 CONVERT(VarUI2FromR8, -0.5); EXPECT(0);
1282 CONVERT(VarUI2FromR8, 0.0); EXPECT(0);
1283 CONVERT(VarUI2FromR8, 1.0); EXPECT(1);
1284 CONVERT(VarUI2FromR8, 65535.0); EXPECT(65535);
1285 CONVERT(VarUI2FromR8, 65535.49); EXPECT(65535);
1288
1289 /* Rounding */
1292 CONVERT(VarUI2FromR8, -0.5); EXPECT(0);
1293 CONVERT(VarUI2FromR8, -0.4); EXPECT(0);
1294 CONVERT(VarUI2FromR8, 0.4); EXPECT(0);
1295 CONVERT(VarUI2FromR8, 0.5); EXPECT(0);
1296 CONVERT(VarUI2FromR8, 0.6); EXPECT(1);
1297 CONVERT(VarUI2FromR8, 1.5); EXPECT(2);
1298}
HRESULT WINAPI VarUI2FromR8(double dblIn, USHORT *pusOut)
Definition: vartype.c:1269

Referenced by START_TEST().

◆ test_VarUI2FromStr()

static void test_VarUI2FromStr ( void  )
static

Definition at line 1359 of file vartype.c.

Referenced by START_TEST().

◆ test_VarUI2FromUI1()

static void test_VarUI2FromUI1 ( void  )
static

Definition at line 1215 of file vartype.c.

1216{
1217 CONVVARS(BYTE);
1218 int i;
1219
1220 CONVERTRANGE(VarUI2FromUI1, 0, 256);
1221}
HRESULT WINAPI VarUI2FromUI1(BYTE bIn, USHORT *pusOut)
Definition: vartype.c:1194

Referenced by START_TEST().

◆ test_VarUI2FromUI4()

static void test_VarUI2FromUI4 ( void  )
static

Definition at line 1223 of file vartype.c.

1224{
1225 CONVVARS(ULONG);
1226
1228 CONVERT(VarUI2FromUI4, 65535); EXPECT(65535);
1230}
HRESULT WINAPI VarUI2FromUI4(ULONG ulIn, USHORT *pusOut)
Definition: vartype.c:1409

Referenced by START_TEST().

◆ test_VarUI2FromUI8()

static void test_VarUI2FromUI8 ( void  )
static

Definition at line 1232 of file vartype.c.

1233{
1235
1237 CONVERT(VarUI2FromUI8, 65535); EXPECT(65535);
1239}
HRESULT WINAPI VarUI2FromUI8(ULONG64 ullIn, USHORT *pusOut)
Definition: vartype.c:1471

Referenced by START_TEST().

◆ test_VarUI4ChangeTypeEx()

static void test_VarUI4ChangeTypeEx ( void  )
static

Definition at line 1845 of file vartype.c.

1846{
1847 HRESULT hres;
1848 ULONG in;
1849 VARIANTARG vSrc, vDst;
1850
1851 in = 1;
1852
1856}

Referenced by START_TEST().

◆ test_VarUI4Copy()

static void test_VarUI4Copy ( void  )
static

Definition at line 1840 of file vartype.c.

1841{
1842 COPYTEST(1u, VT_UI4, V_UI4(&vSrc), V_UI4(&vDst), V_UI4REF(&vSrc), V_UI4REF(&vDst), "%u");
1843}
#define V_UI4REF(A)
Definition: oleauto.h:271

Referenced by START_TEST().

◆ test_VarUI4FromBool()

static void test_VarUI4FromBool ( void  )
static

Definition at line 1706 of file vartype.c.

1707{
1709 int i;
1710
1711 CONVERTRANGE(VarUI4FromBool, -32768, 32768);
1712}
HRESULT WINAPI VarUI4FromBool(VARIANT_BOOL boolIn, ULONG *pulOut)
Definition: vartype.c:1958

Referenced by START_TEST().

◆ test_VarUI4FromCy()

static void test_VarUI4FromCy ( void  )
static

Definition at line 1780 of file vartype.c.

1781{
1782 CONVVARS(CY);
1783
1787 CONVERT_CY64(VarUI4FromCy,0,4294967295ul); EXPECT(4294967295ul);
1789
1792 CONVERT_CY(VarUI4FromCy,-0.5); EXPECT(0);
1793 CONVERT_CY(VarUI4FromCy,-0.4); EXPECT(0);
1798}
HRESULT WINAPI VarUI4FromCy(CY cyIn, ULONG *pulOut)
Definition: vartype.c:1897

Referenced by START_TEST().

◆ test_VarUI4FromDate()

static void test_VarUI4FromDate ( void  )
static

Definition at line 1760 of file vartype.c.

1761{
1763
1765 CONVERT(VarUI4FromDate, 0.0); EXPECT(0);
1766 CONVERT(VarUI4FromDate, 1.0); EXPECT(1);
1767 CONVERT(VarUI4FromDate, 4294967295.0); EXPECT(4294967295ul);
1768 CONVERT(VarUI4FromDate, 4294967296.0); EXPECT_OVERFLOW;
1769
1772 CONVERT(VarUI4FromDate, -0.5); EXPECT(0);
1773 CONVERT(VarUI4FromDate, -0.4); EXPECT(0);
1774 CONVERT(VarUI4FromDate, 0.4); EXPECT(0);
1775 CONVERT(VarUI4FromDate, 0.5); EXPECT(0);
1776 CONVERT(VarUI4FromDate, 0.6); EXPECT(1);
1777 CONVERT(VarUI4FromDate, 1.5); EXPECT(2);
1778}
HRESULT WINAPI VarUI4FromDate(DATE dateIn, ULONG *pulOut)
Definition: vartype.c:1879

Referenced by START_TEST().

◆ test_VarUI4FromDec()

static void test_VarUI4FromDec ( void  )
static

Definition at line 1800 of file vartype.c.

1801{
1803
1805
1807 CONVERT_DEC(VarUI4FromDec,0,0,0,0); EXPECT(0);
1808 CONVERT_DEC(VarUI4FromDec,0,0,0,1); EXPECT(1);
1809 CONVERT_DEC64(VarUI4FromDec,0,0,0,0,4294967295ul); EXPECT(4294967295ul);
1811
1812 CONVERT_DEC64(VarUI4FromDec,2,0,0,99,4294967196ul); EXPECT(4294967295ul);
1814}
HRESULT WINAPI VarUI4FromDec(DECIMAL *pdecIn, ULONG *pulOut)
Definition: vartype.c:2012

Referenced by START_TEST().

◆ test_VarUI4FromI1()

static void test_VarUI4FromI1 ( void  )
static

Definition at line 1641 of file vartype.c.

1642{
1643 CONVVARS(signed char);
1644 int i;
1645
1646 OVERFLOWRANGE(VarUI4FromI1, -127, 0);
1647 CONVERTRANGE(VarUI4FromI1, 0, 128);
1648}
HRESULT WINAPI VarUI4FromI1(signed char cIn, ULONG *pulOut)
Definition: vartype.c:1976

Referenced by START_TEST().

◆ test_VarUI4FromI2()

static void test_VarUI4FromI2 ( void  )
static

Definition at line 1650 of file vartype.c.

1651{
1652 CONVVARS(SHORT);
1653 int i;
1654
1655 OVERFLOWRANGE(VarUI4FromI2, -32768, 0);
1656 CONVERTRANGE(VarUI4FromI2, 0, 32768);
1657}
HRESULT WINAPI VarUI4FromI2(SHORT sIn, ULONG *pulOut)
Definition: vartype.c:1801

Referenced by START_TEST().

◆ test_VarUI4FromI4()

static void test_VarUI4FromI4 ( void  )
static

Definition at line 1686 of file vartype.c.

1687{
1688 CONVVARS(int);
1689
1691 CONVERT(VarUI4FromI4, 0); EXPECT(0);
1692 CONVERT(VarUI4FromI4, 1); EXPECT(1);
1693 CONVERT(VarUI4FromI4, 2147483647); EXPECT(2147483647);
1694}
HRESULT WINAPI VarUI4FromI4(LONG iIn, ULONG *pulOut)
Definition: vartype.c:1819

Referenced by START_TEST().

◆ test_VarUI4FromI8()

static void test_VarUI4FromI8 ( void  )
static

Definition at line 1667 of file vartype.c.

1668{
1670
1672 CONVERT(VarUI4FromI8, 0); EXPECT(0);
1673 CONVERT(VarUI4FromI8, 1); EXPECT(1);
1674 CONVERT(VarUI4FromI8, 4294967295ul); EXPECT(4294967295ul);
1676}
HRESULT WINAPI VarUI4FromI8(LONG64 llIn, ULONG *pulOut)
Definition: vartype.c:2037

Referenced by START_TEST().

◆ test_VarUI4FromR4()

static void test_VarUI4FromR4 ( void  )
static

Definition at line 1714 of file vartype.c.

1715{
1716 CONVVARS(FLOAT);
1717
1718 /* We can't test max values as they are not exactly representable in a float */
1721 CONVERT(VarUI4FromR4, -0.5f); EXPECT(0);
1722 CONVERT(VarUI4FromR4, 0.0f); EXPECT(0);
1723 CONVERT(VarUI4FromR4, 1.0f); EXPECT(1);
1724
1727 CONVERT(VarUI4FromR4, -0.5f); EXPECT(0);
1728 CONVERT(VarUI4FromR4, -0.4f); EXPECT(0);
1729 CONVERT(VarUI4FromR4, 0.4f); EXPECT(0);
1730 CONVERT(VarUI4FromR4, 0.5f); EXPECT(0);
1731 CONVERT(VarUI4FromR4, 0.6f); EXPECT(1);
1732 CONVERT(VarUI4FromR4, 1.5f); EXPECT(2);
1733
1734}
HRESULT WINAPI VarUI4FromR4(FLOAT fltIn, ULONG *pulOut)
Definition: vartype.c:1837

Referenced by START_TEST().

◆ test_VarUI4FromR8()

static void test_VarUI4FromR8 ( void  )
static

Definition at line 1736 of file vartype.c.

1737{
1739
1742 CONVERT(VarUI4FromR4, -0.5f); EXPECT(0);
1743 CONVERT(VarUI4FromR8, 0.0); EXPECT(0);
1744 CONVERT(VarUI4FromR8, 1.0); EXPECT(1);
1745 CONVERT(VarUI4FromR8, 4294967295.0); EXPECT(4294967295ul);
1746 CONVERT(VarUI4FromR8, 4294967295.49); EXPECT(4294967295ul);
1747 CONVERT(VarUI4FromR8, 4294967295.5); EXPECT_OVERFLOW;
1748 CONVERT(VarUI4FromR8, 4294967296.0); EXPECT_OVERFLOW;
1749
1752 CONVERT(VarUI4FromR8, -0.5); EXPECT(0);
1753 CONVERT(VarUI4FromR8, -0.4); EXPECT(0);
1754 CONVERT(VarUI4FromR8, 0.4); EXPECT(0);
1755 CONVERT(VarUI4FromR8, 0.5); EXPECT(0);
1756 CONVERT(VarUI4FromR8, 0.6); EXPECT(1);
1757 CONVERT(VarUI4FromR8, 1.5); EXPECT(2);
1758}
HRESULT WINAPI VarUI4FromR8(double dblIn, ULONG *pulOut)
Definition: vartype.c:1858

Referenced by START_TEST().

◆ test_VarUI4FromStr()

static void test_VarUI4FromStr ( void  )
static

Definition at line 1816 of file vartype.c.

Referenced by START_TEST().

◆ test_VarUI4FromUI1()

static void test_VarUI4FromUI1 ( void  )
static

Definition at line 1678 of file vartype.c.

1679{
1680 CONVVARS(BYTE);
1681 int i;
1682
1683 CONVERTRANGE(VarUI4FromUI1, 0, 256);
1684}
HRESULT WINAPI VarUI4FromUI1(BYTE bIn, ULONG *pulOut)
Definition: vartype.c:1783

Referenced by START_TEST().

◆ test_VarUI4FromUI2()

static void test_VarUI4FromUI2 ( void  )
static

Definition at line 1659 of file vartype.c.

1660{
1662 int i;
1663
1664 CONVERTRANGE(VarUI4FromUI2, 0, 65536);
1665}
HRESULT WINAPI VarUI4FromUI2(USHORT usIn, ULONG *pulOut)
Definition: vartype.c:1993

Referenced by START_TEST().

◆ test_VarUI4FromUI8()

static void test_VarUI4FromUI8 ( void  )
static

Definition at line 1696 of file vartype.c.

1697{
1699
1702 CONVERT(VarUI4FromI8, 4294967295ul); EXPECT(4294967295ul);
1704}
HRESULT WINAPI VarUI4FromUI8(ULONG64 ullIn, ULONG *pulOut)
Definition: vartype.c:2055

Referenced by START_TEST().

◆ test_VarUI8ChangeTypeEx()

static void test_VarUI8ChangeTypeEx ( void  )
static

Definition at line 2354 of file vartype.c.

2355{
2356 HRESULT hres;
2357 ULONG64 in;
2358 VARIANTARG vSrc, vDst;
2359
2360 if (!has_i8)
2361 {
2362 win_skip("I8 and UI8 data types are not available\n");
2363 return;
2364 }
2365
2366 in = 1;
2367
2370}

Referenced by START_TEST().

◆ test_VarUI8Copy()

static void test_VarUI8Copy ( void  )
static

Definition at line 2323 of file vartype.c.

2324{
2325 HRESULT hres;
2326 VARIANTARG vSrc, vDst;
2327 ULONGLONG in = 1;
2328
2329 if (!has_i8)
2330 {
2331 win_skip("I8 and UI8 data types are not available\n");
2332 return;
2333 }
2334
2335 VariantInit(&vSrc);
2336 VariantInit(&vDst);
2337 V_VT(&vSrc) = VT_UI8;
2338 V_UI8(&vSrc) = in;
2339 hres = VariantCopy(&vDst, &vSrc);
2340 ok(hres == S_OK && V_VT(&vDst) == VT_UI8 && V_UI8(&vDst) == in,
2341 "copy hres 0x%X, type %d, value (%x%08x) %x%08x\n",
2342 hres, V_VT(&vDst), (UINT)(in >> 32), (UINT)in, (UINT)(V_UI8(&vDst) >> 32), (UINT)V_UI8(&vDst) );
2343 V_VT(&vSrc) = VT_UI8|VT_BYREF;
2344 V_UI8REF(&vSrc) = &in;
2345 hres = VariantCopy(&vDst, &vSrc);
2346 ok(hres == S_OK && V_VT(&vDst) == (VT_UI8|VT_BYREF) && V_UI8REF(&vDst) == &in,
2347 "ref hres 0x%X, type %d, ref (%p) %p\n", hres, V_VT(&vDst), &in, V_UI8REF(&vDst));
2348 hres = VariantCopyInd(&vDst, &vSrc);
2349 ok(hres == S_OK && V_VT(&vDst) == VT_UI8 && V_UI8(&vDst) == in,
2350 "copy hres 0x%X, type %d, value (%x%08x) %x%08x\n",
2351 hres, V_VT(&vDst), (UINT)(in >> 32), (UINT)in, (UINT)(V_UI8(&vDst) >> 32), (UINT)V_UI8(&vDst) );
2352}
#define V_UI8REF(A)
Definition: oleauto.h:273
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by START_TEST().

◆ test_VarUI8FromBool()

static void test_VarUI8FromBool ( void  )
static

Definition at line 2239 of file vartype.c.

2240{
2242 int i;
2243
2244 for (i = -32768; i < 32768; i++)
2245 {
2247 }
2248}
HRESULT WINAPI VarUI8FromBool(VARIANT_BOOL boolIn, ULONG64 *pui64Out)
Definition: vartype.c:2594

Referenced by START_TEST().

◆ test_VarUI8FromCy()

static void test_VarUI8FromCy ( void  )
static

Definition at line 2259 of file vartype.c.

2260{
2261 CONVVARS(CY);
2262
2266 CONVERT_CY(VarUI8FromCy,255); EXPECTI8(255);
2267
2276}
HRESULT WINAPI VarUI8FromCy(CY cyIn, ULONG64 *pui64Out)
Definition: vartype.c:2498

Referenced by START_TEST().

◆ test_VarUI8FromDate()

static void test_VarUI8FromDate ( void  )
static

Definition at line 2220 of file vartype.c.

2221{
2222 CONVVARS(DATE);
2223
2227 CONVERT(VarUI8FromDate, 255.0); EXPECTI8(255);
2228
2231 CONVERT(VarUI8FromDate, -0.5); EXPECTI8(0);
2232 CONVERT(VarUI8FromDate, -0.4); EXPECTI8(0);
2237}
HRESULT WINAPI VarUI8FromDate(DATE dateIn, ULONG64 *pui64Out)
Definition: vartype.c:2533

Referenced by START_TEST().

◆ test_VarUI8FromDec()

static void test_VarUI8FromDec ( void  )
static

Definition at line 2278 of file vartype.c.

2279{
2281
2283
2284 /* This returns 1 under native; Wine fixes this bug and returns overflow */
2285 if (0)
2286 {
2287 CONVERT_DEC(VarUI8FromDec,0,0x80,0,1);
2288 }
2289
2290 CONVERT_DEC(VarUI8FromDec,0,0,0,0); EXPECTI8(0);
2291 CONVERT_DEC(VarUI8FromDec,0,0,0,1); EXPECTI8(1);
2292 CONVERT_DEC(VarUI8FromDec,0,0,0,255); EXPECTI8(255);
2293
2295 CONVERT_DEC(VarUI8FromDec,2,0,0,25500); EXPECTI8(255);
2296}
HRESULT WINAPI VarUI8FromDec(DECIMAL *pdecIn, ULONG64 *pui64Out)
Definition: vartype.c:2670

Referenced by START_TEST().

◆ test_VarUI8FromI1()

static void test_VarUI8FromI1 ( void  )
static

Definition at line 2122 of file vartype.c.

2123{
2124 CONVVARS(signed char);
2125 int i;
2126
2127 for (i = -128; i < 128; i++)
2128 {
2130 if (i < 0)
2132 else
2133 EXPECTI8(i);
2134 }
2135}
HRESULT WINAPI VarUI8FromI1(signed char cIn, ULONG64 *pui64Out)
Definition: vartype.c:2611

Referenced by START_TEST().

◆ test_VarUI8FromI2()

static void test_VarUI8FromI2 ( void  )
static

Definition at line 2148 of file vartype.c.

2149{
2150 CONVVARS(SHORT);
2151 int i;
2152
2153 for (i = -32768; i < 32768; i++)
2154 {
2156 if (i < 0)
2158 else
2159 EXPECTI8(i);
2160 }
2161}
HRESULT WINAPI VarUI8FromI2(SHORT sIn, ULONG64 *pui64Out)
Definition: vartype.c:2433

Referenced by START_TEST().

◆ test_VarUI8FromI8()

static void test_VarUI8FromI8 ( void  )
static

Definition at line 2250 of file vartype.c.

2251{
2253
2257}
HRESULT WINAPI VarUI8FromI8(LONG64 llIn, ULONG64 *pui64Out)
Definition: vartype.c:2399

Referenced by START_TEST().

◆ test_VarUI8FromR4()

static void test_VarUI8FromR4 ( void  )
static

Definition at line 2182 of file vartype.c.

2183{
2184 CONVVARS(FLOAT);
2185
2187 CONVERT(VarUI8FromR4, 0.0f); EXPECTI8(0);
2188 CONVERT(VarUI8FromR4, 1.0f); EXPECTI8(1);
2189 CONVERT(VarUI8FromR4, 255.0f); EXPECTI8(255);
2190
2193 CONVERT(VarUI8FromR4, -0.5f); EXPECTI8(0);
2194 CONVERT(VarUI8FromR4, -0.4f); EXPECTI8(0);
2195 CONVERT(VarUI8FromR4, 0.4f); EXPECTI8(0);
2196 CONVERT(VarUI8FromR4, 0.5f); EXPECTI8(0);
2197 CONVERT(VarUI8FromR4, 0.6f); EXPECTI8(1);
2198 CONVERT(VarUI8FromR4, 1.5f); EXPECTI8(2);
2199}
HRESULT WINAPI VarUI8FromR4(FLOAT fltIn, ULONG64 *pui64Out)
Definition: vartype.c:2451

Referenced by START_TEST().

◆ test_VarUI8FromR8()

static void test_VarUI8FromR8 ( void  )
static

Definition at line 2201 of file vartype.c.

2202{
2204
2206 CONVERT(VarUI8FromR8, 0.0); EXPECTI8(0);
2207 CONVERT(VarUI8FromR8, 1.0); EXPECTI8(1);
2208 CONVERT(VarUI8FromR8, 255.0); EXPECTI8(255);
2209
2212 CONVERT(VarUI8FromR8, -0.5); EXPECTI8(0);
2213 CONVERT(VarUI8FromR8, -0.4); EXPECTI8(0);
2214 CONVERT(VarUI8FromR8, 0.4); EXPECTI8(0);
2215 CONVERT(VarUI8FromR8, 0.5); EXPECTI8(0);
2216 CONVERT(VarUI8FromR8, 0.6); EXPECTI8(1);
2217 CONVERT(VarUI8FromR8, 1.5); EXPECTI8(2);
2218}
HRESULT WINAPI VarUI8FromR8(double dblIn, ULONG64 *pui64Out)
Definition: vartype.c:2473

Referenced by START_TEST().

◆ test_VarUI8FromStr()

static void test_VarUI8FromStr ( void  )
static

Definition at line 2298 of file vartype.c.

2299{
2300 CONVVARS(LCID);
2301 OLECHAR buff[128];
2302
2304
2308 CONVERT_STR(VarUI8FromStr,"2147483647",0); EXPECTI8(2147483647);
2309 CONVERT_STR(VarUI8FromStr,"18446744073709551614",0); EXPECTI864(0xFFFFFFFF,0xFFFFFFFE);
2310 CONVERT_STR(VarUI8FromStr,"18446744073709551615",0); EXPECTI864(0xFFFFFFFF,0xFFFFFFFF);
2311 CONVERT_STR(VarUI8FromStr,"18446744073709551616",0); EXPECT_OVERFLOW;
2312
2321}
HRESULT WINAPI VarUI8FromStr(OLECHAR *strIn, LCID lcid, ULONG dwFlags, ULONG64 *pui64Out)
Definition: vartype.c:2555

Referenced by START_TEST().

◆ test_VarUI8FromUI1()

static void test_VarUI8FromUI1 ( void  )
static

Definition at line 2137 of file vartype.c.

2138{
2139 CONVVARS(BYTE);
2140 int i;
2141
2142 for (i = 0; i < 256; i++)
2143 {
2145 }
2146}
HRESULT WINAPI VarUI8FromUI1(BYTE bIn, ULONG64 *pui64Out)
Definition: vartype.c:2416

Referenced by START_TEST().

◆ test_VarUI8FromUI2()

static void test_VarUI8FromUI2 ( void  )
static

Definition at line 2163 of file vartype.c.

2164{
2166 int i;
2167
2168 for (i = 0; i < 65535; i++)
2169 {
2171 }
2172}
HRESULT WINAPI VarUI8FromUI2(USHORT usIn, ULONG64 *pui64Out)
Definition: vartype.c:2628

Referenced by START_TEST().

◆ test_VarUI8FromUI4()

static void test_VarUI8FromUI4 ( void  )
static

Definition at line 2174 of file vartype.c.

2175{
2176 CONVVARS(ULONG);
2177
2179 CONVERT(VarUI8FromUI4, 0xffffffff); EXPECTI8(0xffffffff);
2180}
HRESULT WINAPI VarUI8FromUI4(ULONG ulIn, ULONG64 *pui64Out)
Definition: vartype.c:2645

Referenced by START_TEST().

◆ write_typelib()

static void write_typelib ( int  res_no,
const char filename 
)
static

Definition at line 5951 of file vartype.c.

5952{
5953 DWORD written;
5954 HANDLE file;
5955 HRSRC res;
5956 void *ptr;
5957
5959 ok( file != INVALID_HANDLE_VALUE, "file creation failed\n" );
5960 if (file == INVALID_HANDLE_VALUE) return;
5961 res = FindResourceA( GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(res_no), "TYPELIB" );
5962 ok( res != 0, "couldn't find resource\n" );
5965 ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
5966 CloseHandle( file );
5967}
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by create_test_typelib().

◆ wtoascii()

static const char * wtoascii ( LPWSTR  lpszIn)
static

Definition at line 3144 of file vartype.c.

3145{
3146 static char buff[256];
3147 WideCharToMultiByte(CP_ACP, 0, lpszIn, -1, buff, sizeof(buff), NULL, NULL);
3148 return buff;
3149}

Referenced by test_VarBstrFromR4(), and test_VarDateChangeTypeEx().

Variable Documentation

◆ BadDateStrings

const char* const BadDateStrings[]
static

Definition at line 2953 of file vartype.c.

Referenced by test_VarDateFromStr().

◆ DummyDispatch_VTable

const IDispatchVtbl DummyDispatch_VTable
static
Initial value:
=
{
}
static ULONG WINAPI DummyDispatch_Release(IDispatch *iface)
Definition: vartype.c:302
static HRESULT WINAPI DummyDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *names, UINT cnames, LCID lcid, DISPID *dispid)
Definition: vartype.c:336
static ULONG WINAPI DummyDispatch_AddRef(IDispatch *iface)
Definition: vartype.c:296
static HRESULT WINAPI DummyDispatch_Invoke(IDispatch *iface, DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, UINT *arg_err)
Definition: vartype.c:343
static HRESULT WINAPI DummyDispatch_GetTypeInfo(IDispatch *iface, UINT tinfo, LCID lcid, ITypeInfo **ti)
Definition: vartype.c:330
static HRESULT WINAPI DummyDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
Definition: vartype.c:324
static HRESULT WINAPI DummyDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppvObject)
Definition: vartype.c:308

Definition at line 381 of file vartype.c.

Referenced by init_test_dispatch().

◆ has_i8

◆ has_locales

BOOL has_locales
static

◆ hOleaut32

HMODULE hOleaut32
static

Definition at line 53 of file vartype.c.

Referenced by START_TEST().