[NTDLL_APITEST] Addendum to ae8c9a1f: really test the "zero Length, non-zero MaximumLength" case. + add few simplifications.

This commit is contained in:
Hermès Bélusca-Maïto 2020-01-03 17:41:14 +01:00
parent afb14bff33
commit ef2e1871b1
No known key found for this signature in database
GPG Key ID: 3B2539C65E7B93D0

View File

@ -34,7 +34,7 @@ START_TEST(RtlValidateUnicodeString)
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
// With a non-NULL but empty buffer, and zero lengths.
String.Buffer = L"";
RtlInitEmptyUnicodeString(&String, L"", 0);
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
Status = RtlValidateUnicodeString(1, &String);
@ -43,7 +43,7 @@ START_TEST(RtlValidateUnicodeString)
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
// With a non-NULL but empty buffer, and zero Length, non-zero MaximumLength.
String.Buffer = L"";
RtlInitEmptyUnicodeString(&String, L"", sizeof(WCHAR));
String.Length = 0;
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
@ -78,7 +78,8 @@ START_TEST(RtlValidateUnicodeString)
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
// NULL buffer, non-zero Length, zero MaximumLength.
// NULL buffer, non-zero Length, zero MaximumLength
// (tests also the case Length > MaximumLength that must fail).
String = ValidString;
String.Buffer = NULL;
String.MaximumLength = 0;
@ -98,7 +99,6 @@ START_TEST(RtlValidateUnicodeString)
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);
String = ValidString;
String.MaximumLength--; // MaximumLength was already >= 2 so it remains > 0.
Status = RtlValidateUnicodeString(0, &String);
ok(Status == STATUS_INVALID_PARAMETER, "Status = 0x%lx\n", Status);