]> pd.if.org Git - pdclib/blob - functions/string/strlen.c
Added test drivers.
[pdclib] / functions / string / strlen.c
1 /* $Id$ */
2
3 /* Release $Name$ */
4
5 /* strlen( const char * )
6
7    This file is part of the Public Domain C Library (PDCLib).
8    Permission is granted to use, modify, and / or redistribute at will.
9 */
10
11 #include <string.h>
12
13 size_t strlen( const char * s )
14 {
15     size_t rc = 0;
16     while ( s[rc] )
17     {
18         ++rc;
19     }
20     return rc;
21 }
22
23 #ifdef TEST
24 #include <_PDCLIB_test.h>
25
26 int main()
27 {
28     BEGIN_TESTS;
29     TESTCASE( strlen( abcde ) == 5 );
30     TESTCASE( strlen( "" ) == 0 );
31     return TEST_RESULTS;
32 }
33 #endif