]> pd.if.org Git - pdclib/commitdiff
Added dummy test drivers to each *.c file, and target 'test' to Makefile.
authorsolar <unknown>
Sun, 20 Nov 2005 13:19:09 +0000 (13:19 +0000)
committersolar <unknown>
Sun, 20 Nov 2005 13:19:09 +0000 (13:19 +0000)
23 files changed:
Makefile
functions/assert.c
functions/string/memchr.c
functions/string/memcmp.c
functions/string/memcpy.c
functions/string/memmove.c
functions/string/memset.c
functions/string/strcat.c
functions/string/strchr.c
functions/string/strcmp.c
functions/string/strcoll.c
functions/string/strcpy.c
functions/string/strcspn.c
functions/string/strlen.c
functions/string/strncat.c
functions/string/strncmp.c
functions/string/strncpy.c
functions/string/strpbrk.c
functions/string/strrchr.c
functions/string/strspn.c
functions/string/strstr.c
functions/string/strtok.c
functions/string/strxfrm.c

index 935809707a79a64c34569a3e5e41c45a17a58795..71f2c1e761ad9855c7c26e70daf41ea56d8304b3 100644 (file)
--- 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 $@
 
index 31c43866e56bb5765df0bdf54da7f69372d217ba..e0971a18a6db03220506d300d5c664068043727b 100644 (file)
@@ -25,3 +25,10 @@ void _PDCLIB_assert( char const * const message )
 }
 #endif
 
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index 9aef229e69f040f5b74b150c3987f633ba692a13..1e8ff7073c46c911dc408257a402a2190644e7b6 100644 (file)
@@ -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
index 8a4a070e0127d25d94ef41f3d58e607487a2639e..ec58666f79e45ddaa47586665b0521cd5e8b3edc 100644 (file)
@@ -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
index a5842d33dcb981b4bb2772c457009a443f5ec423..e921dd9ec04cd3962541b9723b0815ad0d6e3878 100644 (file)
@@ -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
index 4ba2ba4cf2feafbc30fd0e9c5eb060f85653c02b..38db9d94a2e4d3dad1af059c2b7edeab4aa55d1f 100644 (file)
@@ -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
index 2b50b88bd6ebe4df8ba4fa0974b9008959aa3970..9318c85d57834296687f6fb2b87868fcf5a72515 100644 (file)
@@ -21,3 +21,10 @@ void * memset( void * s, int c, size_t n )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index f6a7d15f2246c456ef534a4d7850f3a8e62fd534..a4eab143b3352907df5f21e6877d9b1dcc083dee 100644 (file)
@@ -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
index a575f6deea1b15e44b65ef94826a1f1ddc607b29..ec296cbce33cab48ae8b9aeaa6fed4500710c83b 100644 (file)
@@ -23,3 +23,10 @@ char * strchr( const char * s, int c )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index 6dbb142df93beb3cf63da79c164a03325ead7d4b..f6a555b56de7d0076c425a472466e393bec43685 100644 (file)
@@ -19,3 +19,10 @@ int strcmp( const char * s1, const char * s2 )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index 3693e48071f975ebd4b631556c7172d0d416e327..6f8a0dc87ffbc0f83853fc5e0066097dfd35dd09 100644 (file)
@@ -18,3 +18,10 @@ int strcoll( const char * s1, const char * s2 )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index cec5c25192b215462aec0b0d762d4994476b7415..4f028759bf8cd0dddb560788f51c3433672da704 100644 (file)
@@ -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
index c57697960453b8144c81faf78145ed654cb3da41..308fe362fcfdf47f59233348a64140a12010e00d 100644 (file)
@@ -30,3 +30,10 @@ size_t strcspn( const char * s1, const char * s2 )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index c862805ed74840f0e5b906e3cf2008beb1beef43..da5bc4093af805dddfdcf274f12cc19f6704f6e5 100644 (file)
@@ -21,3 +21,10 @@ size_t strlen( const char * s )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index 44dcb402614b0e7ff397f7a20b9f3922e075d340..d9f9fe350031d0d8f768b80024e30cf188c8cb45 100644 (file)
@@ -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
index 624cdbcb190d6013a727dc56bed29b3cb023e143..7f398fa9b2b9be4bce4763afabf4bf737e4bf2d2 100644 (file)
@@ -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
index ed5965d148ddbd5236288cbc521d39423911db0c..b47be758b056c5ff5bcf0e0f8c67f0cc4bdbbbbc 100644 (file)
@@ -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
index fb584e23d64240e6269f2582c64f81016325a924..bc402636516ea47b90fe5aaad622787a5db30a16 100644 (file)
@@ -30,3 +30,10 @@ char * strpbrk( const char * s1, const char * s2 )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index 77b633fffc6968ac6e8286d1c1f5aa8fd684a377..4fe9a6b49acd8c00597b5da7bbd567985880883e 100644 (file)
@@ -25,3 +25,10 @@ char * strrchr( const char * s, int c )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index db527e0198aca7bd9f2d40159883061fdab74135..b8e703d1f09411a7e4d82678009cdfd3f5417e28 100644 (file)
@@ -35,3 +35,10 @@ size_t strspn( const char * s1, const char * s2 )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index 4587c68c6e2d5f107b5eeedfc506763d42a6cb09..0566d5d71c2d8b15c9cd29dea665bcd8f74c0a50 100644 (file)
@@ -33,3 +33,10 @@ char * strstr( const char * s1, const char * s2 )
 }
 
 #warning Test driver missing.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif
index 31359208d1d4b9342d99fe6452742d6043fd135d..9daf329351115309ddcc83822dac52d83176c0a0 100644 (file)
@@ -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
index 5849a0cb80ea52a44883c0ed1d7837125f97340a..af98c184071c2c8eadbef99151f94f6eacbafc8f 100644 (file)
@@ -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