|
14 | 14 | */ |
15 | 15 | #include "fossil/test/testing.h" |
16 | 16 |
|
| 17 | + |
17 | 18 | // Array of messages for each category |
18 | 19 | const char *sarcastic_messages[] = { |
19 | 20 | "Wow, no tests were run! What a productive day!", |
@@ -795,27 +796,6 @@ void fossil_test_sanity(fossil_test_env_t *env) { |
795 | 796 | printf(FOSSIL_TEST_COLOR_CYAN "Overall Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 5]); |
796 | 797 | } |
797 | 798 |
|
798 | | -// Function to print a long horizontal top border with a corner |
799 | | -void print_long_horizontal_top_border(int length) { |
800 | | - // Print the top left corner, followed by the horizontal border, and then the top right corner |
801 | | - printf(FOSSIL_TEST_COLOR_BLUE "%s", TOP_LEFT_CORNER); |
802 | | - for (int i = 0; i < length; i++) { |
803 | | - printf("%s", HORIZONTAL_BORDER); // Repeat the horizontal border character |
804 | | - } |
805 | | - printf("%s\n" FOSSIL_TEST_COLOR_RESET, TOP_RIGHT_CORNER); // End with the top right corner |
806 | | -} |
807 | | - |
808 | | -// Function to print a long horizontal bottom border with a corner |
809 | | -void print_long_horizontal_bottom_border(int length) { |
810 | | - // Print the bottom left corner, followed by the horizontal border, and then the bottom right corner |
811 | | - printf(FOSSIL_TEST_COLOR_BLUE "%s", BOTTOM_LEFT_CORNER); |
812 | | - for (int i = 0; i < length; i++) { |
813 | | - printf("%s", HORIZONTAL_BORDER); // Repeat the horizontal border character |
814 | | - } |
815 | | - printf("%s\n" FOSSIL_TEST_COLOR_RESET, BOTTOM_RIGHT_CORNER); // End with the bottom right corner |
816 | | -} |
817 | | - |
818 | | -// Function to simulate pixel manipulation in the foreground for the test summary |
819 | 799 | void fossil_test_summary(fossil_test_env_t *env) { |
820 | 800 | if (!env) { |
821 | 801 | return; |
@@ -851,24 +831,33 @@ void fossil_test_summary(fossil_test_env_t *env) { |
851 | 831 | } |
852 | 832 | env->end_execution_time = clock(); |
853 | 833 |
|
854 | | - // Manipulate the border pixels using box-drawing characters |
855 | | - int border_length = 80; // Set the length of the horizontal border (adjust as necessary) |
856 | | - print_long_horizontal_top_border(border_length); // Top border |
857 | | - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "%s %s %s\n" FOSSIL_TEST_COLOR_RESET, |
858 | | - VERTICAL_BORDER, "Fossil Test Summary:", VERTICAL_BORDER); // Title |
859 | | - print_long_horizontal_bottom_border(border_length); // Bottom border |
| 834 | + // TUI-like header with borders and bold title |
| 835 | + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "╔══════════════════════════════════════════════════════════╗\n" FOSSIL_TEST_COLOR_RESET); |
| 836 | + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "║\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); |
| 837 | + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "╚══════════════════════════════════════════════════════════╝\n" FOSSIL_TEST_COLOR_RESET); |
860 | 838 |
|
861 | | - fossil_test_sanity(env); // Add any additional sanity checks or suggestions here |
| 839 | + fossil_test_sanity(env); // Add suggestions |
862 | 840 |
|
863 | | - // Total execution time with manipulated borders |
| 841 | + // Execution time summary with a clean format |
864 | 842 | double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; |
865 | 843 | int seconds = (int)total_execution_time; |
866 | 844 | int milliseconds = (int)((total_execution_time - seconds) * 1000); |
867 | 845 | int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); |
868 | 846 |
|
869 | | - // Display time with additional border manipulation |
870 | | - print_long_horizontal_top_border(border_length); // Custom long horizontal border (top) |
871 | | - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC " Execution time: (%.2d) seconds, (%.2d) milliseconds, (%.3d) microseconds\n" FOSSIL_TEST_COLOR_RESET, |
872 | | - seconds, milliseconds, microseconds); // Time info |
873 | | - print_long_horizontal_bottom_border(border_length); // Custom long horizontal border (bottom) |
| 847 | + // Displaying execution time in a TUI-like format |
| 848 | + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "╔══════════════════════════════════════════════════════════╗\n" FOSSIL_TEST_COLOR_RESET); |
| 849 | + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "║ Execution time: (%.2d) sec, (%.2d) ms, (%.3d) µs\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds); |
| 850 | + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "╚══════════════════════════════════════════════════════════╝\n" FOSSIL_TEST_COLOR_RESET); |
| 851 | + |
| 852 | + // Detailed summary with counts and additional info |
| 853 | + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "Test Results:\n" FOSSIL_TEST_COLOR_RESET); |
| 854 | + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "╔══════════════════════════════════════════════════════════╗\n" FOSSIL_TEST_COLOR_RESET); |
| 855 | + printf(FOSSIL_TEST_COLOR_CYAN "║ Passed: %d\n", env->pass_count); |
| 856 | + printf(FOSSIL_TEST_COLOR_CYAN "║ Failed: %d\n", env->fail_count); |
| 857 | + printf(FOSSIL_TEST_COLOR_CYAN "║ Skipped: %d\n", env->skip_count); |
| 858 | + printf(FOSSIL_TEST_COLOR_CYAN "║ Timed Out: %d\n", env->timeout_count); |
| 859 | + printf(FOSSIL_TEST_COLOR_CYAN "║ Unexpected: %d\n", env->unexpected_count); |
| 860 | + |
| 861 | + // Footer with TUI-style border |
| 862 | + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "╚══════════════════════════════════════════════════════════╝\n" FOSSIL_TEST_COLOR_RESET); |
874 | 863 | } |
0 commit comments