Author: dchapyshev
Date: Sun Sep  4 22:15:53 2016
New Revision: 72579

URL: http://svn.reactos.org/svn/reactos?rev=72579&view=rev
Log:
[KMTEST]
- Implement tests for RtlIsValidOemCharacter function

Added:
    trunk/rostests/kmtests/rtl/RtlIsValidOemCharacter.c   (with props)
Modified:
    trunk/rostests/kmtests/CMakeLists.txt
    trunk/rostests/kmtests/kmtest_drv/testlist.c

Modified: trunk/rostests/kmtests/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/CMakeLists.txt?rev=72579&r1=72578&r2=72579&view=diff
==============================================================================
--- trunk/rostests/kmtests/CMakeLists.txt       [iso-8859-1] (original)
+++ trunk/rostests/kmtests/CMakeLists.txt       [iso-8859-1] Sun Sep  4 
22:15:53 2016
@@ -87,6 +87,7 @@
     ntos_se/SeHelpers.c
     ntos_se/SeInheritance.c
     ntos_se/SeQueryInfoToken.c
+    rtl/RtlIsValidOemCharacter.c
     ${COMMON_SOURCE}
 
     kmtest_drv/kmtest_drv.rc)

Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testlist.c?rev=72579&r1=72578&r2=72579&view=diff
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/testlist.c        [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/testlist.c        [iso-8859-1] Sun Sep  4 
22:15:53 2016
@@ -65,6 +65,7 @@
 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 @@
     { "RtlAvlTreeKM",                       Test_RtlAvlTree },
     { "RtlExceptionKM",                     Test_RtlException },
     { "RtlIntSafeKM",                       Test_RtlIntSafe },
+    { "RtlIsValidOemCharacter",             Test_RtlIsValidOemCharacter },
     { "RtlMemoryKM",                        Test_RtlMemory },
     { "RtlRegistryKM",                      Test_RtlRegistry },
     { "RtlSplayTreeKM",                     Test_RtlSplayTree },

Added: trunk/rostests/kmtests/rtl/RtlIsValidOemCharacter.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/rtl/RtlIsValidOemCharacter.c?rev=72579
==============================================================================
--- trunk/rostests/kmtests/rtl/RtlIsValidOemCharacter.c (added)
+++ trunk/rostests/kmtests/rtl/RtlIsValidOemCharacter.c [iso-8859-1] Sun Sep  4 
22:15:53 2016
@@ -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 <dmi...@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);
+    }
+}
+

Propchange: trunk/rostests/kmtests/rtl/RtlIsValidOemCharacter.c
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to