[KERNEL32_APITESTS]

- Add some tests for lstrncpyW
- This function is fine, I wrote that when chasing some bug thinking this function was at fault.

svn path=/trunk/; revision=57179
This commit is contained in:
Jérôme Gardou 2012-08-27 16:34:17 +00:00
parent c49946e714
commit fdcdcb6339
3 changed files with 30 additions and 0 deletions

View file

@ -5,6 +5,7 @@ list(APPEND SOURCE
GetCurrentDirectory.c
GetDriveType.c
GetModuleFileName.c
lstrcpynW.c
SetCurrentDirectory.c
testlist.c)

View file

@ -0,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");
}

View file

@ -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 @@ const struct test winetest_testlist[] =
{ "GetCurrentDirectory", func_GetCurrentDirectory },
{ "GetDriveType", func_GetDriveType },
{ "GetModuleFileName", func_GetModuleFileName },
{ "lstrcpynW", func_lstrcpynW },
{ "SetCurrentDirectory", func_SetCurrentDirectory },
{ 0, 0 }