Skip to content

Commit

Permalink
Add header to output
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy-Gonzalez committed Feb 3, 2024
1 parent 9fad819 commit 73f5f0c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ int main()
caught_internal_initialize_color_output();

printf("\n");
caught_output_header();

int passed_tests = 0;
for (int i = 0; i < caught_internal.tests_num; ++i)
Expand Down
15 changes: 15 additions & 0 deletions src/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#define CAUGHT_COLOR_INFO "\x1b[34m" // ANSI blue
#define CAUGHT_OUTPUT_BOLD "\x1b[1m" // ANSI bold
#define CAUGHT_OUTPUT_RESET "\x1b[0m" // ANSI reset

#define CAUGHT_OUTPUT_HEADER "==================================== Caught ====================================\n\n" \
" A lightweight & simple C testing library\n\n" \
" Copyright(c) 2024 Timothy Gonzalez\n\n" \
"================================================================================\n"

int caught_color_enabled = 0;

void caught_internal_initialize_color_output()
Expand Down Expand Up @@ -57,6 +63,15 @@ void caught_output_reset()
printf("%s", CAUGHT_OUTPUT_RESET);
}

void caught_output_header()
{
printf("%s", CAUGHT_OUTPUT_HEADER);
caught_output_bold();
caught_output_info();
printf("\nLoaded %i tests\n", caught_internal.tests_num);
caught_output_reset();
}

void caught_output_status_tag(int pass)
{
caught_output_bold();
Expand Down
1 change: 1 addition & 0 deletions src/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void caught_output_info();
void caught_output_bold();
void caught_output_reset();

void caught_output_header();
void caught_output_status_tag(int pass);
void caught_output_assertion(caught_internal_assertion *assertion);
void caught_output_test_summary(const char *test_name, int passed, int failed);
Expand Down

0 comments on commit 73f5f0c

Please sign in to comment.