[KERNEL32_APITEST]
[reactos.git] / rostests / apitests / kernel32 / lstrcpynW.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for lstrcpynW
5 */
6
7 #include <apitest.h>
8
9 #define WIN32_NO_STATUS
10 #include <stdio.h>
11
12 START_TEST(lstrcpynW)
13 {
14 WCHAR buffer[256];
15
16 /* Test basic functionality */
17 ok(lstrcpynW(buffer, L"Copy this string", 256) == buffer, "lstrncpyW failed!\n");
18 ok(!lstrcmpW(buffer, L"Copy this string"), "Copy went wrong.\n");
19
20 /* Test for buffer too small */
21 ok(lstrcpynW(buffer, L"Copy this string", 10) == buffer, "lstrncpyW failed!\n");
22 ok(buffer[9] == 0, "lstrncpyW should have NULL-terminated the string");
23 ok(!lstrcmpW(buffer, L"Copy this"), "Copy went wrong.\n");
24
25 /* Test some invalid buffer */
26 ok(lstrcpynW((LPWSTR)0xbaadf00d, L"Copy this string", 256) == NULL, "lstrncpyW should have returned NULL.\n");
27 }