diff options
Diffstat (limited to 'tests/port/test_strcasecmp.c')
-rw-r--r-- | tests/port/test_strcasecmp.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/port/test_strcasecmp.c b/tests/port/test_strcasecmp.c new file mode 100644 index 0000000..e6fb40b --- /dev/null +++ b/tests/port/test_strcasecmp.c @@ -0,0 +1,25 @@ +#include "port/sys.h" + +#undef HAVE_STRCASECMP +#include "port/string.c" /* for strcasecmp */ +#undef strcasecmp + +#include <strings.h> + +#include <stdlib.h> /* for EXIT_SUCCESS, EXIT_FAILURE */ + +int main( void ) { + const char *s1 = "test"; + const char *s2 = "TEST"; + const char *s3 = "tes"; + const char *s4 = "sest"; + const char *s5 = "uest"; + + if( wolf_port_strcasecmp( s1, s1 ) != 0 ) return EXIT_FAILURE; + if( wolf_port_strcasecmp( s1, s2 ) != 0 ) return EXIT_FAILURE; + if( wolf_port_strcasecmp( s1, s3 ) <= 0 ) return EXIT_FAILURE; + if( wolf_port_strcasecmp( s1, s4 ) <= 0 ) return EXIT_FAILURE; + if( wolf_port_strcasecmp( s1, s5 ) >= 0 ) return EXIT_FAILURE; + + return EXIT_SUCCESS; +} |