1 /* strcmp( const char *, const char * )
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 int strcmp( const char * s1, const char * s2 )
13 while ( ( *s1 ) && ( *s1 == *s2 ) )
18 return ( *(unsigned char *)s1 - *(unsigned char *)s2 );
25 #include "_PDCLIB_test.h"
29 char cmpabcde[] = "abcde";
30 char cmpabcd_[] = "abcd\xfc";
32 TESTCASE( strcmp( abcde, cmpabcde ) == 0 );
33 TESTCASE( strcmp( abcde, abcdx ) < 0 );
34 TESTCASE( strcmp( abcdx, abcde ) > 0 );
35 TESTCASE( strcmp( empty, abcde ) < 0 );
36 TESTCASE( strcmp( abcde, empty ) > 0 );
37 TESTCASE( strcmp( abcde, cmpabcd_ ) < 0 );