oleaut32/tests: Simplify test by using long long constants.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-04-12 09:59:48 +02:00 committed by Alexandre Julliard
parent 21f82ad4ff
commit f438e285d3
3 changed files with 18 additions and 23 deletions

View File

@ -39,21 +39,18 @@ static inline void release_iface_(unsigned int line, void *iface)
}
#define release_iface(a) release_iface_(__LINE__, a)
/* ULL suffix is not portable */
#define ULL_CONST(dw1, dw2) ((((ULONGLONG)dw1) << 32) | (ULONGLONG)dw2)
static const WCHAR test_bstr1[] = {'f','o','o',0,'b','a','r'};
static const WCHAR test_bstr2[] = {'t','e','s','t',0};
static const WCHAR test_bstr3[] = {'q','u','x',0};
static const WCHAR test_bstr4[] = {'a','b','c',0};
static const MYSTRUCT test_mystruct1 = {0x12345678, ULL_CONST(0xdeadbeef, 0x98765432), {0,1,2,3,4,5,6,7}};
static const MYSTRUCT test_mystruct2 = {0x91827364, ULL_CONST(0x88776655, 0x44332211), {3,6,1,4,0,1,3,0}};
static const MYSTRUCT test_mystruct3 = {0x1a1b1c1d, ULL_CONST(0x1e1f1011, 0x12131415), {9,2,4,5,6,5,1,3}};
static const MYSTRUCT test_mystruct4 = {0x2a2b2c2d, ULL_CONST(0x2e2f2021, 0x22232425), {0,4,6,7,3,6,7,4}};
static const MYSTRUCT test_mystruct5 = {0x3a3b3c3d, ULL_CONST(0x3e3f3031, 0x32333435), {1,6,7,3,8,4,6,5}};
static const MYSTRUCT test_mystruct6 = {0x4a4b4c4d, ULL_CONST(0x4e4f4041, 0x42434445), {3,6,5,3,4,8,0,9}};
static const MYSTRUCT test_mystruct7 = {0x5a5b5c5d, ULL_CONST(0x5e5f5051, 0x52535455), {1,8,4,4,4,2,3,1}};
static const MYSTRUCT test_mystruct1 = {0x12345678, 0xdeadbeef98765432ull, {0,1,2,3,4,5,6,7}};
static const MYSTRUCT test_mystruct2 = {0x91827364, 0x8877665544332211ull, {3,6,1,4,0,1,3,0}};
static const MYSTRUCT test_mystruct3 = {0x1a1b1c1d, 0x1e1f101112131415ull, {9,2,4,5,6,5,1,3}};
static const MYSTRUCT test_mystruct4 = {0x2a2b2c2d, 0x2e2f202122232425ull, {0,4,6,7,3,6,7,4}};
static const MYSTRUCT test_mystruct5 = {0x3a3b3c3d, 0x3e3f303132333435ull, {1,6,7,3,8,4,6,5}};
static const MYSTRUCT test_mystruct6 = {0x4a4b4c4d, 0x4e4f404142434445ull, {3,6,5,3,4,8,0,9}};
static const MYSTRUCT test_mystruct7 = {0x5a5b5c5d, 0x5e5f505152535455ull, {1,8,4,4,4,2,3,1}};
static const struct thin test_thin_struct = {-456, 78};
@ -1134,7 +1131,7 @@ static HRESULT WINAPI Widget_basetypes_out(IWidget *iface, signed char *c, short
*uc = 254;
*us = 256;
*ul = 0xf00dfade;
*uh = (((ULONGLONG)0xabcdef01) << 32) | (ULONGLONG)0x23456789;
*uh = 0xabcdef0123456789ull;
*f = M_LN2;
*d = M_LN10;
*st = STATE_UNWIDGETIFIED;
@ -2033,8 +2030,7 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp)
ok(uc == 254, "Got unsigned char %u.\n", uc);
ok(us == 256, "Got unsigned short %u.\n", us);
ok(ul == 0xf00dfade, "Got unsigned int %li.\n", ul);
ok(uh == ((((ULONGLONG)0xabcdef01) << 32) | (ULONGLONG)0x23456789),
"Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh));
ok(uh == 0xabcdef0123456789ull, "Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh));
ok(f == (float)M_LN2, "Got float %f.\n", f);
ok(d == M_LN10, "Got double %f.\n", d);
ok(st == STATE_UNWIDGETIFIED, "Got state %u.\n", st);
@ -2050,8 +2046,7 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp)
ok(uc == 254, "Got unsigned char %u.\n", uc);
ok(us == 256, "Got unsigned short %u.\n", us);
ok(ul == 0xf00dfade, "Got unsigned int %li.\n", ul);
ok(uh == ((((ULONGLONG)0xabcdef01) << 32) | (ULONGLONG)0x23456789),
"Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh));
ok(uh == 0xabcdef0123456789ull, "Got unsigned hyper %s.\n", wine_dbgstr_longlong(uh));
ok(f == (float)M_LN2, "Got float %f.\n", f);
ok(d == M_LN10, "Got double %f.\n", d);
ok(st == STATE_UNWIDGETIFIED, "Got state %u.\n", st);

View File

@ -1194,7 +1194,7 @@ static double WINAPI double_func( double a0, float a1, double a2, int a3 )
static LONGLONG WINAPI longlong_func( LONGLONG a0, CY a1 )
{
ok( a0 == (((ULONGLONG)0xdead << 32) | 0xbeef), "wrong arg0 %08lx%08lx\n", (DWORD)(a0 >> 32), (DWORD)a0);
ok( a0 == 0xdead00000000beefll, "wrong arg0 %08lx%08lx\n", (DWORD)(a0 >> 32), (DWORD)a0);
ok( a1.int64 == ((ULONGLONG)10000 * 12345678), "wrong arg1 %08lx%08lx\n",
(DWORD)(a1.int64 >> 32), (DWORD)a1.int64 );
return ((ULONGLONG)4321 << 32) | 8765;
@ -1379,7 +1379,7 @@ static void test_DispCallFunc(void)
memset( args, 0x55, sizeof(args) );
types[0] = VT_I8;
V_I8(&args[0]) = ((ULONGLONG)0xdead << 32) | 0xbeef;
V_I8(&args[0]) = 0xdead00000000beefll;
types[1] = VT_CY;
V_CY(&args[1]).int64 = (ULONGLONG)10000 * 12345678;
memset( &result, 0xcc, sizeof(result) );

View File

@ -2514,9 +2514,9 @@ static const char *szFailOk = "Call failed, hres = %08x\n";
ok(V_I4(&vOut) == val, "Expected i4 = %ld, got %ld\n", (LONG)val, V_I4(&vOut)); }
#define EXPECT_UI4(val) EXPECT_OK { EXPECT_TYPE(VT_UI4); \
ok(V_UI4(&vOut) == val, "Expected ui4 = %d, got %d\n", (ULONG)val, V_UI4(&vOut)); }
#define EXPECT_I8(high,low) EXPECT_OK { EXPECT_TYPE(VT_I8); \
ok(V_I8(&vOut) == ((((ULONG64)(high))<<32)|(low)), "Expected i8 = %lx%08lx, got %lx%08lx\n", \
(LONG)(high), (LONG)(low), (LONG)(V_I8(&vOut)>>32), (LONG)V_I8(&vOut) ); }
#define EXPECT_I8(val) EXPECT_OK { EXPECT_TYPE(VT_I8); \
ok(V_I8(&vOut) == val, "Expected i8 = %lx%08lx, got %lx%08lx\n", \
(LONG)(val >> 32), (LONG)(val), (LONG)(V_I8(&vOut)>>32), (LONG)V_I8(&vOut) ); }
#define EXPECT_UI8(val) EXPECT_OK { EXPECT_TYPE(VT_UI8); \
ok(V_UI8(&vOut) == val, "Expected ui8 = 0x%x%08x, got 0x%x%08x\n", \
(DWORD)((ULONG64)val >> 32), (DWORD)(ULONG64)val, (DWORD)(V_UI8(&vOut) >> 32), (DWORD)V_UI8(&vOut)); }
@ -2615,7 +2615,7 @@ static void test_VarNumFromParseNum(void)
/* We cannot use INTEGER_VTBITS as WinXP and Win2003 are broken(?). They
truncate the number to the smallest integer size requested:
CONVERT(16,0,0,16,4,0, INTEGER_VTBITS); EXPECT_I1((signed char)0xff); */
CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x7fffffff,0xffffffff);
CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x7fffffffffffffffull);
}
/* Assume the above pattern holds for numbers without hi-bit set, test (preservation of) hi-bit */
@ -2642,7 +2642,7 @@ static void test_VarNumFromParseNum(void)
truncate the number to the smallest integer size requested:
CONVERT(16,0,0,16,4,0, INTEGER_VTBITS & ~VTBIT_I1);
EXPECT_I2((signed short)0x0002); */
CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x80000000,0x00000002);
CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x8000000000000002ull);
}
/* Test (preservation of) hi-bit with STRICT type requesting */
@ -2665,7 +2665,7 @@ static void test_VarNumFromParseNum(void)
SETRGB(12, 0); SETRGB(13, 0); SETRGB(14, 0); SETRGB(15, 2);
if (has_i8)
{
CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x80000000,0x00000002);
CONVERT(16,0,0,16,4,0, VTBIT_I8); EXPECT_I8(0x8000000000000002ull);
}
/* Assume the above pattern holds for numbers with hi-bit set */