From: solar Date: Sun, 20 Nov 2005 13:19:09 +0000 (+0000) Subject: Added dummy test drivers to each *.c file, and target 'test' to Makefile. X-Git-Tag: v0.3~10 X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=ba5eff8dd9b426485e1559b5d6204692d155d9e8 Added dummy test drivers to each *.c file, and target 'test' to Makefile. --- diff --git a/Makefile b/Makefile index 9358097..71f2c1e 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ AUXFILES := Makefile Readme.txt SRCFILES := $(shell find . -name "*.c" -mindepth 1 -maxdepth 3) HDRFILES := $(shell find . -name "*.h" -mindepth 1 -maxdepth 3) OBJFILES := $(patsubst %.c,%.o,$(SRCFILES)) +TSTFILES := $(patsubst %.c,%.t,$(SRCFILES)) DEPFILES := $(patsubst %.c,%.d,$(SRCFILES)) ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES) @@ -15,6 +16,9 @@ CFLAGS := -g -std=c99 -I./internals/ all: $(OBJFILES) ar r pdclib.a $(OBJFILES) +test: $(TSTFILES) + -@rc=0; for file in $(TSTFILES); do ./$$file; rc=`expr $$rc + $$?`; done; echo; echo "Tests failed: $$rc" + -include $(DEPFILES) clean: @@ -24,5 +28,8 @@ dist: @tar czf pdclib.tgz $(ALLFILES) %.o: %.c Makefile - $(CC) $(MODE) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ + $(CC) -DNDEBUG -c $(CPPFLAGS) $(CFLAGS) $< -o $@ + +%.t: %.c Makefile + $(CC) -DTEST $(CFLAGS) $< -o $@ diff --git a/functions/assert.c b/functions/assert.c index 31c4386..e0971a1 100644 --- a/functions/assert.c +++ b/functions/assert.c @@ -25,3 +25,10 @@ void _PDCLIB_assert( char const * const message ) } #endif + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/memchr.c b/functions/string/memchr.c index 9aef229..1e8ff70 100644 --- a/functions/string/memchr.c +++ b/functions/string/memchr.c @@ -25,3 +25,10 @@ void * memchr( const void * s, int c, size_t n ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/memcmp.c b/functions/string/memcmp.c index 8a4a070..ec58666 100644 --- a/functions/string/memcmp.c +++ b/functions/string/memcmp.c @@ -27,3 +27,10 @@ int memcmp( const void * s1, const void * s2, size_t n ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/memcpy.c b/functions/string/memcpy.c index a5842d3..e921dd9 100644 --- a/functions/string/memcpy.c +++ b/functions/string/memcpy.c @@ -23,3 +23,10 @@ void * memcpy( void * _PDCLIB_restrict s1, const void * _PDCLIB_restrict s2, siz } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/memmove.c b/functions/string/memmove.c index 4ba2ba4..38db9d9 100644 --- a/functions/string/memmove.c +++ b/functions/string/memmove.c @@ -34,3 +34,10 @@ void * memmove( void * s1, const void * s2, size_t n ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/memset.c b/functions/string/memset.c index 2b50b88..9318c85 100644 --- a/functions/string/memset.c +++ b/functions/string/memset.c @@ -21,3 +21,10 @@ void * memset( void * s, int c, size_t n ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strcat.c b/functions/string/strcat.c index f6a7d15..a4eab14 100644 --- a/functions/string/strcat.c +++ b/functions/string/strcat.c @@ -22,3 +22,10 @@ char * strcat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strchr.c b/functions/string/strchr.c index a575f6d..ec296cb 100644 --- a/functions/string/strchr.c +++ b/functions/string/strchr.c @@ -23,3 +23,10 @@ char * strchr( const char * s, int c ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strcmp.c b/functions/string/strcmp.c index 6dbb142..f6a555b 100644 --- a/functions/string/strcmp.c +++ b/functions/string/strcmp.c @@ -19,3 +19,10 @@ int strcmp( const char * s1, const char * s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strcoll.c b/functions/string/strcoll.c index 3693e48..6f8a0dc 100644 --- a/functions/string/strcoll.c +++ b/functions/string/strcoll.c @@ -18,3 +18,10 @@ int strcoll( const char * s1, const char * s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strcpy.c b/functions/string/strcpy.c index cec5c25..4f02875 100644 --- a/functions/string/strcpy.c +++ b/functions/string/strcpy.c @@ -18,3 +18,10 @@ char * strcpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strcspn.c b/functions/string/strcspn.c index c576979..308fe36 100644 --- a/functions/string/strcspn.c +++ b/functions/string/strcspn.c @@ -30,3 +30,10 @@ size_t strcspn( const char * s1, const char * s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strlen.c b/functions/string/strlen.c index c862805..da5bc40 100644 --- a/functions/string/strlen.c +++ b/functions/string/strlen.c @@ -21,3 +21,10 @@ size_t strlen( const char * s ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strncat.c b/functions/string/strncat.c index 44dcb40..d9f9fe3 100644 --- a/functions/string/strncat.c +++ b/functions/string/strncat.c @@ -30,3 +30,10 @@ char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strncmp.c b/functions/string/strncmp.c index 624cdbc..7f398fa 100644 --- a/functions/string/strncmp.c +++ b/functions/string/strncmp.c @@ -29,3 +29,10 @@ int strncmp( const char * s1, const char * s2, size_t n ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strncpy.c b/functions/string/strncpy.c index ed5965d..b47be75 100644 --- a/functions/string/strncpy.c +++ b/functions/string/strncpy.c @@ -29,3 +29,10 @@ char * strncpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strpbrk.c b/functions/string/strpbrk.c index fb584e2..bc40263 100644 --- a/functions/string/strpbrk.c +++ b/functions/string/strpbrk.c @@ -30,3 +30,10 @@ char * strpbrk( const char * s1, const char * s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strrchr.c b/functions/string/strrchr.c index 77b633f..4fe9a6b 100644 --- a/functions/string/strrchr.c +++ b/functions/string/strrchr.c @@ -25,3 +25,10 @@ char * strrchr( const char * s, int c ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strspn.c b/functions/string/strspn.c index db527e0..b8e703d 100644 --- a/functions/string/strspn.c +++ b/functions/string/strspn.c @@ -35,3 +35,10 @@ size_t strspn( const char * s1, const char * s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strstr.c b/functions/string/strstr.c index 4587c68..0566d5d 100644 --- a/functions/string/strstr.c +++ b/functions/string/strstr.c @@ -33,3 +33,10 @@ char * strstr( const char * s1, const char * s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strtok.c b/functions/string/strtok.c index 3135920..9daf329 100644 --- a/functions/string/strtok.c +++ b/functions/string/strtok.c @@ -74,3 +74,10 @@ char * strtok( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif diff --git a/functions/string/strxfrm.c b/functions/string/strxfrm.c index 5849a0c..af98c18 100644 --- a/functions/string/strxfrm.c +++ b/functions/string/strxfrm.c @@ -27,3 +27,10 @@ size_t strxfrm( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si } #warning Test driver missing. + +#ifdef TEST +int main() +{ + return 0; +} +#endif