Skip over most of the unused variant types to speed up the variant

tests.
This commit is contained in:
Chris Morgan 2004-04-23 02:40:30 +00:00 committed by Alexandre Julliard
parent 7930ce1287
commit 58dcfb6205
1 changed files with 38 additions and 0 deletions

View File

@ -75,6 +75,8 @@ static HRESULT (WINAPI *pVarFormat)(LPVARIANT,LPOLESTR,int,int,ULONG,BSTR*);
*/ */
#define EQ_DOUBLE(a,b) (fabs((a)-(b))<1e-14) #define EQ_DOUBLE(a,b) (fabs((a)-(b))<1e-14)
#define SKIPTESTS(a) if((a > VT_CLSID+10) && (a < VT_BSTR_BLOB-10)) continue;
static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 ) static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 )
{ {
while (*str1 && (*str1 == *str2)) { str1++; str2++; } while (*str1 && (*str1 == *str2)) { str1++; str2++; }
@ -272,6 +274,8 @@ static void test_VariantClear(void)
{ {
HRESULT hExpected = DISP_E_BADVARTYPE; HRESULT hExpected = DISP_E_BADVARTYPE;
SKIPTESTS(vt);
memset(&v, 0, sizeof(v)); memset(&v, 0, sizeof(v));
V_VT(&v) = vt | ExtraFlags[i]; V_VT(&v) = vt | ExtraFlags[i];
@ -303,6 +307,8 @@ static void test_VariantCopy(void)
{ {
for (vt = 0; vt <= VT_BSTR_BLOB; vt++) for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
{ {
SKIPTESTS(vt);
memset(&vSrc, 0, sizeof(vSrc)); memset(&vSrc, 0, sizeof(vSrc));
V_VT(&vSrc) = vt | ExtraFlags[i]; V_VT(&vSrc) = vt | ExtraFlags[i];
@ -329,6 +335,8 @@ static void test_VariantCopy(void)
{ {
for (vt = 0; vt <= VT_BSTR_BLOB; vt++) for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
{ {
SKIPTESTS(vt);
hExpected = DISP_E_BADVARTYPE; hExpected = DISP_E_BADVARTYPE;
memset(&vDst, 0, sizeof(vDst)); memset(&vDst, 0, sizeof(vDst));
@ -353,6 +361,8 @@ static void test_VariantCopy(void)
{ {
for (vt = 0; vt <= VT_BSTR_BLOB; vt++) for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
{ {
SKIPTESTS(vt);
hExpected = DISP_E_BADVARTYPE; hExpected = DISP_E_BADVARTYPE;
memset(&vDst, 0, sizeof(vDst)); memset(&vDst, 0, sizeof(vDst));
@ -410,6 +420,8 @@ static void test_VariantCopyInd(void)
for (vt = 0; vt <= VT_BSTR_BLOB; vt++) for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
{ {
SKIPTESTS(vt);
memset(&vSrc, 0, sizeof(vSrc)); memset(&vSrc, 0, sizeof(vSrc));
V_VT(&vSrc) = vt | ExtraFlags[i]; V_VT(&vSrc) = vt | ExtraFlags[i];
@ -456,6 +468,8 @@ static void test_VariantCopyInd(void)
{ {
for (vt = 0; vt <= VT_BSTR_BLOB; vt++) for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
{ {
SKIPTESTS(vt);
memset(&vDst, 0, sizeof(vDst)); memset(&vDst, 0, sizeof(vDst));
V_VT(&vDst) = vt | ExtraFlags[i]; V_VT(&vDst) = vt | ExtraFlags[i];
@ -483,6 +497,8 @@ static void test_VariantCopyInd(void)
for (vt = 0; vt <= VT_BSTR_BLOB; vt++) for (vt = 0; vt <= VT_BSTR_BLOB; vt++)
{ {
SKIPTESTS(vt);
memset(&vDst, 0, sizeof(vDst)); memset(&vDst, 0, sizeof(vDst));
V_VT(&vDst) = VT_EMPTY; V_VT(&vDst) = VT_EMPTY;
@ -1609,6 +1625,8 @@ static void test_VarAbs(void)
{ {
HRESULT hExpected = DISP_E_BADVARTYPE; HRESULT hExpected = DISP_E_BADVARTYPE;
SKIPTESTS(vt);
memset(&v, 0, sizeof(v)); memset(&v, 0, sizeof(v));
V_VT(&v) = vt | ExtraFlags[i]; V_VT(&v) = vt | ExtraFlags[i];
V_VT(&vDst) = VT_EMPTY; V_VT(&vDst) = VT_EMPTY;
@ -1693,6 +1711,8 @@ static void test_VarNot(void)
{ {
HRESULT hExpected = DISP_E_BADVARTYPE; HRESULT hExpected = DISP_E_BADVARTYPE;
SKIPTESTS(vt);
memset(&v, 0, sizeof(v)); memset(&v, 0, sizeof(v));
V_VT(&v) = vt | ExtraFlags[i]; V_VT(&v) = vt | ExtraFlags[i];
V_VT(&vDst) = VT_EMPTY; V_VT(&vDst) = VT_EMPTY;
@ -1942,8 +1962,12 @@ static void test_VarMod(void)
/* test all combinations of types */ /* test all combinations of types */
for(l = 0; l < VT_BSTR_BLOB; l++) for(l = 0; l < VT_BSTR_BLOB; l++)
{ {
SKIPTESTS(l);
for(r = 0; r < VT_BSTR_BLOB; r++) for(r = 0; r < VT_BSTR_BLOB; r++)
{ {
SKIPTESTS(r);
if(l == VT_BSTR) continue; if(l == VT_BSTR) continue;
if(l == VT_DISPATCH) continue; if(l == VT_DISPATCH) continue;
if(r == VT_BSTR) continue; if(r == VT_BSTR) continue;
@ -2264,6 +2288,8 @@ static void test_VarFix(void)
{ {
HRESULT bFail = TRUE; HRESULT bFail = TRUE;
SKIPTESTS(vt);
memset(&v, 0, sizeof(v)); memset(&v, 0, sizeof(v));
V_VT(&v) = vt | ExtraFlags[i]; V_VT(&v) = vt | ExtraFlags[i];
V_VT(&vDst) = VT_EMPTY; V_VT(&vDst) = VT_EMPTY;
@ -2378,6 +2404,8 @@ static void test_VarInt(void)
{ {
HRESULT bFail = TRUE; HRESULT bFail = TRUE;
SKIPTESTS(vt);
memset(&v, 0, sizeof(v)); memset(&v, 0, sizeof(v));
V_VT(&v) = vt | ExtraFlags[i]; V_VT(&v) = vt | ExtraFlags[i];
V_VT(&vDst) = VT_EMPTY; V_VT(&vDst) = VT_EMPTY;
@ -2497,6 +2525,8 @@ static void test_VarNeg(void)
{ {
HRESULT bFail = TRUE; HRESULT bFail = TRUE;
SKIPTESTS(vt);
memset(&v, 0, sizeof(v)); memset(&v, 0, sizeof(v));
V_VT(&v) = vt | ExtraFlags[i]; V_VT(&v) = vt | ExtraFlags[i];
V_VT(&vDst) = VT_EMPTY; V_VT(&vDst) = VT_EMPTY;
@ -2735,10 +2765,14 @@ static void test_VarXor(void)
for (leftvt = 0; leftvt <= VT_BSTR_BLOB; leftvt++) for (leftvt = 0; leftvt <= VT_BSTR_BLOB; leftvt++)
{ {
SKIPTESTS(leftvt);
for (rightvt = 0; rightvt <= VT_BSTR_BLOB; rightvt++) for (rightvt = 0; rightvt <= VT_BSTR_BLOB; rightvt++)
{ {
BOOL bFail = FALSE; BOOL bFail = FALSE;
SKIPTESTS(rightvt);
if (leftvt == VT_BSTR || rightvt == VT_BSTR || if (leftvt == VT_BSTR || rightvt == VT_BSTR ||
leftvt == VT_DISPATCH || rightvt == VT_DISPATCH || leftvt == VT_DISPATCH || rightvt == VT_DISPATCH ||
leftvt == VT_UNKNOWN || rightvt == VT_UNKNOWN) leftvt == VT_UNKNOWN || rightvt == VT_UNKNOWN)
@ -2875,10 +2909,14 @@ static void test_VarEqv(void)
for (leftvt = 0; leftvt <= VT_BSTR_BLOB; leftvt++) for (leftvt = 0; leftvt <= VT_BSTR_BLOB; leftvt++)
{ {
SKIPTESTS(leftvt);
for (rightvt = 0; rightvt <= VT_BSTR_BLOB; rightvt++) for (rightvt = 0; rightvt <= VT_BSTR_BLOB; rightvt++)
{ {
BOOL bFail = FALSE; BOOL bFail = FALSE;
SKIPTESTS(rightvt);
if (leftvt == VT_BSTR || rightvt == VT_BSTR || if (leftvt == VT_BSTR || rightvt == VT_BSTR ||
leftvt == VT_DISPATCH || rightvt == VT_DISPATCH || leftvt == VT_DISPATCH || rightvt == VT_DISPATCH ||
leftvt == VT_UNKNOWN || rightvt == VT_UNKNOWN) leftvt == VT_UNKNOWN || rightvt == VT_UNKNOWN)