summaryrefslogtreecommitdiff
path: root/tests/pke-test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pke-test.cpp')
-rw-r--r--tests/pke-test.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/pke-test.cpp b/tests/pke-test.cpp
index 5508394..7a314b5 100644
--- a/tests/pke-test.cpp
+++ b/tests/pke-test.cpp
@@ -34,10 +34,12 @@ int main(int argc, char *argv[])
(void)argv;
int i = 0;
int result;
- uint32_t k, pass_count;
+ uint32_t k, pass_count, test_group_count, test_group_pass_count;
double elapsed_ms;
double group_ms;
+ double total_ms;
pk_tmr func_tmr;
+ pk_tmr total_tmr;
pke_test_get_group *group_fns[] = {
pke_test_dummy_get_group,
@@ -50,9 +52,14 @@ int main(int argc, char *argv[])
NULL,
};
+ total_ms = 0;
+ test_group_count = 0;
+ test_group_pass_count = 0;
+ pk_tmr_start(total_tmr);
fprintf(stdout, "\r\n");
pke_test_get_group *fn = group_fns[i];
while (fn != NULL) {
+ test_group_count += 1;
pass_count = 0;
group_ms = 0;
struct pke_test_group *group = (fn)();
@@ -68,6 +75,7 @@ int main(int argc, char *argv[])
pk_tmr_stop(func_tmr);
elapsed_ms = pk_tmr_duration_dbl_mili(func_tmr);
group_ms += elapsed_ms;
+ total_ms += elapsed_ms;
if (result == group->tests[k].expected_result){
pass_count += 1;
fprintf(stdout, "[pke-test]:[%s]:[%s] %sPassed.%s\n", group->title, group->tests[k].title, CLR_GREEN, CLR_WHITE);
@@ -81,9 +89,17 @@ int main(int argc, char *argv[])
if (group->group_teardown != NULL) (group->group_teardown)();
fprintf(stdout, "[pke-test]:[%s] End. ( %s%03d%s / %03d ) Tests Completed.\n", group->title, pass_count == group->n_tests ? CLR_GREEN : CLR_RED, pass_count, CLR_WHITE, group->n_tests);
fprintf(stdout, "[pke-test]:[%s] End. Elapsed ms: '%f'.\n\n", group->title, group_ms);
+ if (pass_count == group->n_tests) {
+ test_group_pass_count += 1;
+ }
i += 1;
fn = group_fns[i];
}
+ pk_tmr_stop(total_tmr);
+
+ fprintf(stdout, "[pke-test] End. ( %s%03d%s / %03d ) Test Groups Completed.\n", test_group_count == test_group_pass_count ? CLR_GREEN : CLR_RED, test_group_pass_count, CLR_WHITE, test_group_count);
+ fprintf(stdout, "[pke-test] End. Elapsed ms: '%f' (test fn sum).\n", total_ms);
+ fprintf(stdout, "[pke-test] End. Elapsed ms: '%f' (actual).\n\n", pk_tmr_duration_dbl_mili(total_tmr));
return 0;
}