mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 23:13:04 +00:00
Make RtlDosPathNameToNtPathName_U actually report sucess count too.
svn path=/trunk/; revision=57376
This commit is contained in:
parent
194222d3bc
commit
8052454a08
1 changed files with 22 additions and 18 deletions
|
@ -9,6 +9,7 @@
|
||||||
* non-ANSI characters somewhere in the path, all bets are currently off.
|
* non-ANSI characters somewhere in the path, all bets are currently off.
|
||||||
* - Remove hard-coded path size limits.
|
* - Remove hard-coded path size limits.
|
||||||
* - Un-tabify to match style of other code.
|
* - Un-tabify to match style of other code.
|
||||||
|
* - Clean up cruft. Probably remove the option of running it stand-alone.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Test to see that ntdll.RtlDosPathNameToNtPathName_U behaves _exactly_
|
/* Test to see that ntdll.RtlDosPathNameToNtPathName_U behaves _exactly_
|
||||||
|
@ -80,12 +81,14 @@ RtlDosPathNameToNtPathName_U_t RtlDosPathNameToNtPathName_U;
|
||||||
#endif // !COMPILE_AS_ROSTEST
|
#endif // !COMPILE_AS_ROSTEST
|
||||||
|
|
||||||
|
|
||||||
static void report_error(const char* pszErr)
|
static void check_result(BOOLEAN bOK, const char* pszErr)
|
||||||
{
|
{
|
||||||
#ifdef COMPILE_AS_ROSTEST
|
#ifdef COMPILE_AS_ROSTEST
|
||||||
ok(FALSE, "%s\n", pszErr);
|
ok(bOK, "%s\n", pszErr);
|
||||||
#else
|
#else
|
||||||
printf("\a** %s!\n", pszErr);
|
if (!bOK) {
|
||||||
|
printf("\a** %s!\n", pszErr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +117,10 @@ static void test2(LPCWSTR pwsz, LPCWSTR pwszExpected, LPCWSTR pwszExpectedPartNa
|
||||||
|
|
||||||
bOK = RtlDosPathNameToNtPathName_U(pwsz, &NtName, (PCWSTR*)&PartName, &RelativeName);
|
bOK = RtlDosPathNameToNtPathName_U(pwsz, &NtName, (PCWSTR*)&PartName, &RelativeName);
|
||||||
|
|
||||||
|
check_result(bOK, "RtlDosPathNameToNtPathName_U failed");
|
||||||
if (!bOK) {
|
if (!bOK) {
|
||||||
report_error("RtlDosPathNameToNtPathName_U failed");
|
|
||||||
printf("input: \"%S\"\n", pwsz);
|
printf("input: \"%S\"\n", pwsz);
|
||||||
return;
|
return;
|
||||||
// exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(COMPILE_AS_ROSTEST) && defined(PRINT_INFO)
|
#if !defined(COMPILE_AS_ROSTEST) && defined(PRINT_INFO)
|
||||||
|
@ -135,42 +137,44 @@ static void test2(LPCWSTR pwsz, LPCWSTR pwszExpected, LPCWSTR pwszExpectedPartNa
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disregarding input, output (NtName) shall always start with "\??\".
|
// Disregarding input, output (NtName) shall always start with "\??\".
|
||||||
if (memcmp(NtName.Buffer, L"\\??\\", 8)) {
|
bOK = NtName.Length >= 8 &&
|
||||||
report_error("NtName does not start with \"\\??\\\"");
|
memcmp(NtName.Buffer, L"\\??\\", 8) == 0;
|
||||||
|
check_result(bOK, "NtName does not start with \"\\??\\\"");
|
||||||
|
if (!bOK) {
|
||||||
return;
|
return;
|
||||||
// exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pwszExpected) {
|
if (pwszExpected) {
|
||||||
PWSTR pwszActual = NtName.Buffer + 4;
|
PWSTR pwszActual = NtName.Buffer + 4;
|
||||||
const size_t lenExp = wcslen(pwszExpected);
|
const size_t lenExp = wcslen(pwszExpected);
|
||||||
const size_t lenAct = (NtName.Length - 8) / 2;
|
const size_t lenAct = (NtName.Length - 8) / 2;
|
||||||
if (lenExp != lenAct ||
|
bOK = (lenExp == lenAct) &&
|
||||||
memcmp(pwszActual, pwszExpected, lenExp * 2))
|
memcmp(pwszActual, pwszExpected, lenExp * 2) == 0;
|
||||||
|
check_result(bOK, "Actual NtName does not match expectations!");
|
||||||
|
if (!bOK)
|
||||||
{
|
{
|
||||||
report_error("Actual NtName does not match expectations!");
|
|
||||||
printf("Expected: %2u chars \"%S\"\n", lenExp, pwszExpected);
|
printf("Expected: %2u chars \"%S\"\n", lenExp, pwszExpected);
|
||||||
printf("Actual : %2u chars \"%S\"\n", lenAct, lenAct ? pwszActual : L"(null)");
|
printf("Actual : %2u chars \"%S\"\n", lenAct, lenAct ? pwszActual : L"(null)");
|
||||||
return;
|
return;
|
||||||
// exit(1);
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (NtName.Length)
|
if (NtName.Length)
|
||||||
{
|
{
|
||||||
PWSTR pwszActual = NtName.Buffer + 4;
|
PWSTR pwszActual = NtName.Buffer + 4;
|
||||||
const size_t lenAct = (NtName.Length - 8) / 2;
|
const size_t lenAct = (NtName.Length - 8) / 2;
|
||||||
report_error("Unexpected NtName (expected NULL)");
|
check_result(FALSE, "Actual NtName does not match expectations!");
|
||||||
printf("Actual : %2u chars \"%S\"\n", lenAct, pwszActual);
|
printf("Actual : %2u chars \"%S\"\n", lenAct, pwszActual);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pwszExpectedPartName) {
|
if (pwszExpectedPartName) {
|
||||||
if (!PartName) {
|
if (!PartName) {
|
||||||
report_error("Actual PartName is unexpectedly NULL!");
|
check_result(FALSE, "Actual PartName is unexpectedly NULL!");
|
||||||
printf("Expected: \"%S\"\n", pwszExpectedPartName);
|
printf("Expected: \"%S\"\n", pwszExpectedPartName);
|
||||||
return;
|
return;
|
||||||
// exit(1);
|
|
||||||
}
|
}
|
||||||
if (wcscmp(PartName, pwszExpectedPartName)) {
|
bOK = wcscmp(PartName, pwszExpectedPartName) == 0;
|
||||||
report_error("Actual PartName does not match expected!");
|
check_result(bOK, "Actual PartName does not match expected!");
|
||||||
|
if (!bOK) {
|
||||||
printf("Expected: \"%S\"\n", pwszExpectedPartName);
|
printf("Expected: \"%S\"\n", pwszExpectedPartName);
|
||||||
printf("Actual : \"%S\"\n", PartName);
|
printf("Actual : \"%S\"\n", PartName);
|
||||||
return;
|
return;
|
||||||
|
@ -178,7 +182,7 @@ static void test2(LPCWSTR pwsz, LPCWSTR pwszExpected, LPCWSTR pwszExpectedPartNa
|
||||||
} else
|
} else
|
||||||
if (PartName)
|
if (PartName)
|
||||||
{
|
{
|
||||||
report_error("Unexpected PartName (expected NULL)");
|
check_result(FALSE, "Unexpected PartName (expected NULL)");
|
||||||
printf("Actual : %S\n", PartName);
|
printf("Actual : %S\n", PartName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue