[Issue #15] Fixed inaccurate statistics on disabled tests
This commit is contained in:
parent
260b88c5d7
commit
8a29e3e792
3 changed files with 17 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
12
src/stats.c
12
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue