]> pd.if.org Git - pdclib/blob - functions/wchar/wmemcpy.c
dos2unix
[pdclib] / functions / wchar / wmemcpy.c
1 /* wmemcpy( wchar_t *, const wchar_t *, size_t )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <wchar.h>
8
9 #ifndef REGTEST
10
11 wchar_t * wmemcpy( wchar_t * _PDCLIB_restrict dest, 
12                    const wchar_t * _PDCLIB_restrict src, 
13                    size_t n )
14 {
15     wchar_t* rv = dest;
16     while ( n-- )
17     {
18         *dest++ = *src++;
19     }
20     return rv;
21 }
22
23 #endif
24
25 #ifdef TEST
26 #include "_PDCLIB_test.h"
27
28 int main( void )
29 {
30     wchar_t s[] = L"xxxxxxxxxxx";
31     TESTCASE( wmemcpy( s, wabcde, 6 ) == s );
32     TESTCASE( s[4] == L'e' );
33     TESTCASE( s[5] == L'\0' );
34     TESTCASE( wmemcpy( s + 5, wabcde, 5 ) == s + 5 );
35     TESTCASE( s[9] == L'e' );
36     TESTCASE( s[10] == L'x' );
37     return TEST_RESULTS;
38 }
39 #endif