crypt32/tests: Use todo_wine_if() in tests
André Hentschel
nerv at dawncrow.de
Mon Feb 15 16:14:32 CST 2016
Signed-off-by: André Hentschel <nerv at dawncrow.de>
---
dlls/crypt32/tests/chain.c | 90 ++++++----------------------------------------
dlls/crypt32/tests/store.c | 11 ++----
dlls/crypt32/tests/str.c | 55 +++++-----------------------
3 files changed, 20 insertions(+), 136 deletions(-)
diff --git a/dlls/crypt32/tests/chain.c b/dlls/crypt32/tests/chain.c
index 2a26888..b7fe08b 100644
--- a/dlls/crypt32/tests/chain.c
+++ b/dlls/crypt32/tests/chain.c
@@ -2809,10 +2809,7 @@ static PCCERT_CHAIN_CONTEXT getChain(HCERTCHAINENGINE engine,
checkTime->wDay, checkTime->wMonth, checkTime->wYear);
ret = pCertGetCertificateChain(engine, endCert, &fileTime,
includeStore ? store : NULL, &chainPara, flags, NULL, &chain);
- if (todo & TODO_CHAIN)
- todo_wine ok(ret, "Chain %d: CertGetCertificateChain failed: %08x\n",
- testIndex, GetLastError());
- else
+ todo_wine_if (todo & TODO_CHAIN)
ok(ret, "Chain %d: CertGetCertificateChain failed: %08x\n",
testIndex, GetLastError());
CertFreeCertificateContext(endCert);
@@ -2838,15 +2835,7 @@ static void checkElementStatus(const CERT_TRUST_STATUS *expected,
"%s[%d], element [%d,%d]: expected error %08x, got %08x\n",
testName, testIndex, chainIndex, elementIndex, expected->dwErrorStatus,
got->dwErrorStatus);
- else if (todo & TODO_ERROR)
- todo_wine
- ok(got->dwErrorStatus == expected->dwErrorStatus ||
- broken((got->dwErrorStatus & ~ignore->dwErrorStatus) ==
- (expected->dwErrorStatus & ~ignore->dwErrorStatus)),
- "%s[%d], element [%d,%d]: expected error %08x, got %08x\n",
- testName, testIndex, chainIndex, elementIndex, expected->dwErrorStatus,
- got->dwErrorStatus);
- else
+ else todo_wine_if (todo & TODO_ERROR)
ok(got->dwErrorStatus == expected->dwErrorStatus ||
broken((got->dwErrorStatus & ~ignore->dwErrorStatus) ==
(expected->dwErrorStatus & ~ignore->dwErrorStatus)),
@@ -2859,15 +2848,7 @@ static void checkElementStatus(const CERT_TRUST_STATUS *expected,
"%s[%d], element [%d,%d]: expected info %08x, got %08x\n",
testName, testIndex, chainIndex, elementIndex, expected->dwInfoStatus,
got->dwInfoStatus);
- else if (todo & TODO_INFO)
- todo_wine
- ok(got->dwInfoStatus == expected->dwInfoStatus ||
- broken((got->dwInfoStatus & ~ignore->dwInfoStatus) ==
- (expected->dwInfoStatus & ~ignore->dwInfoStatus)),
- "%s[%d], element [%d,%d]: expected info %08x, got %08x\n",
- testName, testIndex, chainIndex, elementIndex, expected->dwInfoStatus,
- got->dwInfoStatus);
- else
+ else todo_wine_if (todo & TODO_INFO)
ok(got->dwInfoStatus == expected->dwInfoStatus ||
broken((got->dwInfoStatus & ~ignore->dwInfoStatus) ==
(expected->dwInfoStatus & ~ignore->dwInfoStatus)),
@@ -2881,11 +2862,7 @@ static void checkSimpleChainStatus(const CERT_SIMPLE_CHAIN *simpleChain,
const CERT_TRUST_STATUS *ignore, DWORD todo, LPCSTR testName, DWORD testIndex,
DWORD chainIndex)
{
- if (todo & TODO_ELEMENTS)
- todo_wine ok(simpleChain->cElement == simpleChainStatus->cElement,
- "%s[%d]: expected %d elements, got %d\n", testName, testIndex,
- simpleChainStatus->cElement, simpleChain->cElement);
- else
+ todo_wine_if (todo & TODO_ELEMENTS)
ok(simpleChain->cElement == simpleChainStatus->cElement,
"%s[%d]: expected %d elements, got %d\n", testName, testIndex,
simpleChainStatus->cElement, simpleChain->cElement);
@@ -2915,18 +2892,8 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain,
ok(chain->cChain == chainStatus->cChain,
"%s[%d]: expected %d simple chains, got %d\n", testName, testIndex,
chainStatus->cChain, chain->cChain);
- if (todo & TODO_ERROR &&
+ todo_wine_if (todo & TODO_ERROR &&
chain->TrustStatus.dwErrorStatus != chainStatus->status.dwErrorStatus)
- todo_wine ok(chain->TrustStatus.dwErrorStatus ==
- chainStatus->status.dwErrorStatus ||
- broken((chain->TrustStatus.dwErrorStatus &
- ~chainStatus->statusToIgnore.dwErrorStatus) ==
- (chainStatus->status.dwErrorStatus &
- ~chainStatus->statusToIgnore.dwErrorStatus)),
- "%s[%d]: expected error %08x, got %08x\n",
- testName, testIndex, chainStatus->status.dwErrorStatus,
- chain->TrustStatus.dwErrorStatus);
- else
ok(chain->TrustStatus.dwErrorStatus ==
chainStatus->status.dwErrorStatus ||
broken((chain->TrustStatus.dwErrorStatus &
@@ -2937,18 +2904,8 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain,
"Verisign root certificate is available.\n",
testName, testIndex, chainStatus->status.dwErrorStatus,
chain->TrustStatus.dwErrorStatus, CERT_TRUST_IS_UNTRUSTED_ROOT);
- if (todo & TODO_INFO &&
+ todo_wine_if (todo & TODO_INFO &&
chain->TrustStatus.dwInfoStatus != chainStatus->status.dwInfoStatus)
- todo_wine ok(chain->TrustStatus.dwInfoStatus ==
- chainStatus->status.dwInfoStatus ||
- broken((chain->TrustStatus.dwInfoStatus &
- ~chainStatus->statusToIgnore.dwInfoStatus) ==
- (chainStatus->status.dwInfoStatus &
- ~chainStatus->statusToIgnore.dwInfoStatus)),
- "%s[%d]: expected info %08x, got %08x\n",
- testName, testIndex, chainStatus->status.dwInfoStatus,
- chain->TrustStatus.dwInfoStatus);
- else
ok(chain->TrustStatus.dwInfoStatus ==
chainStatus->status.dwInfoStatus ||
broken((chain->TrustStatus.dwInfoStatus &
@@ -4411,16 +4368,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
}
if (ret)
{
- if (check->todo & TODO_ERROR)
- todo_wine ok(policyStatus.dwError == check->status.dwError ||
- broken(policyStatus.dwError == CERT_TRUST_NO_ERROR) ||
- (check->brokenStatus && broken(policyStatus.dwError ==
- check->brokenStatus->dwError)),
- "%s[%d](%s): expected %08x, got %08x\n",
- testName, testIndex,
- IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
- check->status.dwError, policyStatus.dwError);
- else
+ todo_wine_if (check->todo & TODO_ERROR)
ok(policyStatus.dwError == check->status.dwError ||
broken(policyStatus.dwError == CERT_TRUST_NO_ERROR) ||
(check->brokenStatus && broken(policyStatus.dwError ==
@@ -4438,16 +4386,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
pCertFreeCertificateChain(chain);
return;
}
- if (check->todo & TODO_CHAINS)
- todo_wine ok(policyStatus.lChainIndex ==
- check->status.lChainIndex ||
- (check->brokenStatus && broken(policyStatus.lChainIndex ==
- check->brokenStatus->lChainIndex)),
- "%s[%d](%s): expected %d, got %d\n",
- testName, testIndex,
- IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
- check->status.lChainIndex, policyStatus.lChainIndex);
- else
+ todo_wine_if (check->todo & TODO_CHAINS)
ok(policyStatus.lChainIndex == check->status.lChainIndex ||
(check->brokenStatus && broken(policyStatus.lChainIndex ==
check->brokenStatus->lChainIndex)),
@@ -4455,21 +4394,12 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lChainIndex, policyStatus.lChainIndex);
- if (check->todo & TODO_ELEMENTS)
- todo_wine ok(policyStatus.lElementIndex ==
- check->status.lElementIndex ||
- (check->brokenStatus && broken(policyStatus.lElementIndex ==
- check->brokenStatus->lElementIndex)),
- "%s[%d](%s): expected %d, got %d\n",
- testName, testIndex,
- IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
- check->status.lElementIndex, policyStatus.lElementIndex);
- else
+ todo_wine_if (check->todo & TODO_ELEMENTS)
ok(policyStatus.lElementIndex == check->status.lElementIndex ||
(check->brokenStatus && broken(policyStatus.lElementIndex ==
check->brokenStatus->lElementIndex)),
- testName, testIndex,
"%s[%d](%s): expected %d, got %d\n",
+ testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lElementIndex, policyStatus.lElementIndex);
}
diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c
index a0c209a..4483936 100644
--- a/dlls/crypt32/tests/store.c
+++ b/dlls/crypt32/tests/store.c
@@ -317,11 +317,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb,
ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE,
CERT_STORE_SAVE_TO_MEMORY, &blob, 0);
ok(ret, "CertSaveStore failed: %08x\n", GetLastError());
- if (todo)
- todo_wine
- ok(blob.cbData == cb, "%s: expected size %d, got %d\n", name, cb,
- blob.cbData);
- else
+ todo_wine_if (todo)
ok(blob.cbData == cb, "%s: expected size %d, got %d\n", name, cb,
blob.cbData);
blob.pbData = HeapAlloc(GetProcessHeap(), 0, blob.cbData);
@@ -330,10 +326,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb,
ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE,
CERT_STORE_SAVE_TO_MEMORY, &blob, 0);
ok(ret, "CertSaveStore failed: %08x\n", GetLastError());
- if (todo)
- todo_wine
- ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name);
- else
+ todo_wine_if (todo)
ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name);
HeapFree(GetProcessHeap(), 0, blob.pbData);
}
diff --git a/dlls/crypt32/tests/str.c b/dlls/crypt32/tests/str.c
index cf7c2ef..5245885 100644
--- a/dlls/crypt32/tests/str.c
+++ b/dlls/crypt32/tests/str.c
@@ -254,16 +254,7 @@ static void test_CertRDNValueToStrA(void)
{
ret = pCertRDNValueToStrA(attrs[i].dwValueType, &attrs[i].Value,
buffer, sizeof(buffer));
- if (attrs[i].todo)
- {
- todo_wine
- ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %d\n",
- lstrlenA(attrs[i].str) + 1, ret);
- todo_wine
- ok(!strcmp(buffer, attrs[i].str), "Expected %s, got %s\n",
- attrs[i].str, buffer);
- }
- else
+ todo_wine_if (attrs[i].todo)
{
ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %d\n",
lstrlenA(attrs[i].str) + 1, ret);
@@ -359,16 +350,7 @@ static void test_CertRDNValueToStrW(void)
{
ret = pCertRDNValueToStrW(attrs[i].dwValueType, &attrs[i].Value,
buffer, sizeof(buffer) / sizeof(buffer[0]));
- if (attrs[i].todo)
- {
- todo_wine
- ok(ret == lstrlenW(attrs[i].str) + 1,
- "Expected length %d, got %d\n", lstrlenW(attrs[i].str) + 1, ret);
- todo_wine
- ok(!lstrcmpW(buffer, attrs[i].str), "Expected %s, got %s\n",
- wine_dbgstr_w(attrs[i].str), wine_dbgstr_w(buffer));
- }
- else
+ todo_wine_if (attrs[i].todo)
{
ok(ret == lstrlenW(attrs[i].str) + 1,
"Expected length %d, got %d\n", lstrlenW(attrs[i].str) + 1, ret);
@@ -394,27 +376,15 @@ static void test_NameToStrConversionA(PCERT_NAME_BLOB pName, DWORD dwStrType,
DWORD i;
i = pCertNameToStrA(X509_ASN_ENCODING, pName, dwStrType, NULL, 0);
- if (todo)
- todo_wine
- ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
- lstrlenA(expected) + 1, i);
- else
+ todo_wine_if (todo)
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i);
i = pCertNameToStrA(X509_ASN_ENCODING,pName, dwStrType, buffer,
sizeof(buffer));
- if (todo)
- todo_wine
- ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
- lstrlenA(expected) + 1, i);
- else
+ todo_wine_if (todo)
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i);
- if (todo)
- todo_wine
- ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected,
- buffer);
- else
+ todo_wine_if (todo)
ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected,
buffer);
}
@@ -577,24 +547,15 @@ static void test_NameToStrConversionW(PCERT_NAME_BLOB pName, DWORD dwStrType,
DWORD i;
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, NULL, 0);
- if (todo)
- todo_wine ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
- lstrlenW(expected) + 1, i);
- else
+ todo_wine_if (todo)
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i);
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, buffer,
sizeof(buffer) / sizeof(buffer[0]));
- if (todo)
- todo_wine ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
- lstrlenW(expected) + 1, i);
- else
+ todo_wine_if (todo)
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i);
- if (todo)
- todo_wine ok(!lstrcmpW(buffer, expected), "Expected %s, got %s\n",
- wine_dbgstr_w(expected), wine_dbgstr_w(buffer));
- else
+ todo_wine_if (todo)
ok(!lstrcmpW(buffer, expected), "Expected %s, got %s\n",
wine_dbgstr_w(expected), wine_dbgstr_w(buffer));
}
--
1.9.1
More information about the wine-patches
mailing list