X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrlen.c;h=14686bbba734bcd08f3a6296748329eafbafc481;hb=d02f38605b53cdff5460cc6b9e1b2a80c3a2ba4c;hp=24101b62f8b6a2fa18565032316d06359d8be4b7;hpb=1216c2da42a1c3f9430ec6b8e11c851febdb2c3f;p=pdclib diff --git a/functions/string/strlen.c b/functions/string/strlen.c index 24101b6..14686bb 100644 --- a/functions/string/strlen.c +++ b/functions/string/strlen.c @@ -10,14 +10,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