ReactOS  0.4.15-dev-448-gd6c4411
RtlIsValidOemCharacter.c
Go to the documentation of this file.
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 
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;
20 
21  res = RtlIsValidOemCharacter(&unicode_null);
22  ok(res != FALSE, "UNICODE_NULL is valid char\n");
23 
24  /* Test for valid chars */
25  for (i = 0; i < (sizeof(ValidCharsEn) / sizeof(WCHAR)) - 1; i++)
26  {
27  tmp = ValidCharsEn[i];
28 
30  ok(res != FALSE, "Expected success. '%C' [%d] is valid char\n", ValidCharsEn[i], i);
31  ok(tmp == RtlUpcaseUnicodeChar(ValidCharsEn[i]), "Expected upcase char for '%C' [%d]\n", ValidCharsEn[i], i);
32 
33  tmp = RtlUpcaseUnicodeChar(ValidCharsEn[i]);
35  ok(res != FALSE, "Expected success. '%C' [%d] is valid char\n", ValidCharsEn[i], i);
36  ok(tmp == RtlUpcaseUnicodeChar(ValidCharsEn[i]), "Expected upcase char for '%C' [%d]\n", ValidCharsEn[i], i);
37  }
38 
39  /* Test for invalid chars */
40  for (i = 0; i < (sizeof(InvalidChars) / sizeof(WCHAR)) - 1; i++)
41  {
42  tmp = InvalidChars[i];
43 
45  ok(res == FALSE, "Expected fail. '%C' [%d] is NOT valid char\n", InvalidChars[i], i);
46  ok(tmp == RtlUpcaseUnicodeChar(InvalidChars[i]), "Expected upcase char for '%C' [%d]\n", InvalidChars[i], i);
47 
48  tmp = RtlUpcaseUnicodeChar(InvalidChars[i]);
50  ok(res == FALSE, "Expected fail. '%C' [%d] is NOT valid char\n", InvalidChars[i], i);
51  ok(tmp == RtlUpcaseUnicodeChar(InvalidChars[i]), "Expected upcase char for '%C' [%d]\n", InvalidChars[i], i);
52  }
53 
54  _SEH2_TRY
55  {
57  }
59  {
60  /* Get the exception code */
62  }
63  _SEH2_END;
64 
65  ok(!NT_SUCCESS(Status), "Exception is expected but it did not occur\n");
66 }
67 
BOOLEAN NTAPI RtlIsValidOemCharacter(IN PWCHAR Char)
Definition: unicode.c:514
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI WCHAR NTAPI RtlUpcaseUnicodeChar(WCHAR Source)
int32_t INT
Definition: typedefs.h:57
_SEH2_TRY
Definition: create.c:4226
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UNICODE_NULL
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4400
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:3014
START_TEST(RtlIsValidOemCharacter)