summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-28 20:46:19 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-28 20:46:19 -0500
commite22b9d26835a985d214f5736fa065efcfeb804d4 (patch)
tree59efb37e977a437ba0f3d175d2ffa93b50b2c302
parentbeb56a867567447c7e7c3f4f2a948bb3732e74bd (diff)
refactor test names with _h to avoid collisions
move prototypes to main.c to avoid continuous growth of test.h add final tally
-rw-r--r--assert.c2
-rw-r--r--ctype.c2
-rw-r--r--errno.c2
-rw-r--r--locale.c2
-rw-r--r--main.c57
-rw-r--r--test.c5
-rw-r--r--test.h8
-rw-r--r--time.c2
8 files changed, 65 insertions, 15 deletions
diff --git a/assert.c b/assert.c
index 9b4f0ae..d446731 100644
--- a/assert.c
+++ b/assert.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include "test.h"
-void test_assert(void)
+void test_assert_h(void)
{
int n = 0;
diff --git a/ctype.c b/ctype.c
index 94de005..7e60f96 100644
--- a/ctype.c
+++ b/ctype.c
@@ -64,7 +64,7 @@ static void test_ctype_conversion_imp(const char *fnname, int (*fn)(int), const
test_int_equals_imp(expression, fn(EOF), EOF);
}
-void test_ctype(void)
+void test_ctype_h(void)
{
testing_header("ctype.h");
test_ctype_function(isalnum, UPPER LOWER DIGIT);
diff --git a/errno.c b/errno.c
index 63e003c..4851969 100644
--- a/errno.c
+++ b/errno.c
@@ -15,7 +15,7 @@
#endif
#endif
-void test_errno(void)
+void test_errno_h(void)
{
struct lconv *lc;
int errno_values[] = {
diff --git a/locale.c b/locale.c
index b1ab618..d95831a 100644
--- a/locale.c
+++ b/locale.c
@@ -26,7 +26,7 @@
#error LC_TIME not defined
#endif
-void test_locale(void)
+void test_locale_h(void)
{
struct lconv *lc;
int locale_categories[] = {
diff --git a/main.c b/main.c
index 12f1469..cfe6a3c 100644
--- a/main.c
+++ b/main.c
@@ -1,17 +1,64 @@
#include <string.h>
+#include <stdio.h>
#include "test.h"
+void test_assert_h(void);
+void test_complex_h(void);
+void test_ctype_h(void);
+void test_errno_h(void);
+void test_fenv_h(void);
+void test_float_h(void);
+void test_inttypes_h(void);
+void test_iso646(void);
+void test_limits_h(void);
+void test_locale_h(void);
+void test_math_h(void);
+void test_setjmp_h(void);
+void test_signal_h(void);
+void test_stdarg_h(void);
+void test_stdbool_h(void);
+void test_stddef_h(void);
+void test_stdint_h(void);
+void test_stdio_h(void);
+void test_stdlib_h(void);
+void test_string_h(void);
+void test_tgmath_h(void);
+void test_time_h(void);
+void test_wchar_h(void);
+void test_wctype_h(void);
+
int main(int argc, char *argv[])
{
if (argc == 2) {
if (!strcmp(argv[1], "assert")) {
- test_assert();
+ test_assert_h();
}
}
- test_time();
- test_errno();
- test_ctype();
- test_locale();
+ /* test_complex_h(); */
+ test_ctype_h();
+ test_errno_h();
+ /* test_fenv_h(); */
+ /* test_float_h(); */
+ /* test_inttypes_h(); */
+ /* test_iso646(); */
+ /* test_limits_h(); */
+ test_locale_h();
+ /* test_math_h(); */
+ /* test_setjmp_h(); */
+ /* test_signal_h(); */
+ /* test_stdarg_h(); */
+ /* test_stdbool_h(); */
+ /* test_stddef_h(); */
+ /* test_stdint_h(); */
+ /* test_stdio_h(); */
+ /* test_stdlib_h(); */
+ /* test_string_h(); */
+ /* test_tgmath_h(); */
+ test_time_h();
+ /* test_wchar_h(); */
+ /* test_wctype_h(); */
+
+ printf("Total: %u passed, %u failed\n", total_passed, total_failed);
return 0;
}
diff --git a/test.c b/test.c
index 79fd807..531d25b 100644
--- a/test.c
+++ b/test.c
@@ -1,6 +1,8 @@
#include <stdio.h>
#include <stdarg.h>
+unsigned int total_passed = 0;
+unsigned int total_failed = 0;
static int passed;
static int failed;
int verbose = 0;
@@ -66,7 +68,10 @@ void testing_end(void)
printf("%d tests passed, %d tests failed\n", passed, failed);
+ total_passed += passed;
passed = 0;
+
+ total_failed += failed;
failed = 0;
}
diff --git a/test.h b/test.h
index 25a3419..ef28c1d 100644
--- a/test.h
+++ b/test.h
@@ -20,8 +20,6 @@ void test_string_imp(const char*, const char*, const char*);
void test_distinct_imp(const char*, int *, size_t);
#define test_distinct(array) test_distinct_imp(#array, array, sizeof(array) / sizeof(array[0]))
-void test_assert(void);
-void test_ctype(void);
-void test_locale(void);
-void test_errno(void);
-void test_time(void);
+extern int verbose;
+extern unsigned int total_passed;
+extern unsigned int total_failed;
diff --git a/time.c b/time.c
index 2c2cb83..3e16971 100644
--- a/time.c
+++ b/time.c
@@ -15,7 +15,7 @@
test_string(buf, _expected); \
} while (0)
-void test_time(void)
+void test_time_h(void)
{
struct tm tm;
tm.tm_year = 2001 - 1900;