74c4d3be591406301b451ca778a627582a0d6855
[reactos.git] / rostests / kmtests / rtl / RtlIsValidOemCharacter.c
1 /*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite Runtime library for RtlIsValidOemCharacter
5 * PROGRAMMER: Dmitry Chapyshev <dmitry@reactos.org>
6 */
7
8 #define KMT_EMULATE_KERNEL
9 #include <kmt_test.h>
10
11 START_TEST(RtlIsValidOemCharacter)
12 {
13 const WCHAR ValidCharsEn[] = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!#$%^&*()_+|`:;\"'-/\\ ";
14 const WCHAR InvalidChars[] = L"?\x0372\x03CF\x3D5F";
15 WCHAR unicode_null = UNICODE_NULL;
16 WCHAR tmp;
17 BOOLEAN res;
18 INT i;
19
20 res = RtlIsValidOemCharacter(&unicode_null);
21 ok(res != FALSE, "UNICODE_NULL is valid char\n");
22
23 /* Test for valid chars */
24 for (i = 0; i < (sizeof(ValidCharsEn) / sizeof(WCHAR)) - 1; i++)
25 {
26 tmp = ValidCharsEn[i];
27
28 res = RtlIsValidOemCharacter(&tmp);
29 ok(res != FALSE, "Expected success. '%C' [%d] is valid char\n", ValidCharsEn[i], i);
30 ok(tmp == RtlUpcaseUnicodeChar(ValidCharsEn[i]), "Expected upcase char for '%C' [%d]\n", ValidCharsEn[i], i);
31
32 tmp = RtlUpcaseUnicodeChar(ValidCharsEn[i]);
33 res = RtlIsValidOemCharacter(&tmp);
34 ok(res != FALSE, "Expected success. '%C' [%d] is valid char\n", ValidCharsEn[i], i);
35 ok(tmp == RtlUpcaseUnicodeChar(ValidCharsEn[i]), "Expected upcase char for '%C' [%d]\n", ValidCharsEn[i], i);
36 }
37
38 /* Test for invalid chars */
39 for (i = 0; i < (sizeof(InvalidChars) / sizeof(WCHAR)) - 1; i++)
40 {
41 tmp = InvalidChars[i];
42
43 res = RtlIsValidOemCharacter(&tmp);
44 ok(res == FALSE, "Expected fail. '%C' [%d] is NOT valid char\n", InvalidChars[i], i);
45 ok(tmp == RtlUpcaseUnicodeChar(InvalidChars[i]), "Expected upcase char for '%C' [%d]\n", InvalidChars[i], i);
46
47 tmp = RtlUpcaseUnicodeChar(InvalidChars[i]);
48 res = RtlIsValidOemCharacter(&tmp);
49 ok(res == FALSE, "Expected fail. '%C' [%d] is NOT valid char\n", InvalidChars[i], i);
50 ok(tmp == RtlUpcaseUnicodeChar(InvalidChars[i]), "Expected upcase char for '%C' [%d]\n", InvalidChars[i], i);
51 }
52 }
53