Author: hbelusca
Date: Sun Aug 7 16:35:56 2016
New Revision: 72148
URL:
http://svn.reactos.org/svn/reactos?rev=72148&view=rev
Log:
[APITESTS]: Add a test for advapi32!IsTextUnicode.
CORE-11803
Added:
trunk/rostests/apitests/advapi32/IsTextUnicode.c (with props)
Modified:
trunk/rostests/apitests/advapi32/CMakeLists.txt
trunk/rostests/apitests/advapi32/testlist.c
Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CMakeLi…
==============================================================================
--- trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] Sun Aug 7 16:35:56 2016
@@ -3,6 +3,7 @@
CreateService.c
DuplicateTokenEx.c
HKEY_CLASSES_ROOT.c
+ IsTextUnicode.c
LockDatabase.c
QueryServiceConfig2.c
RegEnumValueW.c
Added: trunk/rostests/apitests/advapi32/IsTextUnicode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/IsTextU…
==============================================================================
--- trunk/rostests/apitests/advapi32/IsTextUnicode.c (added)
+++ trunk/rostests/apitests/advapi32/IsTextUnicode.c [iso-8859-1] Sun Aug 7 16:35:56
2016
@@ -0,0 +1,96 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Tests for (Rtl)IsTextUnicode.
+ * PROGRAMMER: Hermes Belusca-Maito
+ */
+
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <winbase.h>
+
+START_TEST(IsTextUnicode)
+{
+#define INVALID_FLAG 0xFFFFFFFF
+
+#define NEW_TEST(Buffer, Flags, ResultFlags, Success) \
+ { (PVOID)(Buffer), sizeof((Buffer)), (Flags), (ResultFlags), (Success) }
+
+ static struct
+ {
+ /* Input */
+ PVOID Buffer;
+ INT Size;
+ INT Flags;
+
+ /* Output */
+ INT ResultFlags;
+ BOOL Success;
+ } Tests[] =
+ {
+ /* ANSI string */
+
+ // 0
+ NEW_TEST("ANSI string", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
+ NEW_TEST("ANSI string", IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
+ NEW_TEST("ANSI string", INVALID_FLAG, 0, FALSE),
+
+ /* UNICODE strings */
+
+ // 3
+ NEW_TEST(L"a", IS_TEXT_UNICODE_ASCII16, IS_TEXT_UNICODE_ASCII16,
TRUE),
+ NEW_TEST(L"a", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_STATISTICS
| IS_TEXT_UNICODE_ASCII16, TRUE),
+ NEW_TEST(L"a", IS_TEXT_UNICODE_STATISTICS, IS_TEXT_UNICODE_STATISTICS,
TRUE),
+ NEW_TEST(L"a", INVALID_FLAG, 0, TRUE),
+
+ // 7
+ NEW_TEST(L"UNICODE String 0", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
+ NEW_TEST(L"UNICODE String 0", IS_TEXT_UNICODE_UNICODE_MASK,
IS_TEXT_UNICODE_CONTROLS | IS_TEXT_UNICODE_STATISTICS, TRUE),
+ NEW_TEST(L"UNICODE String 0", IS_TEXT_UNICODE_STATISTICS,
IS_TEXT_UNICODE_STATISTICS, TRUE),
+ NEW_TEST(L"UNICODE String 0", INVALID_FLAG, 0, TRUE),
+
+ // 11
+ NEW_TEST(L"\xFEFF" L"UNICODE String 1",
IS_TEXT_UNICODE_ASCII16, 0, FALSE),
+ NEW_TEST(L"\xFEFF" L"UNICODE String 1",
IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_SIGNATURE | IS_TEXT_UNICODE_CONTROLS,
TRUE),
+ NEW_TEST(L"\xFEFF" L"UNICODE String 1",
IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
+ NEW_TEST(L"\xFEFF" L"UNICODE String 1", INVALID_FLAG, 0,
TRUE),
+
+ // 15
+ NEW_TEST(L"\xFFFE" L"UNICODE String 2",
IS_TEXT_UNICODE_ASCII16, 0, FALSE),
+ NEW_TEST(L"\xFFFE" L"UNICODE String 2",
IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_CONTROLS, TRUE),
+ NEW_TEST(L"\xFFFE" L"UNICODE String 2",
IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
+ NEW_TEST(L"\xFFFE" L"UNICODE String 2", INVALID_FLAG, 0,
FALSE),
+
+ // 19
+ NEW_TEST(L"UNICODE String 3 ÐÑивеÑ!", IS_TEXT_UNICODE_ASCII16, 0,
FALSE),
+ NEW_TEST(L"UNICODE String 3 ÐÑивеÑ!",
IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_CONTROLS | IS_TEXT_UNICODE_STATISTICS,
TRUE),
+ NEW_TEST(L"UNICODE String 3 ÐÑивеÑ!", IS_TEXT_UNICODE_STATISTICS,
IS_TEXT_UNICODE_STATISTICS, TRUE),
+ NEW_TEST(L"UNICODE String 3 ÐÑивеÑ!", INVALID_FLAG, 0, TRUE),
+
+ // 23
+ NEW_TEST(L"\xFEFF" L"UNICODE String 4 ÐÑивеÑ!",
IS_TEXT_UNICODE_ASCII16, 0, FALSE),
+ NEW_TEST(L"\xFEFF" L"UNICODE String 4 ÐÑивеÑ!",
IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_SIGNATURE | IS_TEXT_UNICODE_CONTROLS,
TRUE),
+ NEW_TEST(L"\xFEFF" L"UNICODE String 4 ÐÑивеÑ!",
IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
+ NEW_TEST(L"\xFEFF" L"UNICODE String 4 ÐÑивеÑ!",
INVALID_FLAG, 0, TRUE),
+
+ // 27
+ NEW_TEST(L"\xFFFE" L"UNICODE String 5 ÐÑивеÑ!",
IS_TEXT_UNICODE_ASCII16, 0, FALSE),
+ NEW_TEST(L"\xFFFE" L"UNICODE String 5 ÐÑивеÑ!",
IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_CONTROLS, TRUE),
+ NEW_TEST(L"\xFFFE" L"UNICODE String 5 ÐÑивеÑ!",
IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
+ NEW_TEST(L"\xFFFE" L"UNICODE String 5 ÐÑивеÑ!",
INVALID_FLAG, 0, FALSE),
+ };
+
+ UINT i;
+ BOOL Success;
+ INT Result;
+
+ for (i = 0; i < ARRAYSIZE(Tests); ++i)
+ {
+ Result = Tests[i].Flags;
+ Success = IsTextUnicode(Tests[i].Buffer, Tests[i].Size, ((Result != INVALID_FLAG)
? &Result : NULL));
+ ok(Success == Tests[i].Success, "IsTextUnicode(%u) returned 0x%x, expected
%s\n", i, Success, (Tests[i].Success ? "TRUE" : "FALSE"));
+ if (Result != INVALID_FLAG)
+ ok(Result == Tests[i].ResultFlags, "IsTextUnicode(%u) Result returned
0x%x, expected 0x%x\n", i, Result, Tests[i].ResultFlags);
+ }
+}
Propchange: trunk/rostests/apitests/advapi32/IsTextUnicode.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/advapi32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/testlis…
==============================================================================
--- trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] Sun Aug 7 16:35:56 2016
@@ -6,6 +6,7 @@
extern void func_CreateService(void);
extern void func_DuplicateTokenEx(void);
extern void func_HKEY_CLASSES_ROOT(void);
+extern void func_IsTextUnicode(void);
extern void func_LockDatabase(void);
extern void func_QueryServiceConfig2(void);
extern void func_RegEnumValueW(void);
@@ -18,6 +19,7 @@
{ "CreateService", func_CreateService },
{ "DuplicateTokenEx", func_DuplicateTokenEx },
{ "HKEY_CLASSES_ROOT", func_HKEY_CLASSES_ROOT },
+ { "IsTextUnicode" , func_IsTextUnicode },
{ "LockDatabase" , func_LockDatabase },
{ "QueryServiceConfig2", func_QueryServiceConfig2 },
{ "RegEnumValueW", func_RegEnumValueW },