Author: jgardou
Date: Mon Aug 27 16:34:17 2012
New Revision: 57179
URL:
http://svn.reactos.org/svn/reactos?rev=57179&view=rev
Log:
[KERNEL32_APITESTS]
- Add some tests for lstrncpyW
- This function is fine, I wrote that when chasing some bug thinking this function was at
fault.
Added:
trunk/rostests/apitests/kernel32/lstrcpynW.c (with props)
Modified:
trunk/rostests/apitests/kernel32/CMakeLists.txt
trunk/rostests/apitests/kernel32/testlist.c
Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CMakeLi…
==============================================================================
--- trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] Mon Aug 27 16:34:17 2012
@@ -5,6 +5,7 @@
GetCurrentDirectory.c
GetDriveType.c
GetModuleFileName.c
+ lstrcpynW.c
SetCurrentDirectory.c
testlist.c)
Added: trunk/rostests/apitests/kernel32/lstrcpynW.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/lstrcpy…
==============================================================================
--- trunk/rostests/apitests/kernel32/lstrcpynW.c (added)
+++ trunk/rostests/apitests/kernel32/lstrcpynW.c [iso-8859-1] Mon Aug 27 16:34:17 2012
@@ -1,0 +1,27 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for lstrcpynW
+ */
+
+#define WIN32_NO_STATUS
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+START_TEST(lstrcpynW)
+{
+ WCHAR buffer[256];
+
+ /* Test basic functionality */
+ ok(lstrcpynW(buffer, L"Copy this string", 256) == buffer, "lstrncpyW
failed!\n");
+ ok(!lstrcmpW(buffer, L"Copy this string"), "Copy went
wrong.\n");
+
+ /* Test for buffer too small */
+ ok(lstrcpynW(buffer, L"Copy this string", 10) == buffer, "lstrncpyW
failed!\n");
+ ok(buffer[9] == 0, "lstrncpyW should have NULL-terminated the string");
+ ok(!lstrcmpW(buffer, L"Copy this"), "Copy went wrong.\n");
+
+ /* Test some invalid buffer */
+ ok(lstrcpynW((LPWSTR)0xbaadf00d, L"Copy this string", 256) == NULL,
"lstrncpyW should have returned NULL.\n");
+}
Propchange: trunk/rostests/apitests/kernel32/lstrcpynW.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/kernel32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/testlis…
==============================================================================
--- trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] Mon Aug 27 16:34:17 2012
@@ -8,6 +8,7 @@
extern void func_GetCurrentDirectory(void);
extern void func_GetDriveType(void);
extern void func_GetModuleFileName(void);
+extern void func_lstrcpynW(void);
extern void func_SetCurrentDirectory(void);
const struct test winetest_testlist[] =
@@ -15,6 +16,7 @@
{ "GetCurrentDirectory", func_GetCurrentDirectory },
{ "GetDriveType", func_GetDriveType },
{ "GetModuleFileName", func_GetModuleFileName },
+ { "lstrcpynW", func_lstrcpynW },
{ "SetCurrentDirectory", func_SetCurrentDirectory },
{ 0, 0 }