X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrlen.c;h=c9ac46568e17a30d15ab84efded6320f36459a4f;hb=cd6cfe0f578c4f744ddc9a342243aff6b42f8027;hp=24101b62f8b6a2fa18565032316d06359d8be4b7;hpb=ed0101ff5bc5dda85d13eeed5217959bfe87e71c;p=pdclib.old diff --git a/functions/string/strlen.c b/functions/string/strlen.c index 24101b6..c9ac465 100644 --- a/functions/string/strlen.c +++ b/functions/string/strlen.c @@ -1,7 +1,5 @@ /* $Id$ */ -/* Release $Name$ */ - /* strlen( const char * ) This file is part of the Public Domain C Library (PDCLib). @@ -10,14 +8,27 @@ #include +#ifndef REGTEST + size_t strlen( const char * s ) { size_t rc = 0; - while ( src[rc] ) + while ( s[rc] ) { ++rc; } return rc; } -#warning Test driver missing. +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE( strlen( abcde ) == 5 ); + TESTCASE( strlen( "" ) == 0 ); + return TEST_RESULTS; +} +#endif