X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=functions%2Fstring%2Fmemset.c;h=dc6a518737c0cd368b553452df136b772ee1405a;hb=420908538bd49126b447dd6059af363195c41e1e;hp=2b50b88bd6ebe4df8ba4fa0974b9008959aa3970;hpb=729ee2b6c0a5bae5e298cf5a05d08d1339f1ced3;p=fw%2Fpdclib diff --git a/functions/string/memset.c b/functions/string/memset.c index 2b50b88..dc6a518 100644 --- a/functions/string/memset.c +++ b/functions/string/memset.c @@ -1,7 +1,5 @@ /* $Id$ */ -/* Release $Name$ */ - /* memset( void *, int, size_t ) This file is part of the Public Domain C Library (PDCLib). @@ -10,6 +8,8 @@ #include +#ifndef REGTEST + void * memset( void * s, int c, size_t n ) { unsigned char * p = (unsigned char *) s; @@ -20,4 +20,21 @@ void * memset( void * s, int c, size_t n ) return s; } -#warning Test driver missing. +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + char s[] = "xxxxxxxxx"; + 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