diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-02-28 20:46:19 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-02-28 20:46:19 -0500 |
commit | e22b9d26835a985d214f5736fa065efcfeb804d4 (patch) | |
tree | 59efb37e977a437ba0f3d175d2ffa93b50b2c302 | |
parent | beb56a867567447c7e7c3f4f2a948bb3732e74bd (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.c | 2 | ||||
-rw-r--r-- | ctype.c | 2 | ||||
-rw-r--r-- | errno.c | 2 | ||||
-rw-r--r-- | locale.c | 2 | ||||
-rw-r--r-- | main.c | 57 | ||||
-rw-r--r-- | test.c | 5 | ||||
-rw-r--r-- | test.h | 8 | ||||
-rw-r--r-- | time.c | 2 |
8 files changed, 65 insertions, 15 deletions
@@ -1,7 +1,7 @@ #include <stdio.h> #include "test.h" -void test_assert(void) +void test_assert_h(void) { int n = 0; @@ -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); @@ -15,7 +15,7 @@ #endif #endif -void test_errno(void) +void test_errno_h(void) { struct lconv *lc; int errno_values[] = { @@ -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[] = { @@ -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; } @@ -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; } @@ -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; @@ -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; |