libdev.a

C Helper library
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/libdev.a

commit ed415e60fd8790bd30c6e390a198427ece873a36
parent d229f9c29ee717fcf7ccfc32dd58cd40df1b85dc
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 10 Oct 2016 11:55:22 +0200

Fix(test_all):

Fix a division by zero bug.

Diffstat:
Mtests.c | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests.c b/tests.c @@ -65,9 +65,13 @@ void test_all(void) { list_add(groups, ptr->group, strlen(ptr->group)); } } - printf("\n"); - info("============================= RESULTS =============================\n"); - info("\033[1;32mTESTS SUCCESS\033[0m:\t%d\n", success); - info("\033[1;31mTESTS FAILED\033[0m:\t\t%d\n", failed); - info("\033[1;34mTOTAL COVERAGE\033[0m:\t%d%%\n", (success * 100) / total); + if (!total) + warning("No tests registered, skipping."); + else { + printf("\n"); + info("============================= RESULTS =============================\n"); + info("\033[1;32mTESTS SUCCESS\033[0m:\t%d\n", success); + info("\033[1;31mTESTS FAILED\033[0m:\t\t%d\n", failed); + info("\033[1;34mTOTAL COVERAGE\033[0m:\t%d%%\n", (success * 100) / total); + } }