]> pd.if.org Git - pdclib/blobdiff - functions/string/strrchr.c
Comment cleanups.
[pdclib] / functions / string / strrchr.c
index 4fe9a6b49acd8c00597b5da7bbd567985880883e..7387f22f0e1953687154e312e030d0c80a9f8a82 100644 (file)
@@ -1,8 +1,4 @@
-/* $Id$ */
-
-/* Release $Name$ */
-
-/* strrchr( const char *, int c )
+/* strrchr( const char *, int )
 
    This file is part of the Public Domain C Library (PDCLib).
    Permission is granted to use, modify, and / or redistribute at will.
@@ -10,6 +6,8 @@
 
 #include <string.h>
 
+#ifndef REGTEST
+
 char * strrchr( const char * s, int c )
 {
     size_t i = 0;
@@ -24,11 +22,18 @@ char * strrchr( const char * s, int c )
     return NULL;
 }
 
-#warning Test driver missing.
+#endif
 
 #ifdef TEST
-int main()
+#include <_PDCLIB_test.h>
+
+int main( void )
 {
-    return 0;
+    char abccd[] = "abccd";
+    TESTCASE( strrchr( abcde, '\0' ) == &abcde[5] );
+    TESTCASE( strrchr( abcde, 'e' ) == &abcde[4] );
+    TESTCASE( strrchr( abcde, 'a' ) == &abcde[0] );
+    TESTCASE( strrchr( abccd, 'c' ) == &abccd[3] );
+    return TEST_RESULTS;
 }
 #endif