X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fmemset.c;h=753a33320fc4db576d23c9fd12a4724989b4c2d6;hb=2f57d79a5a24856fdea69b2119d67e5fb5029b3e;hp=9318c85d57834296687f6fb2b87868fcf5a72515;hpb=ba5eff8dd9b426485e1559b5d6204692d155d9e8;p=pdclib diff --git a/functions/string/memset.c b/functions/string/memset.c index 9318c85..753a333 100644 --- a/functions/string/memset.c +++ b/functions/string/memset.c @@ -20,11 +20,20 @@ void * memset( void * s, int c, size_t n ) return s; } -#warning Test driver missing. - #ifdef TEST +#include <_PDCLIB_test.h> + int main() { - return 0; + char s[] = "xxxxxxxxx"; + BEGIN_TESTS; + TESTCASE( memset( s, 'o', 10 ) == s ); + TESTCASE( s[9] == 'o' ); + TESTCASE( memset( s, '_', 0 ) == s ); + TESTCASE( s[0] == 'o' ); + TESTCASE( memset( s, '_', 1 ) == s ); + TESTCASE( s[0] == '_' ); + TESTCASE( s[1] == 'o' ); + return TEST_RESULTS; } #endif