1 /* wcsstr( const wchar_t *, const wchar_t * )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
11 wchar_t * wcsstr( const wchar_t * s1, const wchar_t * s2 )
13 const wchar_t * p1 = s1;
18 while ( *p2 && ( *p1 == *p2 ) )
25 return (wchar_t *) s1;
36 #include "_PDCLIB_test.h"
40 wchar_t s[] = L"abcabcabcdabcde";
41 TESTCASE( wcsstr( s, L"x" ) == NULL );
42 TESTCASE( wcsstr( s, L"xyz" ) == NULL );
43 TESTCASE( wcsstr( s, L"a" ) == &s[0] );
44 TESTCASE( wcsstr( s, L"abc" ) == &s[0] );
45 TESTCASE( wcsstr( s, L"abcd" ) == &s[6] );
46 TESTCASE( wcsstr( s, L"abcde" ) == &s[10] );