X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fwchar%2Fwcscmp.c;h=b338b5d30b2ba3fe05b2345c2bde945426055672;hp=8a3d22782312a77d75bf6312377738c5322bb944;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hpb=8894c921674bb116d0a7b8f23a55311e7a768019 diff --git a/functions/wchar/wcscmp.c b/functions/wchar/wcscmp.c index 8a3d227..b338b5d 100644 --- a/functions/wchar/wcscmp.c +++ b/functions/wchar/wcscmp.c @@ -1,39 +1,39 @@ -/* wcscmp( const wchar_t *, const wchar_t * ) - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#include - -#ifndef REGTEST - -int wcscmp( const wchar_t * s1, const wchar_t * s2 ) -{ - while ( ( *s1 ) && ( *s1 == *s2 ) ) - { - ++s1; - ++s2; - } - return ( *(wchar_t *)s1 - *(wchar_t *)s2 ); -} - -#endif - -#ifdef TEST -#include "_PDCLIB_test.h" - -int main( void ) -{ - wchar_t cmpabcde[] = L"abcde"; - wchar_t cmpabcd_[] = L"abcd\xfc"; - wchar_t empty[] = L""; - TESTCASE( wcscmp( wabcde, cmpabcde ) == 0 ); - TESTCASE( wcscmp( wabcde, wabcdx ) < 0 ); - TESTCASE( wcscmp( wabcdx, wabcde ) > 0 ); - TESTCASE( wcscmp( empty, wabcde ) < 0 ); - TESTCASE( wcscmp( wabcde, empty ) > 0 ); - TESTCASE( wcscmp( wabcde, cmpabcd_ ) < 0 ); - return TEST_RESULTS; -} -#endif +/* wcscmp( const wchar_t *, const wchar_t * ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST + +int wcscmp( const wchar_t * s1, const wchar_t * s2 ) +{ + while ( ( *s1 ) && ( *s1 == *s2 ) ) + { + ++s1; + ++s2; + } + return ( *(wchar_t *)s1 - *(wchar_t *)s2 ); +} + +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + wchar_t cmpabcde[] = L"abcde"; + wchar_t cmpabcd_[] = L"abcd\xfc"; + wchar_t empty[] = L""; + TESTCASE( wcscmp( wabcde, cmpabcde ) == 0 ); + TESTCASE( wcscmp( wabcde, wabcdx ) < 0 ); + TESTCASE( wcscmp( wabcdx, wabcde ) > 0 ); + TESTCASE( wcscmp( empty, wabcde ) < 0 ); + TESTCASE( wcscmp( wabcde, empty ) > 0 ); + TESTCASE( wcscmp( wabcde, cmpabcd_ ) < 0 ); + return TEST_RESULTS; +} +#endif