diff --git a/include/criterion/stats.h b/include/criterion/stats.h index 6d84e8c..8a1b4e7 100644 --- a/include/criterion/stats.h +++ b/include/criterion/stats.h @@ -56,6 +56,7 @@ struct criterion_suite_stats { struct criterion_test_stats *tests; size_t nb_tests; size_t nb_asserts; + size_t tests_skipped; size_t tests_failed; size_t tests_crashed; size_t tests_passed; @@ -70,6 +71,7 @@ struct criterion_global_stats { size_t nb_suites; size_t nb_tests; size_t nb_asserts; + size_t tests_skipped; size_t tests_failed; size_t tests_crashed; size_t tests_passed; diff --git a/src/log/normal.c b/src/log/normal.c index c696516..eff52f6 100644 --- a/src/log/normal.c +++ b/src/log/normal.c @@ -88,6 +88,8 @@ void normal_log_post_suite(struct criterion_suite_stats *stats) { } void normal_log_post_all(struct criterion_global_stats *stats) { + size_t tested = stats->nb_tests - stats->tests_skipped; + criterion_pimportant(CRITERION_PREFIX_EQUALS, _("%1$sSynthesis: Tested: %2$s%3$lu%4$s " "| Passing: %5$s%6$lu%7$s " @@ -95,7 +97,7 @@ void normal_log_post_all(struct criterion_global_stats *stats) { "| Crashing: %11$s%12$lu%13$s " "%14$s\n"), FG_BOLD, - FG_BLUE, (unsigned long) stats->nb_tests, FG_BOLD, + FG_BLUE, (unsigned long) tested, FG_BOLD, FG_GREEN, (unsigned long) stats->tests_passed, FG_BOLD, FG_RED, (unsigned long) stats->tests_failed, FG_BOLD, FG_RED, (unsigned long) stats->tests_crashed, FG_BOLD, diff --git a/src/stats.c b/src/stats.c index a817ec3..fcc5fb5 100644 --- a/src/stats.c +++ b/src/stats.c @@ -106,6 +106,13 @@ static void push_pre_suite(s_glob_stats *stats, ++stats->nb_suites; } +__attribute__((always_inline)) +static inline bool is_disabled(struct criterion_test *t, + struct criterion_suite *s) { + + return t->data->disabled || (s->data && s->data->disabled); +} + static void push_pre_test(s_glob_stats *stats, s_suite_stats *suite, s_test_stats *test, @@ -114,6 +121,11 @@ static void push_pre_test(s_glob_stats *stats, suite->tests = sref(test); ++stats->nb_tests; ++suite->nb_tests; + + if (is_disabled(test->test, suite->suite)) { + ++stats->tests_skipped; + ++suite->tests_skipped; + } } static void destroy_assert(void *ptr, UNUSED void *meta) {