From 92d8bccac8c71dbf4db3b393c4030f9e10f551f7 Mon Sep 17 00:00:00 2001 From: Miguel Silva Date: Wed, 10 Jan 2024 14:47:28 +0000 Subject: [PATCH 1/2] fix(messages): Add success/fail messages to high log levels Add messages at the end of each test reporting whether the test was successful or not. Signed-off-by: Miguel Silva --- src/inc/testf.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/inc/testf.h b/src/inc/testf.h index a430756..f9ea87f 100644 --- a/src/inc/testf.h +++ b/src/inc/testf.h @@ -71,6 +71,7 @@ extern unsigned int testframework_start, testframework_end; #define LOG_TESTS() \ do { \ if (TESTF_LOG_LEVEL > 1) { \ + printf("\n"); \ INFO_TAG(); \ printf("Final Report\n"); \ if (testframework_fails) \ @@ -90,13 +91,25 @@ extern unsigned int testframework_start, testframework_end; extern unsigned int testframework_fails; \ unsigned char failures = 0; \ if (TESTF_LOG_LEVEL > 1) { \ + printf("\n"); \ INFO_TAG(); \ printf("Running " #suite "\t" #test "\n"); \ } \ testframework_tests++; \ test_##suite##_##test(&failures); \ - if (failures) \ + if (failures) { \ testframework_fails++; \ + if (TESTF_LOG_LEVEL > 1) { \ + FAIL_TAG(); \ + printf(#suite "\t" #test " failed! \n" ); \ + } \ + } \ + else { \ + if (TESTF_LOG_LEVEL > 1) { \ + SUCC_TAG(); \ + printf(#suite "\t" #test " passed! \n" ); \ + } \ + } \ } \ void test_##suite##_##test(unsigned char* failures) From 61f1bf592095a782717f054df82268ce59463dec Mon Sep 17 00:00:00 2001 From: Miguel Silva Date: Wed, 10 Jan 2024 17:35:07 +0000 Subject: [PATCH 2/2] ci(fix): Fix format to comply with ci Signed-off-by: Miguel Silva --- src/inc/testf.h | 57 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/inc/testf.h b/src/inc/testf.h index f9ea87f..bc247a6 100644 --- a/src/inc/testf.h +++ b/src/inc/testf.h @@ -71,7 +71,7 @@ extern unsigned int testframework_start, testframework_end; #define LOG_TESTS() \ do { \ if (TESTF_LOG_LEVEL > 1) { \ - printf("\n"); \ + printf("\n"); \ INFO_TAG(); \ printf("Final Report\n"); \ if (testframework_fails) \ @@ -83,34 +83,33 @@ extern unsigned int testframework_start, testframework_end; testframework_tests - testframework_fails, testframework_fails); \ } while (0) -#define BAO_TEST(suite, test) \ - void test_##suite##_##test(unsigned char*); \ - void entry_test_##suite##_##test(void) \ - { \ - extern unsigned int testframework_tests; \ - extern unsigned int testframework_fails; \ - unsigned char failures = 0; \ - if (TESTF_LOG_LEVEL > 1) { \ - printf("\n"); \ - INFO_TAG(); \ - printf("Running " #suite "\t" #test "\n"); \ - } \ - testframework_tests++; \ - test_##suite##_##test(&failures); \ - if (failures) { \ - testframework_fails++; \ - if (TESTF_LOG_LEVEL > 1) { \ - FAIL_TAG(); \ - printf(#suite "\t" #test " failed! \n" ); \ - } \ - } \ - else { \ - if (TESTF_LOG_LEVEL > 1) { \ - SUCC_TAG(); \ - printf(#suite "\t" #test " passed! \n" ); \ - } \ - } \ - } \ +#define BAO_TEST(suite, test) \ + void test_##suite##_##test(unsigned char*); \ + void entry_test_##suite##_##test(void) \ + { \ + extern unsigned int testframework_tests; \ + extern unsigned int testframework_fails; \ + unsigned char failures = 0; \ + if (TESTF_LOG_LEVEL > 1) { \ + printf("\n"); \ + INFO_TAG(); \ + printf("Running " #suite "\t" #test "\n"); \ + } \ + testframework_tests++; \ + test_##suite##_##test(&failures); \ + if (failures) { \ + testframework_fails++; \ + if (TESTF_LOG_LEVEL > 1) { \ + FAIL_TAG(); \ + printf(#suite "\t" #test " failed! \n"); \ + } \ + } else { \ + if (TESTF_LOG_LEVEL > 1) { \ + SUCC_TAG(); \ + printf(#suite "\t" #test " passed! \n"); \ + } \ + } \ + } \ void test_##suite##_##test(unsigned char* failures) void testf_entry(void);