mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[KMTEST]
- Implement tests for RtlIsValidOemCharacter function svn path=/trunk/; revision=72579
This commit is contained in:
parent
e3b66d324c
commit
1a8c432587
3 changed files with 56 additions and 0 deletions
|
@ -87,6 +87,7 @@ list(APPEND KMTEST_DRV_SOURCE
|
|||
ntos_se/SeHelpers.c
|
||||
ntos_se/SeInheritance.c
|
||||
ntos_se/SeQueryInfoToken.c
|
||||
rtl/RtlIsValidOemCharacter.c
|
||||
${COMMON_SOURCE}
|
||||
|
||||
kmtest_drv/kmtest_drv.rc)
|
||||
|
|
|
@ -65,6 +65,7 @@ KMT_TESTFUNC Test_SeQueryInfoToken;
|
|||
KMT_TESTFUNC Test_RtlAvlTree;
|
||||
KMT_TESTFUNC Test_RtlException;
|
||||
KMT_TESTFUNC Test_RtlIntSafe;
|
||||
KMT_TESTFUNC Test_RtlIsValidOemCharacter;
|
||||
KMT_TESTFUNC Test_RtlMemory;
|
||||
KMT_TESTFUNC Test_RtlRegistry;
|
||||
KMT_TESTFUNC Test_RtlSplayTree;
|
||||
|
@ -134,6 +135,7 @@ const KMT_TEST TestList[] =
|
|||
{ "RtlAvlTreeKM", Test_RtlAvlTree },
|
||||
{ "RtlExceptionKM", Test_RtlException },
|
||||
{ "RtlIntSafeKM", Test_RtlIntSafe },
|
||||
{ "RtlIsValidOemCharacter", Test_RtlIsValidOemCharacter },
|
||||
{ "RtlMemoryKM", Test_RtlMemory },
|
||||
{ "RtlRegistryKM", Test_RtlRegistry },
|
||||
{ "RtlSplayTreeKM", Test_RtlSplayTree },
|
||||
|
|
53
rostests/kmtests/rtl/RtlIsValidOemCharacter.c
Normal file
53
rostests/kmtests/rtl/RtlIsValidOemCharacter.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* PROJECT: ReactOS kernel-mode tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Kernel-Mode Test Suite Runtime library for RtlIsValidOemCharacter
|
||||
* PROGRAMMER: Dmitry Chapyshev <dmitry@reactos.org>
|
||||
*/
|
||||
|
||||
#define KMT_EMULATE_KERNEL
|
||||
#include <kmt_test.h>
|
||||
|
||||
START_TEST(RtlIsValidOemCharacter)
|
||||
{
|
||||
const WCHAR ValidCharsEn[] = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!#$%^&*()_+|`:;\"'-/\\ ";
|
||||
const WCHAR InvalidChars[] = L"?\x0372\x03CF\x3D5F";
|
||||
WCHAR unicode_null = UNICODE_NULL;
|
||||
WCHAR tmp;
|
||||
BOOLEAN res;
|
||||
INT i;
|
||||
|
||||
res = RtlIsValidOemCharacter(&unicode_null);
|
||||
ok(res != FALSE, "UNICODE_NULL is valid char\n");
|
||||
|
||||
/* Test for valid chars */
|
||||
for (i = 0; i < (sizeof(ValidCharsEn) / sizeof(WCHAR)) - 1; i++)
|
||||
{
|
||||
tmp = ValidCharsEn[i];
|
||||
|
||||
res = RtlIsValidOemCharacter(&tmp);
|
||||
ok(res != FALSE, "Expected success. '%C' [%d] is valid char\n", ValidCharsEn[i], i);
|
||||
ok(tmp == RtlUpcaseUnicodeChar(ValidCharsEn[i]), "Expected upcase char for '%C' [%d]\n", ValidCharsEn[i], i);
|
||||
|
||||
tmp = RtlUpcaseUnicodeChar(ValidCharsEn[i]);
|
||||
res = RtlIsValidOemCharacter(&tmp);
|
||||
ok(res != FALSE, "Expected success. '%C' [%d] is valid char\n", ValidCharsEn[i], i);
|
||||
ok(tmp == RtlUpcaseUnicodeChar(ValidCharsEn[i]), "Expected upcase char for '%C' [%d]\n", ValidCharsEn[i], i);
|
||||
}
|
||||
|
||||
/* Test for invalid chars */
|
||||
for (i = 0; i < (sizeof(InvalidChars) / sizeof(WCHAR)) - 1; i++)
|
||||
{
|
||||
tmp = InvalidChars[i];
|
||||
|
||||
res = RtlIsValidOemCharacter(&tmp);
|
||||
ok(res == FALSE, "Expected fail. '%C' [%d] is NOT valid char\n", InvalidChars[i], i);
|
||||
ok(tmp == RtlUpcaseUnicodeChar(InvalidChars[i]), "Expected upcase char for '%C' [%d]\n", InvalidChars[i], i);
|
||||
|
||||
tmp = RtlUpcaseUnicodeChar(InvalidChars[i]);
|
||||
res = RtlIsValidOemCharacter(&tmp);
|
||||
ok(res == FALSE, "Expected fail. '%C' [%d] is NOT valid char\n", InvalidChars[i], i);
|
||||
ok(tmp == RtlUpcaseUnicodeChar(InvalidChars[i]), "Expected upcase char for '%C' [%d]\n", InvalidChars[i], i);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue