diff options
author | Mattias Andrée <maandree@kth.se> | 2018-08-28 10:41:36 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-08-28 10:41:36 +0200 |
commit | 60513cb5508a8197f5219dc3d06c0331c99863a6 (patch) | |
tree | 210f152018f18646c1f0cbca21602875562366bb | |
parent | Fix vputenvf (diff) | |
download | libsimple-60513cb5508a8197f5219dc3d06c0331c99863a6.tar.gz libsimple-60513cb5508a8197f5219dc3d06c0331c99863a6.tar.bz2 libsimple-60513cb5508a8197f5219dc3d06c0331c99863a6.tar.xz |
Add test function to all .c files
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 38 | ||||
-rw-r--r-- | allocn.c | 13 | ||||
-rw-r--r-- | encalloc.c | 13 | ||||
-rw-r--r-- | enmalloc.c | 13 | ||||
-rw-r--r-- | enmemdup.c | 13 | ||||
-rw-r--r-- | enrealloc.c | 13 | ||||
-rw-r--r-- | enstrdup.c | 13 | ||||
-rw-r--r-- | enstrndup.c | 13 | ||||
-rw-r--r-- | envmalloczn.c | 13 | ||||
-rw-r--r-- | envputenvf.c | 13 | ||||
-rw-r--r-- | envreallocn.c | 13 | ||||
-rw-r--r-- | recvfd.c | 13 | ||||
-rw-r--r-- | recvfrom_timestamped.c | 13 | ||||
-rw-r--r-- | sendfd.c | 13 | ||||
-rw-r--r-- | strtotimespec.c | 13 | ||||
-rw-r--r-- | strtotimeval.c | 13 | ||||
-rw-r--r-- | vweprintf.c | 13 |
17 files changed, 209 insertions, 37 deletions
@@ -59,43 +59,7 @@ OBJ =\ vweprintf.o\ libsimple.o -TESTS =\ - asprintf.test\ - difftimespec.test\ - difftimeval.test\ - doubletotimespec.test\ - doubletotimeval.test\ - isutf8.test\ - memdup.test\ - memends.test\ - memmem.test\ - memrchr.test\ - memrmem.test\ - memstarts.test\ - minimise_number_string.test\ - multimespec.test\ - multimeval.test\ - rawmemchr.test\ - rawmemrchr.test\ - strcaseends.test\ - strcasestr.test\ - strends.test\ - strncasestr.test\ - strndup.test\ - strnstr.test\ - strrcasestr.test\ - strrncasestr.test\ - strrnstr.test\ - strrstr.test\ - strstarts.test\ - sumtimespec.test\ - sumtimeval.test\ - timespec2timeval.test\ - timespectostr.test\ - timevaltostr.test\ - vasprintf.test\ - vputenvf.test\ - libsimple.test +TESTS = $(OBJ:.o=.test) all: libsimple.a $(TESTS) $(OBJ): $(@:.o=.c) libsimple.h @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST static inline size_t @@ -36,3 +37,15 @@ libsimple_vreallocn(void *ptr, size_t n, va_list ap) /* TODO test */ n = alloc_size_product(n, ap); return !n ? NULL : realloc(ptr, n); } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_encalloc(int status, size_t n, size_t m) /* TODO test */ } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_enmalloc(int status, size_t n) /* TODO test */ } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_enmemdup(int status, const void *s, size_t n) /* TODO test */ } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/enrealloc.c b/enrealloc.c index e996319..04feede 100644 --- a/enrealloc.c +++ b/enrealloc.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_enrealloc(int status, void *ptr, size_t n) /* TODO test */ } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_enstrdup(int status, const char *s) /* TODO test */ } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/enstrndup.c b/enstrndup.c index 23dd9fe..7dd6595 100644 --- a/enstrndup.c +++ b/enstrndup.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_enstrndup(int status, const char *s, size_t n) /* TODO test */ } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/envmalloczn.c b/envmalloczn.c index 661e18a..832ce67 100644 --- a/envmalloczn.c +++ b/envmalloczn.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_envmalloczn(int status, int clear, size_t n, va_list ap) /* TODO test } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/envputenvf.c b/envputenvf.c index 583859f..cf30208 100644 --- a/envputenvf.c +++ b/envputenvf.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -13,3 +14,15 @@ libsimple_envputenvf(int status, const char *fmt, va_list ap) /* TODO test */ exit(status); } } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/envreallocn.c b/envreallocn.c index ec64d29..44b69e3 100644 --- a/envreallocn.c +++ b/envreallocn.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -15,3 +16,15 @@ libsimple_envreallocn(int status, void *ptr, size_t n, va_list ap) /* TODO test } return ret; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST int @@ -38,3 +39,15 @@ libsimple_recvfd(int sock) /* TODO test */ memcpy(&fd, CMSG_DATA(cmsg), sizeof(fd)); return fd; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/recvfrom_timestamped.c b/recvfrom_timestamped.c index f5f8e53..49e8e3f 100644 --- a/recvfrom_timestamped.c +++ b/recvfrom_timestamped.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST ssize_t @@ -55,3 +56,15 @@ libsimple_recvfrom_timestamped(int fd, void *restrict buf, size_t n, int flags, return r; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST int @@ -29,3 +30,15 @@ libsimple_sendfd(int sock, int fd) /* TODO test */ return -(sendmsg(sock, &msg, 0) != (ssize_t)iov.iov_len); } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strtotimespec.c b/strtotimespec.c index 1e6e8d1..bd28260 100644 --- a/strtotimespec.c +++ b/strtotimespec.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST int @@ -142,3 +143,15 @@ overflow: errno = ERANGE; return -1; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strtotimeval.c b/strtotimeval.c index a0a18b9..6c30c88 100644 --- a/strtotimeval.c +++ b/strtotimeval.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST int @@ -13,3 +14,15 @@ libsimple_strtotimeval(struct timeval *restrict tv, const char *restrict s, char errno = ERANGE; return r; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/vweprintf.c b/vweprintf.c index f46bd26..d994c0e 100644 --- a/vweprintf.c +++ b/vweprintf.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "libsimple.h" +#ifndef TEST extern char *argv0; @@ -54,3 +55,15 @@ libsimple_vweprintf(const char *fmt, va_list ap) /* TODO test */ errno = saved_errno; } + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif |