3 /* wcsncmp( const wchar_t *, const wchar_t *, size_t )
\r
5 This file is part of the Public Domain C Library (PDCLib).
\r
6 Permission is granted to use, modify, and / or redistribute at will.
\r
13 int wcsncmp( const wchar_t * s1, const wchar_t * s2, size_t n )
\r
15 while ( *s1 && n && ( *s1 == *s2 ) )
\r
27 return ( *(wchar_t *)s1 - *(wchar_t *)s2 );
\r
34 #include <_PDCLIB_test.h>
\r
38 wchar_t cmpabcde[] = L"abcde\0f";
\r
39 wchar_t cmpabcd_[] = L"abcde\xfc";
\r
40 wchar_t empty[] = L"";
\r
42 TESTCASE( wcsncmp( wabcde, cmpabcde, 5 ) == 0 );
\r
43 TESTCASE( wcsncmp( wabcde, cmpabcde, 10 ) == 0 );
\r
44 TESTCASE( wcsncmp( wabcde, wabcdx, 5 ) < 0 );
\r
45 TESTCASE( wcsncmp( wabcdx, wabcde, 5 ) > 0 );
\r
46 TESTCASE( wcsncmp( empty, wabcde, 5 ) < 0 );
\r
47 TESTCASE( wcsncmp( wabcde, empty, 5 ) > 0 );
\r
48 TESTCASE( wcsncmp( wabcde, wabcdx, 4 ) == 0 );
\r
49 TESTCASE( wcsncmp( wabcde, x, 0 ) == 0 );
\r
50 TESTCASE( wcsncmp( wabcde, x, 1 ) < 0 );
\r
51 TESTCASE( wcsncmp( wabcde, cmpabcd_, 10 ) < 0 );
\r
52 return TEST_RESULTS;
\r