7bdd6efbc3937dcfc021a2b550830ca99184e0b2
[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 #define WIN32_NO_STATUS
8 #include <stdio.h>
9 #include <wine/test.h>
10
11 START_TEST(lstrcpynW)
12 {
13 WCHAR buffer[256];
14
15 /* Test basic functionality */
16 ok(lstrcpynW(buffer, L"Copy this string", 256) == buffer, "lstrncpyW failed!\n");
17 ok(!lstrcmpW(buffer, L"Copy this string"), "Copy went wrong.\n");
18
19 /* Test for buffer too small */
20 ok(lstrcpynW(buffer, L"Copy this string", 10) == buffer, "lstrncpyW failed!\n");
21 ok(buffer[9] == 0, "lstrncpyW should have NULL-terminated the string");
22 ok(!lstrcmpW(buffer, L"Copy this"), "Copy went wrong.\n");
23
24 /* Test some invalid buffer */
25 ok(lstrcpynW((LPWSTR)0xbaadf00d, L"Copy this string", 256) == NULL, "lstrncpyW should have returned NULL.\n");
26 }