Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(messages): Add success/fail messages to high log levels. #18

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions src/inc/testf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -82,22 +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) { \
INFO_TAG(); \
printf("Running " #suite "\t" #test "\n"); \
} \
testframework_tests++; \
test_##suite##_##test(&failures); \
if (failures) \
testframework_fails++; \
} \
#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);
Expand Down
Loading