From 9efd75d4e6fb6a07e33e9ddb2d0837e065114186 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" Date: Sun, 6 Apr 2025 01:15:52 -0600 Subject: [PATCH 01/35] add internal header --- code/logic/fossil/test/internal.h | 98 +++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 code/logic/fossil/test/internal.h diff --git a/code/logic/fossil/test/internal.h b/code/logic/fossil/test/internal.h new file mode 100644 index 00000000..b952c76f --- /dev/null +++ b/code/logic/fossil/test/internal.h @@ -0,0 +1,98 @@ +/* + * ----------------------------------------------------------------------------- + * Project: Fossil Logic + * + * This file is part of the Fossil Logic project, which aims to develop high- + * performance, cross-platform applications and libraries. The code contained + * herein is subject to the terms and conditions defined in the project license. + * + * Author: Michael Gene Brockus (Dreamer) + * Date: 07/01/2024 + * + * Copyright (C) 2024 Fossil Logic. All rights reserved. + * ----------------------------------------------------------------------------- + */ +#ifndef FOSSIL_TEST_CORE_H +#define FOSSIL_TEST_CORE_H + +#define MAX_NAME_LENGTH 256 + +// Color codes +#define FOSSIL_TEST_COLOR_RESET "\033[0m" // Reset +#define FOSSIL_TEST_COLOR_GREEN "\033[32m" // Green +#define FOSSIL_TEST_COLOR_RED "\033[31m" // Red +#define FOSSIL_TEST_COLOR_YELLOW "\033[33m" // Yellow +#define FOSSIL_TEST_COLOR_BLUE "\033[34m" // Blue +#define FOSSIL_TEST_COLOR_MAGENTA "\033[35m" // Magenta +#define FOSSIL_TEST_COLOR_CYAN "\033[36m" // Cyan +#define FOSSIL_TEST_COLOR_WHITE "\033[97m" // White +#define FOSSIL_TEST_COLOR_PURPLE "\033[35m" // Purple +#define FOSSIL_TEST_COLOR_ORANGE "\033[38;5;208m" // Orange + +#define FOSSIL_TEST_ATTR_BOLD "\033[1m" // Bold +#define FOSSIL_TEST_ATTR_DIM "\033[2m" // Dim +#define FOSSIL_TEST_ATTR_UNDERLINE "\033[4m" // Underline +#define FOSSIL_TEST_ATTR_ITALIC "\033[3m" // Italic +#define FOSSIL_TEST_ATTR_REVERSE "\033[7m" // Reverse +#define FOSSIL_TEST_ATTR_STRIKETHROUGH "\033[9m" // Strikethrough + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @struct fossil_test_options_t + * @brief Structure to hold various options for fossil testing. + * + * This structure contains various flags and parameters that control the behavior of the fossil testing framework. + * + * @var fossil_test_options_t::show_version + * Flag to indicate if the version information should be displayed. + * + * @var fossil_test_options_t::show_help + * Flag to indicate if the help information should be displayed. + * + * @var fossil_test_options_t::show_info + * Flag to indicate if additional information should be displayed. + * + * @var fossil_test_options_t::reverse + * Flag to indicate if the order of tests should be reversed. + * + * @var fossil_test_options_t::repeat_enabled + * Flag to indicate if test repetition is enabled. + * + * @var fossil_test_options_t::repeat_count + * Number of times to repeat the tests if repetition is enabled. + * + * @var fossil_test_options_t::shuffle_enabled + * Flag to indicate if the tests should be shuffled. + * + * @var fossil_test_options_t::dry_run + * Flag to indicate if the tests should be run in dry-run mode (no actual execution). + * + */ +typedef struct { + bool show_version; + bool show_help; + bool show_info; + bool reverse; + bool repeat_enabled; + int32_t repeat_count; + bool shuffle_enabled; + bool dry_run; +} fossil_test_options_t; + +#ifdef __cplusplus +} +#endif + +#endif // FOSSIL_TEST_CORE_H From b507b9f6126729ad60f9183e5839aa6cf5fe12bb Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" Date: Sun, 6 Apr 2025 01:16:07 -0600 Subject: [PATCH 02/35] move some parts over --- code/logic/fossil/test/testing.h | 77 ++------------------------------ 1 file changed, 4 insertions(+), 73 deletions(-) diff --git a/code/logic/fossil/test/testing.h b/code/logic/fossil/test/testing.h index aa353789..f2e64cd5 100644 --- a/code/logic/fossil/test/testing.h +++ b/code/logic/fossil/test/testing.h @@ -12,84 +12,15 @@ * Copyright (C) 2024 Fossil Logic. All rights reserved. * ----------------------------------------------------------------------------- */ -#ifndef FOSSIL_TEST_CORE_H -#define FOSSIL_TEST_CORE_H - -#define MAX_NAME_LENGTH 256 - -// Color codes -#define FOSSIL_TEST_COLOR_RESET "\033[0m" // Reset -#define FOSSIL_TEST_COLOR_GREEN "\033[32m" // Green -#define FOSSIL_TEST_COLOR_RED "\033[31m" // Red -#define FOSSIL_TEST_COLOR_YELLOW "\033[33m" // Yellow -#define FOSSIL_TEST_COLOR_BLUE "\033[34m" // Blue -#define FOSSIL_TEST_COLOR_MAGENTA "\033[35m" // Magenta -#define FOSSIL_TEST_COLOR_CYAN "\033[36m" // Cyan -#define FOSSIL_TEST_COLOR_WHITE "\033[97m" // White -#define FOSSIL_TEST_COLOR_PURPLE "\033[35m" // Purple -#define FOSSIL_TEST_COLOR_ORANGE "\033[38;5;208m" // Orange - -#define FOSSIL_TEST_ATTR_BOLD "\033[1m" // Bold -#define FOSSIL_TEST_ATTR_DIM "\033[2m" // Dim -#define FOSSIL_TEST_ATTR_UNDERLINE "\033[4m" // Underline -#define FOSSIL_TEST_ATTR_ITALIC "\033[3m" // Italic - - -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef FOSSIL_TEST_INTERNAL_H +#define FOSSIL_TEST_INTERNAL_H + +#include "internal.h" #ifdef __cplusplus extern "C" { #endif -/** - * @struct fossil_test_options_t - * @brief Structure to hold various options for fossil testing. - * - * This structure contains various flags and parameters that control the behavior of the fossil testing framework. - * - * @var fossil_test_options_t::show_version - * Flag to indicate if the version information should be displayed. - * - * @var fossil_test_options_t::show_help - * Flag to indicate if the help information should be displayed. - * - * @var fossil_test_options_t::show_info - * Flag to indicate if additional information should be displayed. - * - * @var fossil_test_options_t::reverse - * Flag to indicate if the order of tests should be reversed. - * - * @var fossil_test_options_t::repeat_enabled - * Flag to indicate if test repetition is enabled. - * - * @var fossil_test_options_t::repeat_count - * Number of times to repeat the tests if repetition is enabled. - * - * @var fossil_test_options_t::shuffle_enabled - * Flag to indicate if the tests should be shuffled. - * - * @var fossil_test_options_t::dry_run - * Flag to indicate if the tests should be run in dry-run mode (no actual execution). - * - */ -typedef struct { - bool show_version; - bool show_help; - bool show_info; - bool reverse; - bool repeat_enabled; - int32_t repeat_count; - bool shuffle_enabled; - bool dry_run; -} fossil_test_options_t; - /** * @enum test_status * @brief Enumeration to represent the status of a test. From 858053165598332877afb577a459752a4ceb2447 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" Date: Sun, 6 Apr 2025 01:16:19 -0600 Subject: [PATCH 03/35] update summary --- code/logic/testing.c | 109 ++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 42 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 8e784890..bd21087a 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -731,47 +731,54 @@ void fossil_test_init(fossil_test_env_t *env, int argc, char **argv) { } } -void fossil_test_sanity(fossil_test_env_t *env) { +void fossil_test_analyze(fossil_test_env_t *env) { if (!env) { return; } - // Sanity analysis based on results + int no_assertion_count = 0; // Counter for test cases with no assertions + int skipped_count = 0; // Counter for skipped test cases + + // Iterate through all test suites and test cases to count skipped and no-assertion cases + fossil_test_suite_t *suite = env->test_suites; + while (suite) { + fossil_test_case_t *test = suite->tests; + while (test) { + if (test->status == TEST_STATUS_SKIP) { + skipped_count++; + } + if (_ASSERT_COUNT == 0) { + no_assertion_count++; + } + test = test->next; + } + suite = suite->next; + } + + // Analysis based on results if (env->pass_count == 0 && env->fail_count == 0 && env->skip_count == 0 && env->timeout_count == 0 && env->empty_count > 0) { // Empty test suite: sarcastic tone - const char *message = sarcastic_messages[rand() % _FOSSIL_TEST_RESPONSE_LENGTH]; - printf(FOSSIL_TEST_COLOR_YELLOW FOSSIL_TEST_ATTR_ITALIC "Hmm, seems like we ran an empty test suite: %s\n" FOSSIL_TEST_COLOR_RESET, message); - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 3]); + printf(FOSSIL_TEST_COLOR_YELLOW FOSSIL_TEST_ATTR_ITALIC "Hmm, seems like we ran an empty test suite: %s\n" FOSSIL_TEST_COLOR_RESET, sarcastic_messages[rand() % (sizeof(sarcastic_messages) / sizeof(sarcastic_messages[0]))]); } else if (env->fail_count > 0) { // Failures occurred: humorous or frustrated tone - const char *message = humorous_messages[rand() % _FOSSIL_TEST_RESPONSE_LENGTH]; - printf(FOSSIL_TEST_COLOR_RED FOSSIL_TEST_ATTR_ITALIC "Whoops! Looks like some tests didn't pass: %s\n" FOSSIL_TEST_COLOR_RESET, message); - - // Analysis of failures + printf(FOSSIL_TEST_COLOR_RED FOSSIL_TEST_ATTR_ITALIC "Whoops! Looks like some tests didn't pass: %s\n" FOSSIL_TEST_COLOR_RESET, humorous_messages[rand() % (sizeof(humorous_messages) / sizeof(humorous_messages[0]))]); printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests failed. Possible causes include code issues, missing dependencies, or misconfigured tests.\n" FOSSIL_TEST_COLOR_RESET, env->fail_count); - - // Suggestion for improvement - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, failure_suggestions[rand() % 5]); } else if (env->pass_count > 0) { // Success: positive, motivational tone - const char *message = great_news_messages[rand() % _FOSSIL_TEST_RESPONSE_LENGTH]; - printf(FOSSIL_TEST_COLOR_GREEN FOSSIL_TEST_ATTR_ITALIC "Success! All systems go! Tests passed: %s\n" FOSSIL_TEST_COLOR_RESET, message); - - // Analysis of success + printf(FOSSIL_TEST_COLOR_GREEN FOSSIL_TEST_ATTR_ITALIC "Success! All systems go! Tests passed: %s\n" FOSSIL_TEST_COLOR_RESET, great_news_messages[rand() % (sizeof(great_news_messages) / sizeof(great_news_messages[0]))]); printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests passed successfully. Great work!\n", env->pass_count); - - // Suggestion for improvement - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n", success_suggestions[rand() % 5]); } else if (env->timeout_count > 0) { // Timeout occurred: calm, motivating tone - const char *message = timeout_messages[rand() % _FOSSIL_TEST_RESPONSE_LENGTH]; - printf(FOSSIL_TEST_COLOR_ORANGE FOSSIL_TEST_ATTR_ITALIC "Some tests timed out, but we’ll catch them next time: %s\n" FOSSIL_TEST_COLOR_RESET, message); - - // Analysis of timeouts + printf(FOSSIL_TEST_COLOR_ORANGE FOSSIL_TEST_ATTR_ITALIC "Some tests timed out, but we’ll catch them next time: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_messages[rand() % (sizeof(timeout_messages) / sizeof(timeout_messages[0]))]); printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests timed out. This might be due to long execution times or heavy resource usage.\n" FOSSIL_TEST_COLOR_RESET, env->timeout_count); - - // Suggestion for improvement - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_suggestions[rand() % 4]); + } else if (env->skip_count > 0) { + // Skipped tests: informative tone + printf(FOSSIL_TEST_COLOR_YELLOW FOSSIL_TEST_ATTR_ITALIC "Some tests were skipped. Let’s review why they were skipped.\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests were skipped. This could be due to missing prerequisites or intentional exclusions.\n" FOSSIL_TEST_COLOR_RESET, env->skip_count); + } else if (no_assertion_count > 0) { + // Missing assertions: warning tone + printf(FOSSIL_TEST_COLOR_YELLOW FOSSIL_TEST_ATTR_ITALIC "Some tests contained no assertions. Let’s ensure they are properly validating behavior.\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests had no assertions. This might indicate incomplete test cases or missing validation logic.\n" FOSSIL_TEST_COLOR_RESET, no_assertion_count); } else { // Unexpected case: neutral tone printf(FOSSIL_TEST_COLOR_RESET "We’ve encountered an unexpected result state. Something's off—let’s look into it.\n"); @@ -786,16 +793,36 @@ void fossil_test_sanity(fossil_test_env_t *env) { printf("Failure rate: %.2f%%\n", (double)env->fail_count / (env->pass_count + env->fail_count + env->skip_count + env->timeout_count) * 100); } if (env->skip_count > 0) { - printf("Skipped tests: %d\n", env->skip_count); + printf("Skipped tests: %d\n", skipped_count); } if (env->timeout_count > 0) { printf("Timeout tests: %d\n", env->timeout_count); } + if (no_assertion_count > 0) { + printf("Tests with no assertions: %d\n", no_assertion_count); + } +} - // Provide overall improvement suggestion - printf(FOSSIL_TEST_COLOR_CYAN "Overall Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 5]); +void fossil_test_suggest(fossil_test_env_t *env) { + if (!env) { + return; + } + + // Suggestions based on results + if (env->pass_count == 0 && env->fail_count == 0 && env->skip_count == 0 && env->timeout_count == 0 && env->empty_count > 0) { + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 3]); + } else if (env->fail_count > 0) { + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, failure_suggestions[rand() % 5]); + } else if (env->pass_count > 0) { + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 5]); + } else if (env->timeout_count > 0) { + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_suggestions[rand() % 4]); + } else if (env->skip_count > 0) { + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: Review the skipped tests to ensure they are intentionally excluded or have valid prerequisites.\n" FOSSIL_TEST_COLOR_RESET); + } } + void fossil_test_summary(fossil_test_env_t *env) { if (!env) { return; @@ -836,21 +863,11 @@ void fossil_test_summary(fossil_test_env_t *env) { printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - fossil_test_sanity(env); // Add suggestions - - // Execution time summary with a clean format - double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; - int seconds = (int)total_execution_time; - int milliseconds = (int)((total_execution_time - seconds) * 1000); - int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); + fossil_test_analyze(env); // Add analysis + fossil_test_suggest(env); // Add suggestions - // Displaying execution time in a TUI-like format printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - 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); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - - // Detailed summary with counts and additional info - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "Test Results:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tTest Results\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN "| Passed: %d\n" FOSSIL_TEST_COLOR_RESET, env->pass_count); printf(FOSSIL_TEST_COLOR_CYAN "| Failed: %d\n" FOSSIL_TEST_COLOR_RESET, env->fail_count); @@ -858,6 +875,14 @@ void fossil_test_summary(fossil_test_env_t *env) { printf(FOSSIL_TEST_COLOR_CYAN "| Timed Out: %d\n" FOSSIL_TEST_COLOR_RESET, env->timeout_count); printf(FOSSIL_TEST_COLOR_CYAN "| Unexpected: %d\n" FOSSIL_TEST_COLOR_RESET, env->unexpected_count); + // Execution time summary with a clean format + double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; + int seconds = (int)total_execution_time; + int milliseconds = (int)((total_execution_time - seconds) * 1000); + int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); + // Footer with TUI-style border printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + 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); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); } From a2aadc0e3f10d4ae837a4ebdd754710ce025855f Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" Date: Sun, 6 Apr 2025 08:26:09 -0600 Subject: [PATCH 04/35] added no assert count --- code/logic/fossil/test/testing.h | 1 + 1 file changed, 1 insertion(+) diff --git a/code/logic/fossil/test/testing.h b/code/logic/fossil/test/testing.h index f2e64cd5..8a3adec4 100644 --- a/code/logic/fossil/test/testing.h +++ b/code/logic/fossil/test/testing.h @@ -166,6 +166,7 @@ typedef struct fossil_test_env { int32_t fail_count; int32_t skip_count; int32_t empty_count; + int32_t no_assertion_count; int32_t timeout_count; int32_t unexpected_count; double start_execution_time; From 046cdacbc1ef5e08d8d3db4f23a429ba6aa30236 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" Date: Sun, 6 Apr 2025 08:26:26 -0600 Subject: [PATCH 05/35] added new commentary function --- code/logic/testing.c | 56 +++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index bd21087a..c1bd3937 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -731,15 +731,32 @@ void fossil_test_init(fossil_test_env_t *env, int argc, char **argv) { } } +void fossil_test_comment(fossil_test_env_t *env) { + if (!env) { + return; + } + + if (env->pass_count > 0 && env->fail_count == 0 && env->timeout_count == 0) { + printf(FOSSIL_TEST_COLOR_GREEN "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, great_news_messages[rand() % (sizeof(great_news_messages) / sizeof(great_news_messages[0]))]); + } else if (env->fail_count > 0) { + printf(FOSSIL_TEST_COLOR_RED "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, humorous_messages[rand() % (sizeof(humorous_messages) / sizeof(humorous_messages[0]))]); + } else if (env->timeout_count > 0) { + printf(FOSSIL_TEST_COLOR_ORANGE "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_messages[rand() % (sizeof(timeout_messages) / sizeof(timeout_messages[0]))]); + } else if (env->pass_count == 0 && env->fail_count == 0 && env->timeout_count == 0) { + printf(FOSSIL_TEST_COLOR_PURPLE "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, sarcastic_messages[rand() % (sizeof(sarcastic_messages) / sizeof(sarcastic_messages[0]))]); + } else { + printf(FOSSIL_TEST_COLOR_CYAN "Comment: Test results are mixed. Analyze the results for further insights.\n" FOSSIL_TEST_COLOR_RESET); + } +} + void fossil_test_analyze(fossil_test_env_t *env) { if (!env) { return; } - int no_assertion_count = 0; // Counter for test cases with no assertions - int skipped_count = 0; // Counter for skipped test cases + int no_assertion_count = 0; + int skipped_count = 0; - // Iterate through all test suites and test cases to count skipped and no-assertion cases fossil_test_suite_t *suite = env->test_suites; while (suite) { fossil_test_case_t *test = suite->tests; @@ -755,37 +772,7 @@ void fossil_test_analyze(fossil_test_env_t *env) { suite = suite->next; } - // Analysis based on results - if (env->pass_count == 0 && env->fail_count == 0 && env->skip_count == 0 && env->timeout_count == 0 && env->empty_count > 0) { - // Empty test suite: sarcastic tone - printf(FOSSIL_TEST_COLOR_YELLOW FOSSIL_TEST_ATTR_ITALIC "Hmm, seems like we ran an empty test suite: %s\n" FOSSIL_TEST_COLOR_RESET, sarcastic_messages[rand() % (sizeof(sarcastic_messages) / sizeof(sarcastic_messages[0]))]); - } else if (env->fail_count > 0) { - // Failures occurred: humorous or frustrated tone - printf(FOSSIL_TEST_COLOR_RED FOSSIL_TEST_ATTR_ITALIC "Whoops! Looks like some tests didn't pass: %s\n" FOSSIL_TEST_COLOR_RESET, humorous_messages[rand() % (sizeof(humorous_messages) / sizeof(humorous_messages[0]))]); - printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests failed. Possible causes include code issues, missing dependencies, or misconfigured tests.\n" FOSSIL_TEST_COLOR_RESET, env->fail_count); - } else if (env->pass_count > 0) { - // Success: positive, motivational tone - printf(FOSSIL_TEST_COLOR_GREEN FOSSIL_TEST_ATTR_ITALIC "Success! All systems go! Tests passed: %s\n" FOSSIL_TEST_COLOR_RESET, great_news_messages[rand() % (sizeof(great_news_messages) / sizeof(great_news_messages[0]))]); - printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests passed successfully. Great work!\n", env->pass_count); - } else if (env->timeout_count > 0) { - // Timeout occurred: calm, motivating tone - printf(FOSSIL_TEST_COLOR_ORANGE FOSSIL_TEST_ATTR_ITALIC "Some tests timed out, but we’ll catch them next time: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_messages[rand() % (sizeof(timeout_messages) / sizeof(timeout_messages[0]))]); - printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests timed out. This might be due to long execution times or heavy resource usage.\n" FOSSIL_TEST_COLOR_RESET, env->timeout_count); - } else if (env->skip_count > 0) { - // Skipped tests: informative tone - printf(FOSSIL_TEST_COLOR_YELLOW FOSSIL_TEST_ATTR_ITALIC "Some tests were skipped. Let’s review why they were skipped.\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests were skipped. This could be due to missing prerequisites or intentional exclusions.\n" FOSSIL_TEST_COLOR_RESET, env->skip_count); - } else if (no_assertion_count > 0) { - // Missing assertions: warning tone - printf(FOSSIL_TEST_COLOR_YELLOW FOSSIL_TEST_ATTR_ITALIC "Some tests contained no assertions. Let’s ensure they are properly validating behavior.\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN "Analysis: %d tests had no assertions. This might indicate incomplete test cases or missing validation logic.\n" FOSSIL_TEST_COLOR_RESET, no_assertion_count); - } else { - // Unexpected case: neutral tone - printf(FOSSIL_TEST_COLOR_RESET "We’ve encountered an unexpected result state. Something's off—let’s look into it.\n"); - } - - // Final remarks based on overall results - printf(FOSSIL_TEST_COLOR_BLUE "\nFinal Analysis:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_BLUE "\nAnalysis Results:\n" FOSSIL_TEST_COLOR_RESET); if (env->pass_count > 0) { printf("Success rate: %.2f%%\n", (double)env->pass_count / (env->pass_count + env->fail_count + env->skip_count + env->timeout_count) * 100); } @@ -863,6 +850,7 @@ void fossil_test_summary(fossil_test_env_t *env) { printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + fossil_test_comment(env); // Add comments based on results fossil_test_analyze(env); // Add analysis fossil_test_suggest(env); // Add suggestions From 296b1b321e31644620b9355af0b89523481bf11b Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 12:24:30 -0500 Subject: [PATCH 06/35] Update testing.c --- code/logic/testing.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index c1bd3937..aad59597 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -736,16 +736,22 @@ void fossil_test_comment(fossil_test_env_t *env) { return; } + // Dynamic comment based on test result if (env->pass_count > 0 && env->fail_count == 0 && env->timeout_count == 0) { + // Positive outcome - playful printf(FOSSIL_TEST_COLOR_GREEN "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, great_news_messages[rand() % (sizeof(great_news_messages) / sizeof(great_news_messages[0]))]); } else if (env->fail_count > 0) { + // Failure detected - humorous to lighten the mood printf(FOSSIL_TEST_COLOR_RED "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, humorous_messages[rand() % (sizeof(humorous_messages) / sizeof(humorous_messages[0]))]); } else if (env->timeout_count > 0) { + // Timeout encountered - insightful printf(FOSSIL_TEST_COLOR_ORANGE "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_messages[rand() % (sizeof(timeout_messages) / sizeof(timeout_messages[0]))]); } else if (env->pass_count == 0 && env->fail_count == 0 && env->timeout_count == 0) { + // No results - sarcastic twist printf(FOSSIL_TEST_COLOR_PURPLE "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, sarcastic_messages[rand() % (sizeof(sarcastic_messages) / sizeof(sarcastic_messages[0]))]); } else { - printf(FOSSIL_TEST_COLOR_CYAN "Comment: Test results are mixed. Analyze the results for further insights.\n" FOSSIL_TEST_COLOR_RESET); + // Mixed results - deeper analysis + printf(FOSSIL_TEST_COLOR_CYAN "Comment: The test results are mixed. Consider analyzing individual test cases to uncover underlying issues.\n" FOSSIL_TEST_COLOR_RESET); } } @@ -754,6 +760,7 @@ void fossil_test_analyze(fossil_test_env_t *env) { return; } + // Count assertions and skipped tests int no_assertion_count = 0; int skipped_count = 0; @@ -772,6 +779,7 @@ void fossil_test_analyze(fossil_test_env_t *env) { suite = suite->next; } + // Enhanced analysis with percentages and key insights printf(FOSSIL_TEST_COLOR_BLUE "\nAnalysis Results:\n" FOSSIL_TEST_COLOR_RESET); if (env->pass_count > 0) { printf("Success rate: %.2f%%\n", (double)env->pass_count / (env->pass_count + env->fail_count + env->skip_count + env->timeout_count) * 100); @@ -788,6 +796,11 @@ void fossil_test_analyze(fossil_test_env_t *env) { if (no_assertion_count > 0) { printf("Tests with no assertions: %d\n", no_assertion_count); } + + // Skipped tests analysis route + if (skipped_count > 0) { + printf(FOSSIL_TEST_COLOR_YELLOW "Note: There were %d skipped tests. Please check the conditions or requirements for those tests.\n" FOSSIL_TEST_COLOR_RESET, skipped_count); + } } void fossil_test_suggest(fossil_test_env_t *env) { @@ -795,7 +808,7 @@ void fossil_test_suggest(fossil_test_env_t *env) { return; } - // Suggestions based on results + // Dynamic suggestion based on results and test state if (env->pass_count == 0 && env->fail_count == 0 && env->skip_count == 0 && env->timeout_count == 0 && env->empty_count > 0) { printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 3]); } else if (env->fail_count > 0) { @@ -805,16 +818,17 @@ void fossil_test_suggest(fossil_test_env_t *env) { } else if (env->timeout_count > 0) { printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_suggestions[rand() % 4]); } else if (env->skip_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: Review the skipped tests to ensure they are intentionally excluded or have valid prerequisites.\n" FOSSIL_TEST_COLOR_RESET); + // Skipped tests specific suggestions + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: Review skipped tests for prerequisites or intentional exclusions. Ensure tests are not being skipped due to unmet conditions.\n" FOSSIL_TEST_COLOR_RESET); } } - void fossil_test_summary(fossil_test_env_t *env) { if (!env) { return; } + // Check dry run mode if (env->options.dry_run) { printf(FOSSIL_TEST_COLOR_PURPLE "Dry run mode enabled. No tests were executed or evaluated.\n" FOSSIL_TEST_COLOR_RESET); return; @@ -824,6 +838,7 @@ void fossil_test_summary(fossil_test_env_t *env) { while (suite != NULL) { fossil_test_case_t *test = suite->tests; while (test != NULL) { + // Count test outcomes if (test->status == TEST_STATUS_PASS) { env->pass_count++; } else if (test->status == TEST_STATUS_FAIL) { @@ -843,17 +858,19 @@ void fossil_test_summary(fossil_test_env_t *env) { } suite = suite->next; } + env->end_execution_time = clock(); - // TUI-like header with borders and bold title + // TUI-like header and bold title printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - fossil_test_comment(env); // Add comments based on results - fossil_test_analyze(env); // Add analysis - fossil_test_suggest(env); // Add suggestions + fossil_test_comment(env); // Add comments based on results + fossil_test_analyze(env); // Add analysis of test results + fossil_test_suggest(env); // Add suggestions for improvement + // Test result details with a cleaner format printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tTest Results\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); @@ -863,13 +880,13 @@ void fossil_test_summary(fossil_test_env_t *env) { printf(FOSSIL_TEST_COLOR_CYAN "| Timed Out: %d\n" FOSSIL_TEST_COLOR_RESET, env->timeout_count); printf(FOSSIL_TEST_COLOR_CYAN "| Unexpected: %d\n" FOSSIL_TEST_COLOR_RESET, env->unexpected_count); - // Execution time summary with a clean format + // Enhanced execution time summary with improved formatting double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; int seconds = (int)total_execution_time; int milliseconds = (int)((total_execution_time - seconds) * 1000); int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); - // Footer with TUI-style border + // Footer with execution time printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); 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); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); From a1c407e9b31a6a1e7c877c6784d9fc903022914f Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 12:34:05 -0500 Subject: [PATCH 07/35] Update testing.c --- code/logic/testing.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index aad59597..defd9e90 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -779,20 +779,40 @@ void fossil_test_analyze(fossil_test_env_t *env) { suite = suite->next; } - // Enhanced analysis with percentages and key insights + // Total tests count + int total_tests = env->pass_count + env->fail_count + env->skip_count + env->timeout_count; + + // Calculate success rate and other statistics + double success_rate = (double)env->pass_count / total_tests * 100; + double failure_rate = (double)env->fail_count / total_tests * 100; + double skip_rate = (double)env->skip_count / total_tests * 100; + double timeout_rate = (double)env->timeout_count / total_tests * 100; + + // Sort conditions from worst case to best case: + // 1. Failure Rate -> 2. Timeout Rate -> 3. Skipped Rate -> 4. Success Rate printf(FOSSIL_TEST_COLOR_BLUE "\nAnalysis Results:\n" FOSSIL_TEST_COLOR_RESET); - if (env->pass_count > 0) { - printf("Success rate: %.2f%%\n", (double)env->pass_count / (env->pass_count + env->fail_count + env->skip_count + env->timeout_count) * 100); - } + + // Worst case: Failure rate if (env->fail_count > 0) { - printf("Failure rate: %.2f%%\n", (double)env->fail_count / (env->pass_count + env->fail_count + env->skip_count + env->timeout_count) * 100); - } - if (env->skip_count > 0) { - printf("Skipped tests: %d\n", skipped_count); + printf("Failure rate: %.2f%%\n", failure_rate); } + + // Next worst: Timeout tests if (env->timeout_count > 0) { - printf("Timeout tests: %d\n", env->timeout_count); + printf("Timeout tests: %.2f%%\n", timeout_rate); } + + // Skipped tests next + if (skipped_count > 0) { + printf("Skipped tests: %.2f%% (%d tests)\n", skip_rate, skipped_count); + } + + // Best case: Success rate + if (env->pass_count > 0) { + printf("Success rate: %.2f%%\n", success_rate); + } + + // Additional insights if (no_assertion_count > 0) { printf("Tests with no assertions: %d\n", no_assertion_count); } From 40a831bcdbb0585c9bb818efcf1b77a76ca23563 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 12:38:08 -0500 Subject: [PATCH 08/35] Update testing.c --- code/logic/testing.c | 174 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 166 insertions(+), 8 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index defd9e90..c302f8f1 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -230,7 +230,48 @@ const char *timeout_messages[] = { const char *empty_suite_suggestions[] = { "Check if your test suite has defined tests.", "Make sure your test cases are properly configured.", - "Review the test configuration to ensure it’s correct." + "Review the test configuration to ensure it’s correct.", + "Verify that your test suite is correctly initialized.", + "Check if test scripts are properly linked.", + "Ensure your testing framework is correctly set up.", + "Double-check if your test directories and files are valid.", + "Ensure the tests are compiled correctly.", + "Make sure tests are registered with the test runner.", + "Verify that all necessary modules are loaded for testing.", + "Ensure no tests are excluded or skipped by mistake.", + "Check if you’ve specified the correct test entry points.", + "Review whether your test framework supports the required features.", + "Confirm that all test cases are included in the build process.", + "Verify that no test dependencies are missing.", + "Ensure that all required test resources are available.", + "Check if any testing tools need configuration.", + "Make sure your test suite is executed with the right parameters.", + "Confirm the right environment variables are set for tests.", + "Ensure that tests are properly isolated from the system environment.", + "Check if the tests are being executed in the expected environment.", + "Verify that your test suite hasn’t been inadvertently disabled.", + "Check if your test suite has been corrupted or altered.", + "Make sure your testing environment is up-to-date.", + "Ensure that the test results are being captured correctly.", + "Verify that your testing platform supports your test types.", + "Review if your test framework is up-to-date and compatible.", + "Ensure tests are not being skipped due to unsupported features.", + "Check if you have proper logging or error handling in place.", + "Verify the test output directory is correctly specified.", + "Check if the test suite outputs meaningful logs or results.", + "Ensure that all test dependencies are installed and available.", + "Confirm that your build system includes the necessary test files.", + "Check for any overlooked configuration settings in the test suite.", + "Ensure there are no naming conflicts in the test directory structure.", + "Review your test suite’s memory and resource usage.", + "Verify that tests are not blocked due to missing permissions.", + "Check if tests are running with the required privileges.", + "Make sure your test runner is executing tests in the right order.", + "Ensure the tests don’t require external resources unavailable in the environment.", + "Verify that no steps in your test suite are being skipped inadvertently.", + "Check if there’s a version mismatch between your test framework and environment.", + "Ensure that you have enough logging output to debug your tests.", + "Make sure your test environment matches the production environment closely." }; const char *failure_suggestions[] = { @@ -238,7 +279,45 @@ const char *failure_suggestions[] = { "Check for bugs, missing dependencies, or misconfigured tests.", "Examine the test environment for potential issues.", "Review the test case logic and expected behavior.", - "Consider adding more edge cases to capture hidden bugs." + "Consider adding more edge cases to capture hidden bugs.", + "Check if the failed test cases have valid input data.", + "Verify that the expected output is correct for failed tests.", + "Ensure there are no race conditions in your tests.", + "Review if there are any memory or resource leaks.", + "Double-check the test setup and teardown procedures.", + "Look for dependency issues or configuration mismatches.", + "Verify the test environment matches the expected conditions.", + "Make sure the test dependencies are properly installed and up to date.", + "Check if recent changes have affected the test behavior.", + "Consider increasing the verbosity of your test logs for debugging.", + "Ensure tests are not dependent on unpredictable external factors.", + "Review the error messages and stack traces for more details.", + "Consider running the failed tests in isolation to identify causes.", + "Ensure you’re not testing with outdated or incorrect input data.", + "Check if the failure is due to a logic error in the application.", + "Test the system under a variety of conditions to expose hidden bugs.", + "Try different configurations or platforms to identify the issue.", + "Check the system’s resource usage to ensure it isn’t causing the failure.", + "Verify that the failure doesn’t result from a system or platform limitation.", + "Review recent updates in the codebase that might impact test behavior.", + "Test the specific test case individually and ensure correct behavior.", + "Check for inconsistencies between the test case and actual implementation.", + "Ensure that third-party dependencies are compatible with your tests.", + "Re-examine the test case for edge cases that were missed.", + "Look into whether any time-dependent issues are causing failures.", + "Check if there are any environment-specific issues affecting tests.", + "Test the system with smaller, isolated inputs to identify bugs.", + "Investigate any external resources required for tests to work properly.", + "Try running the test suite on a different platform or environment.", + "Look into possible memory corruption or incorrect memory handling.", + "Check if the test’s timing constraints or limits are too tight.", + "Review error-handling mechanisms to ensure proper feedback.", + "Consider testing with more realistic inputs to simulate real-world behavior.", + "Verify if test failures are isolated or part of a larger systemic issue.", + "Make sure test cases correctly handle different user scenarios.", + "Check if failures are related to thread safety or parallel execution.", + "Consider running tests under various loads to stress the system.", + "Try testing with different versions of dependencies to rule out compatibility issues." }; const char *success_suggestions[] = { @@ -246,14 +325,93 @@ const char *success_suggestions[] = { "Fantastic! Consider adding performance and stress tests.", "Success! Now, look at adding additional tests for edge cases.", "Well done! You’re on the right track, keep it up.", - "Good job! Now, consider reviewing code for possible optimizations." + "Good job! Now, consider reviewing code for possible optimizations.", + "Excellent work! Think about testing with larger input datasets.", + "Well done! Consider testing under load to simulate real-world conditions.", + "Great! Time to refine the code and improve error handling.", + "Nice work! Next, consider checking for potential memory leaks.", + "Awesome! Try adding tests for concurrency and thread safety.", + "Great success! Start testing for edge cases and unexpected inputs.", + "Well done! Ensure tests are comprehensive and cover every possible scenario.", + "Excellent! Look into integrating continuous integration for automated tests.", + "Fantastic job! Start testing the performance of the system under stress.", + "Great work! Keep iterating to improve coverage and test completeness.", + "Awesome! Make sure to run tests in various environments to ensure compatibility.", + "Well done! Try testing with more complex data structures and inputs.", + "Excellent! Don’t forget to add edge cases and potential failure modes.", + "Nice! Keep up the great work and start testing corner cases.", + "Great! Keep building up your test coverage to ensure robust software.", + "Nice! Ensure that your tests cover all relevant code paths.", + "Fantastic! Consider using mock objects to improve test isolation.", + "Awesome! Now look into running automated tests on multiple platforms.", + "Excellent! Test your code under different load conditions for scalability.", + "Great! Review your test output to ensure all cases are covered.", + "Well done! Think about testing for long-term stability and memory usage.", + "Fantastic! Time to start profiling the application’s performance.", + "Nice work! Think about optimizing the system after completing testing.", + "Awesome! Ensure your tests reflect real-world usage patterns.", + "Great! Start testing the system with different network configurations.", + "Nice! Keep up the good work by testing boundary cases for reliability.", + "Excellent! Begin testing different configurations for system flexibility.", + "Fantastic! Add integration tests to ensure different components work together.", + "Great! Consider using fuzz testing to uncover hidden bugs.", + "Well done! Add regression tests to catch issues with new changes.", + "Awesome! Time to start integrating tests with your build pipeline.", + "Excellent! Keep improving your test cases to cover all edge conditions.", + "Nice! Think about automating test execution for faster feedback.", + "Fantastic! Keep testing under high load to ensure stability and performance.", + "Awesome! Consider testing the system's scalability under high traffic.", + "Great! Don’t forget to validate that the system handles all error conditions.", + "Nice! Keep testing in various environments for cross-platform compatibility.", + "Well done! Think about adding security tests for potential vulnerabilities." }; const char *timeout_suggestions[] = { "Check resource usage and adjust timeout values.", "Investigate slow-running tests and optimize them.", "Consider breaking large tests into smaller ones to avoid timeouts.", - "Check for any environmental factors affecting test performance." + "Check for any environmental factors affecting test performance.", + "Consider adjusting the test parameters to reduce execution time.", + "Examine the test case to ensure there are no infinite loops or deadlocks.", + "Look into possible network issues if tests depend on network resources.", + "Consider profiling the test to identify performance bottlenecks.", + "Check if the system is running out of memory or resources during tests.", + "Try running tests with different configurations to pinpoint the cause.", + "Investigate test dependencies to ensure they don’t block execution.", + "Ensure your system is not overloaded with other processes during tests.", + "Look into optimizing algorithms to reduce test execution time.", + "Consider running tests in parallel to speed up overall execution.", + "Check if the system has enough hardware resources to handle tests.", + "Test with smaller data sets to see if the timeout issue persists.", + "Look into reducing unnecessary waits or sleep intervals in the test cases.", + "Check if the timeout values are set appropriately for different test cases.", + "Investigate if any external services are slowing down the tests.", + "Ensure tests are isolated and not dependent on external factors.", + "Consider adjusting the execution environment to improve performance.", + "Make sure tests are not waiting on unnecessary synchronization.", + "Try optimizing your code to avoid long-running operations in tests.", + "Check if there are any operations that can be optimized for speed.", + "Investigate if the timeout is caused by network latency or delays.", + "Ensure that timeout values reflect the actual test execution times.", + "Break tests into smaller chunks to better manage timeouts.", + "Check the system logs for errors or warnings during test execution.", + "Look into improving the algorithmic complexity of long-running tests.", + "Consider adding more logging to track where the test is stalling.", + "Ensure the environment is clean and not affecting test performance.", + "Try testing on a different platform to compare execution times.", + "Look into system-wide performance issues affecting the tests.", + "Test the system under a reduced load to identify performance bottlenecks.", + "Consider adding more granular timeout checks to diagnose issues.", + "Investigate whether background processes are affecting test performance.", + "Test in a more controlled environment to eliminate external influences.", + "Consider using profiling tools to identify long-running sections in the tests.", + "Check if running tests in isolation resolves the timeout issues.", + "Look into optimizing data access patterns in long-running tests.", + "Consider breaking tests into independent smaller tests to improve performance.", + "Investigate if there are unnecessary dependencies in the test cases.", + "Consider using mock data to speed up test execution and avoid delays.", + "Check if large input sizes are contributing to the timeout.", + "Investigate if your timeout limits need adjustment for specific tests." }; enum { @@ -830,13 +988,13 @@ void fossil_test_suggest(fossil_test_env_t *env) { // Dynamic suggestion based on results and test state if (env->pass_count == 0 && env->fail_count == 0 && env->skip_count == 0 && env->timeout_count == 0 && env->empty_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 3]); + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 50]); } else if (env->fail_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, failure_suggestions[rand() % 5]); + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, failure_suggestions[rand() % 50]); } else if (env->pass_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 5]); + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 50]); } else if (env->timeout_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_suggestions[rand() % 4]); + printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_suggestions[rand() % 50]); } else if (env->skip_count > 0) { // Skipped tests specific suggestions printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: Review skipped tests for prerequisites or intentional exclusions. Ensure tests are not being skipped due to unmet conditions.\n" FOSSIL_TEST_COLOR_RESET); From 960bbfcf6f5c41b1ba2d77e2edd0d32751b68f7e Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 12:49:44 -0500 Subject: [PATCH 09/35] Update testing.c --- code/logic/testing.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index c302f8f1..9f528d5c 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -961,7 +961,7 @@ void fossil_test_analyze(fossil_test_env_t *env) { } // Skipped tests next - if (skipped_count > 0) { + if (env->skip_count > 0) { printf("Skipped tests: %.2f%% (%d tests)\n", skip_rate, skipped_count); } @@ -976,7 +976,7 @@ void fossil_test_analyze(fossil_test_env_t *env) { } // Skipped tests analysis route - if (skipped_count > 0) { + if (env->skip_count > 0) { printf(FOSSIL_TEST_COLOR_YELLOW "Note: There were %d skipped tests. Please check the conditions or requirements for those tests.\n" FOSSIL_TEST_COLOR_RESET, skipped_count); } } From 0e2cdbea1b7bda9dc474d6fcadaef0556f28cb5d Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 13:21:12 -0500 Subject: [PATCH 10/35] Update testing.c --- code/logic/testing.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 9f528d5c..3285f887 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -918,19 +918,15 @@ void fossil_test_analyze(fossil_test_env_t *env) { return; } - // Count assertions and skipped tests - int no_assertion_count = 0; - int skipped_count = 0; - fossil_test_suite_t *suite = env->test_suites; while (suite) { fossil_test_case_t *test = suite->tests; while (test) { if (test->status == TEST_STATUS_SKIP) { - skipped_count++; + env->skip_count++; // Increment skipped count directly from env } if (_ASSERT_COUNT == 0) { - no_assertion_count++; + // If no assertions, you can handle logic here if needed, but no longer need a counter } test = test->next; } @@ -941,10 +937,19 @@ void fossil_test_analyze(fossil_test_env_t *env) { int total_tests = env->pass_count + env->fail_count + env->skip_count + env->timeout_count; // Calculate success rate and other statistics - double success_rate = (double)env->pass_count / total_tests * 100; - double failure_rate = (double)env->fail_count / total_tests * 100; - double skip_rate = (double)env->skip_count / total_tests * 100; - double timeout_rate = (double)env->timeout_count / total_tests * 100; + double success_rate = (double)env->pass_count / (double)total_tests * 100; + double failure_rate = (double)env->fail_count / (double)total_tests * 100; + double skip_rate = (double)env->skip_count / (double)total_tests * 100; + double timeout_rate = (double)env->timeout_count / (double)total_tests * 100; + + // Calculate probability (success probability) + double probability_of_success = (double)env->pass_count / total_tests; + + // Calculate average (mean of success, failure, skip, timeout rates) + double average_rate = (success_rate + failure_rate + skip_rate + timeout_rate) / 4.0; + + // Prediction (can be based on past success rate or other methods) + double prediction = success_rate; // For simplicity, using the past success rate as prediction // Sort conditions from worst case to best case: // 1. Failure Rate -> 2. Timeout Rate -> 3. Skipped Rate -> 4. Success Rate @@ -962,7 +967,7 @@ void fossil_test_analyze(fossil_test_env_t *env) { // Skipped tests next if (env->skip_count > 0) { - printf("Skipped tests: %.2f%% (%d tests)\n", skip_rate, skipped_count); + printf("Skipped tests: %.2f%% (%d tests)\n", skip_rate, env->skip_count); } // Best case: Success rate @@ -971,13 +976,13 @@ void fossil_test_analyze(fossil_test_env_t *env) { } // Additional insights - if (no_assertion_count > 0) { - printf("Tests with no assertions: %d\n", no_assertion_count); - } + printf("Probability of success: %.2f\n", probability_of_success); + printf("Average test rate: %.2f%%\n", average_rate); + printf("Prediction (Future Success Rate): %.2f%%\n", prediction); // Skipped tests analysis route if (env->skip_count > 0) { - printf(FOSSIL_TEST_COLOR_YELLOW "Note: There were %d skipped tests. Please check the conditions or requirements for those tests.\n" FOSSIL_TEST_COLOR_RESET, skipped_count); + printf(FOSSIL_TEST_COLOR_YELLOW "Note: There were %d skipped tests. Please check the conditions or requirements for those tests.\n" FOSSIL_TEST_COLOR_RESET, env->skip_count); } } From 9a6fa8403e487f9177eff2fd7632f94cc0cbb7af Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 13:35:50 -0500 Subject: [PATCH 11/35] Update testing.c --- code/logic/testing.c | 74 +++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 21 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 3285f887..8fef66e1 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1006,6 +1006,58 @@ void fossil_test_suggest(fossil_test_env_t *env) { } } +// Function to calculate and provide intelligent insights about execution time +void fossil_test_execution_time(fossil_test_env_t *env) { + if (!env) { + return; + } + + // Calculate the total execution time in seconds + double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; + + // Break it down into individual units + int seconds = (int)total_execution_time; + int milliseconds = (int)((total_execution_time - seconds) * 1000); + int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); + int nanoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); + int picoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); + int femtoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); + + // Print the execution time breakdown + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) fs\n" FOSSIL_TEST_COLOR_RESET, + seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds); + + // Intelligent Insights + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + + // Insights based on total execution time + if (total_execution_time > 1.0) { + printf(FOSSIL_TEST_COLOR_YELLOW "Insight: The test execution time is relatively long. Consider optimizing or parallelizing the tests.\n" FOSSIL_TEST_COLOR_RESET); + } else if (total_execution_time > 0.5) { + printf(FOSSIL_TEST_COLOR_GREEN "Insight: Execution time is moderate. Test parallelization might provide some speedup.\n" FOSSIL_TEST_COLOR_RESET); + } else { + printf(FOSSIL_TEST_COLOR_GREEN "Insight: Execution time is fast. No optimization needed for performance.\n" FOSSIL_TEST_COLOR_RESET); + } + + // Time Anomaly Detection (simple logic for example purposes) + if (total_execution_time > 2.0) { + printf(FOSSIL_TEST_COLOR_RED "Warning: Execution time is unusually long. There may be an anomaly or issue that needs to be investigated.\n" FOSSIL_TEST_COLOR_RESET); + } else if (total_execution_time < 0.1) { + printf(FOSSIL_TEST_COLOR_ORANGE "Warning: Execution time is unexpectedly short. This may indicate incomplete tests or skipped cases.\n" FOSSIL_TEST_COLOR_RESET); + } + + // Trend Prediction (simple heuristic for illustration) + if (env->fail_count > env->pass_count) { + printf(FOSSIL_TEST_COLOR_YELLOW "Prediction: Based on current test failure trends, there may be underlying issues. Review failed tests.\n" FOSSIL_TEST_COLOR_RESET); + } else if (env->pass_count > env->fail_count && total_execution_time < 1.0) { + printf(FOSSIL_TEST_COLOR_GREEN "Prediction: The system seems stable, with a quick execution time and a good pass rate.\n" FOSSIL_TEST_COLOR_RESET); + } + + // Footer with execution time + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); +} + void fossil_test_summary(fossil_test_env_t *env) { if (!env) { return; @@ -1052,25 +1104,5 @@ void fossil_test_summary(fossil_test_env_t *env) { fossil_test_comment(env); // Add comments based on results fossil_test_analyze(env); // Add analysis of test results fossil_test_suggest(env); // Add suggestions for improvement - - // Test result details with a cleaner format - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tTest Results\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN "| Passed: %d\n" FOSSIL_TEST_COLOR_RESET, env->pass_count); - printf(FOSSIL_TEST_COLOR_CYAN "| Failed: %d\n" FOSSIL_TEST_COLOR_RESET, env->fail_count); - printf(FOSSIL_TEST_COLOR_CYAN "| Skipped: %d\n" FOSSIL_TEST_COLOR_RESET, env->skip_count); - printf(FOSSIL_TEST_COLOR_CYAN "| Timed Out: %d\n" FOSSIL_TEST_COLOR_RESET, env->timeout_count); - printf(FOSSIL_TEST_COLOR_CYAN "| Unexpected: %d\n" FOSSIL_TEST_COLOR_RESET, env->unexpected_count); - - // Enhanced execution time summary with improved formatting - double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; - int seconds = (int)total_execution_time; - int milliseconds = (int)((total_execution_time - seconds) * 1000); - int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); - - // Footer with execution time - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - 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); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + fossil_test_execution_time(env); } From b2aa35a2b984d9cefcc98c52187a0af309ff93a5 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:07:25 -0500 Subject: [PATCH 12/35] Update testing.c --- code/logic/testing.c | 51 +++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 8fef66e1..caacad29 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1007,6 +1007,7 @@ void fossil_test_suggest(fossil_test_env_t *env) { } // Function to calculate and provide intelligent insights about execution time +// Function to calculate and provide AI-driven insights and predictions based on execution time void fossil_test_execution_time(fossil_test_env_t *env) { if (!env) { return; @@ -1015,7 +1016,7 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Calculate the total execution time in seconds double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; - // Break it down into individual units + // Breakdown into smaller units of time int seconds = (int)total_execution_time; int milliseconds = (int)((total_execution_time - seconds) * 1000); int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); @@ -1023,38 +1024,44 @@ void fossil_test_execution_time(fossil_test_env_t *env) { int picoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); int femtoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); - // Print the execution time breakdown + // Enhanced insights based on execution time printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) fs\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds); - // Intelligent Insights + // AI-driven insights and predictions printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - // Insights based on total execution time - if (total_execution_time > 1.0) { - printf(FOSSIL_TEST_COLOR_YELLOW "Insight: The test execution time is relatively long. Consider optimizing or parallelizing the tests.\n" FOSSIL_TEST_COLOR_RESET); - } else if (total_execution_time > 0.5) { - printf(FOSSIL_TEST_COLOR_GREEN "Insight: Execution time is moderate. Test parallelization might provide some speedup.\n" FOSSIL_TEST_COLOR_RESET); - } else { - printf(FOSSIL_TEST_COLOR_GREEN "Insight: Execution time is fast. No optimization needed for performance.\n" FOSSIL_TEST_COLOR_RESET); + // Anomaly Detection & Optimization Insight + if (total_execution_time > 2.0) { + printf(FOSSIL_TEST_COLOR_RED "Warning: Execution time is unusually long. The test suite may need optimization or better parallelization.\n" FOSSIL_TEST_COLOR_RESET); + } else if (total_execution_time < 0.5) { + printf(FOSSIL_TEST_COLOR_ORANGE "Warning: Execution time is abnormally short. Ensure that no tests were skipped or incorrectly executed.\n" FOSSIL_TEST_COLOR_RESET); } - // Time Anomaly Detection (simple logic for example purposes) - if (total_execution_time > 2.0) { - printf(FOSSIL_TEST_COLOR_RED "Warning: Execution time is unusually long. There may be an anomaly or issue that needs to be investigated.\n" FOSSIL_TEST_COLOR_RESET); - } else if (total_execution_time < 0.1) { - printf(FOSSIL_TEST_COLOR_ORANGE "Warning: Execution time is unexpectedly short. This may indicate incomplete tests or skipped cases.\n" FOSSIL_TEST_COLOR_RESET); + // Predictive Analysis Based on Execution Time Trends (simple heuristic) + if (total_execution_time > 1.5 && env->fail_count > env->pass_count) { + printf(FOSSIL_TEST_COLOR_YELLOW "Prediction: Long execution times combined with a higher failure count may indicate a growing problem in test stability.\n" FOSSIL_TEST_COLOR_RESET); + } else if (total_execution_time < 0.5 && env->pass_count > env->fail_count) { + printf(FOSSIL_TEST_COLOR_GREEN "Prediction: Short execution time with high success rate suggests stable and efficient tests.\n" FOSSIL_TEST_COLOR_RESET); } - // Trend Prediction (simple heuristic for illustration) - if (env->fail_count > env->pass_count) { - printf(FOSSIL_TEST_COLOR_YELLOW "Prediction: Based on current test failure trends, there may be underlying issues. Review failed tests.\n" FOSSIL_TEST_COLOR_RESET); - } else if (env->pass_count > env->fail_count && total_execution_time < 1.0) { - printf(FOSSIL_TEST_COLOR_GREEN "Prediction: The system seems stable, with a quick execution time and a good pass rate.\n" FOSSIL_TEST_COLOR_RESET); + // Repurpose time values to predict future performance trends + double time_factor = total_execution_time * 1000; // Arbitrary scaling for future prediction + if (time_factor > 1000.0) { + printf(FOSSIL_TEST_COLOR_YELLOW "Prediction: Based on execution time, future tests may take longer if the current performance trend continues. Consider investigating bottlenecks.\n" FOSSIL_TEST_COLOR_RESET); + } else if (time_factor < 100.0) { + printf(FOSSIL_TEST_COLOR_GREEN "Prediction: If this performance trend continues, future tests should remain fast and stable.\n" FOSSIL_TEST_COLOR_RESET); } - - // Footer with execution time + + // Test quality prediction based on execution time and pass rate + if (env->pass_count > env->fail_count && total_execution_time < 1.0) { + printf(FOSSIL_TEST_COLOR_GREEN "Prediction: The system appears stable with a good pass rate and short execution time.\n" FOSSIL_TEST_COLOR_RESET); + } else if (env->fail_count > env->pass_count && total_execution_time > 1.0) { + printf(FOSSIL_TEST_COLOR_RED "Prediction: The system might be facing growing issues, as there are more failures combined with longer execution time.\n" FOSSIL_TEST_COLOR_RESET); + } + + // Footer printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); } From bd1c4c55111f1bbf9942a4df8313894bcf64eb3a Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:44:17 -0500 Subject: [PATCH 13/35] Update testing.c --- code/logic/testing.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index caacad29..fccd494d 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1006,7 +1006,6 @@ void fossil_test_suggest(fossil_test_env_t *env) { } } -// Function to calculate and provide intelligent insights about execution time // Function to calculate and provide AI-driven insights and predictions based on execution time void fossil_test_execution_time(fossil_test_env_t *env) { if (!env) { @@ -1023,45 +1022,48 @@ void fossil_test_execution_time(fossil_test_env_t *env) { int nanoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); int picoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); int femtoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); + int attoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); + int zeptoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0) * 1000000000000000000000); + int yoktoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0 - zeptoseconds / 1000000000000000000000.0) * 1000000000000000000000000); - // Enhanced insights based on execution time - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) fs\n" FOSSIL_TEST_COLOR_RESET, - seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds); - - // AI-driven insights and predictions + // Start the output paragraph for insights printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Insight: Based on the execution time analysis, we observe the following:\n" FOSSIL_TEST_COLOR_RESET); // Anomaly Detection & Optimization Insight if (total_execution_time > 2.0) { - printf(FOSSIL_TEST_COLOR_RED "Warning: Execution time is unusually long. The test suite may need optimization or better parallelization.\n" FOSSIL_TEST_COLOR_RESET); + printf("Execution time is unusually long, suggesting potential bottlenecks or inefficiencies in the test suite. Optimization strategies, such as test parallelization or resource allocation adjustments, could help reduce time consumption.\n"); } else if (total_execution_time < 0.5) { - printf(FOSSIL_TEST_COLOR_ORANGE "Warning: Execution time is abnormally short. Ensure that no tests were skipped or incorrectly executed.\n" FOSSIL_TEST_COLOR_RESET); + printf("Execution time is abnormally short, which might indicate skipped tests or a misconfiguration in the test environment. Ensure that tests are properly executed without skipping critical scenarios.\n"); } // Predictive Analysis Based on Execution Time Trends (simple heuristic) if (total_execution_time > 1.5 && env->fail_count > env->pass_count) { - printf(FOSSIL_TEST_COLOR_YELLOW "Prediction: Long execution times combined with a higher failure count may indicate a growing problem in test stability.\n" FOSSIL_TEST_COLOR_RESET); + printf("Prediction: The longer execution times combined with a higher failure count may indicate growing issues in test stability, possibly due to flaky tests or insufficient resource allocation.\n"); } else if (total_execution_time < 0.5 && env->pass_count > env->fail_count) { - printf(FOSSIL_TEST_COLOR_GREEN "Prediction: Short execution time with high success rate suggests stable and efficient tests.\n" FOSSIL_TEST_COLOR_RESET); + printf("Prediction: Short execution times with a high success rate indicate that tests are efficient and stable, suggesting that the testing environment is optimal and well-configured.\n"); } // Repurpose time values to predict future performance trends double time_factor = total_execution_time * 1000; // Arbitrary scaling for future prediction if (time_factor > 1000.0) { - printf(FOSSIL_TEST_COLOR_YELLOW "Prediction: Based on execution time, future tests may take longer if the current performance trend continues. Consider investigating bottlenecks.\n" FOSSIL_TEST_COLOR_RESET); + printf("Prediction: Given the current performance, future tests may take longer unless performance bottlenecks are addressed. Consider optimizing resource usage or revising test strategies.\n"); } else if (time_factor < 100.0) { - printf(FOSSIL_TEST_COLOR_GREEN "Prediction: If this performance trend continues, future tests should remain fast and stable.\n" FOSSIL_TEST_COLOR_RESET); + printf("Prediction: If the current trend holds, future tests will likely remain fast and stable, with minimal risk of performance degradation.\n"); } // Test quality prediction based on execution time and pass rate if (env->pass_count > env->fail_count && total_execution_time < 1.0) { - printf(FOSSIL_TEST_COLOR_GREEN "Prediction: The system appears stable with a good pass rate and short execution time.\n" FOSSIL_TEST_COLOR_RESET); + printf("Prediction: The system is performing well with a high pass rate and short execution time, indicating good test quality and efficiency.\n"); } else if (env->fail_count > env->pass_count && total_execution_time > 1.0) { - printf(FOSSIL_TEST_COLOR_RED "Prediction: The system might be facing growing issues, as there are more failures combined with longer execution time.\n" FOSSIL_TEST_COLOR_RESET); + printf("Prediction: The combination of longer execution time and a higher failure rate suggests potential issues with test reliability and stability that need to be addressed.\n"); } - // Footer + // Footer and execution time display + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Execution time breakdown:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) as, (%018d) zs, (%021d) ys\n" FOSSIL_TEST_COLOR_RESET, + seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds, zeptoseconds, yoktoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); } From 96a14c3116399b58f66706f35993ab745e0de9e5 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:48:17 -0500 Subject: [PATCH 14/35] Update testing.c --- code/logic/testing.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index fccd494d..ef37b068 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1016,15 +1016,15 @@ void fossil_test_execution_time(fossil_test_env_t *env) { double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; // Breakdown into smaller units of time - int seconds = (int)total_execution_time; - int milliseconds = (int)((total_execution_time - seconds) * 1000); - int microseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); - int nanoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); - int picoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); - int femtoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); - int attoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); - int zeptoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0) * 1000000000000000000000); - int yoktoseconds = (int)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0 - zeptoseconds / 1000000000000000000000.0) * 1000000000000000000000000); + int32_t seconds = (int32_t)total_execution_time; + int32_t milliseconds = (int32_t)((total_execution_time - seconds) * 1000); + int32_t microseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); + int32_t nanoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); + int32_t picoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); + int32_t femtoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); + int32_t attoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); + int32_t zeptoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0) * 1000000000000000000000); + int32_t yoktoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0 - zeptoseconds / 1000000000000000000000.0) * 1000000000000000000000000); // Start the output paragraph for insights printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); From dafed6b21c0f03266dd2ca04a855d61235b1a30c Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:52:13 -0500 Subject: [PATCH 15/35] Update testing.c --- code/logic/testing.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index ef37b068..5593fc6e 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1024,7 +1024,6 @@ void fossil_test_execution_time(fossil_test_env_t *env) { int32_t femtoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); int32_t attoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); int32_t zeptoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0) * 1000000000000000000000); - int32_t yoktoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0 - zeptoseconds / 1000000000000000000000.0) * 1000000000000000000000000); // Start the output paragraph for insights printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); @@ -1062,8 +1061,8 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Execution time breakdown:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) as, (%018d) zs, (%021d) ys\n" FOSSIL_TEST_COLOR_RESET, - seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds, zeptoseconds, yoktoseconds); + printf(FOSSIL_TEST_COLOR_CYAN "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) as, (%018d) zs\n" FOSSIL_TEST_COLOR_RESET, + seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds, zeptoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); } From ae7dede9859d7bcc2476a8f4faa8ba356e748d17 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:54:57 -0500 Subject: [PATCH 16/35] Update testing.c --- code/logic/testing.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 5593fc6e..c02b2c4c 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1023,7 +1023,6 @@ void fossil_test_execution_time(fossil_test_env_t *env) { int32_t picoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); int32_t femtoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); int32_t attoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); - int32_t zeptoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0 - attoseconds / 1000000000000000000.0) * 1000000000000000000000); // Start the output paragraph for insights printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); @@ -1061,8 +1060,8 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Execution time breakdown:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) as, (%018d) zs\n" FOSSIL_TEST_COLOR_RESET, - seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds, zeptoseconds); + printf(FOSSIL_TEST_COLOR_CYAN "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) as\n" FOSSIL_TEST_COLOR_RESET, + seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); } From 72cb474cf0bfdfe9c9fb8a3a744ef823fbab2ed9 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 14:58:41 -0500 Subject: [PATCH 17/35] Update testing.c --- code/logic/testing.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index c02b2c4c..ada6a8e7 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1016,13 +1016,13 @@ void fossil_test_execution_time(fossil_test_env_t *env) { double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; // Breakdown into smaller units of time - int32_t seconds = (int32_t)total_execution_time; - int32_t milliseconds = (int32_t)((total_execution_time - seconds) * 1000); - int32_t microseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); - int32_t nanoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); - int32_t picoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); - int32_t femtoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); - int32_t attoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); + int64_t seconds = (int64_t)total_execution_time; + int64_t milliseconds = (int64_t)((total_execution_time - seconds) * 1000); + int64_t microseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); + int64_t nanoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); + int64_t picoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); + int64_t femtoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); + int64_t attoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); // Start the output paragraph for insights printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); From 9a2db85e71e965ff5df89a1ffb91380052ef41d7 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 15:18:49 -0500 Subject: [PATCH 18/35] Update testing.c --- code/logic/testing.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index ada6a8e7..15f17686 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1059,9 +1059,8 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Execution time breakdown:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN "Execution time: (%02d) sec, (%03d) ms, (%06d) µs, (%09d) ns, (%012d) ps, (%015d) as\n" FOSSIL_TEST_COLOR_RESET, - seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tBreakdown time:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tExecution time: (%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns, (%012lld) ps, (%015lld) as\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); } From fd94a9a2cde3641be51f8afb06cfe5339d358687 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 15:38:53 -0500 Subject: [PATCH 19/35] Update testing.c --- code/logic/testing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 15f17686..97cb222c 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1060,7 +1060,7 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tBreakdown time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tExecution time: (%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns, (%012lld) ps, (%015lld) as\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tExecution time: (%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns, (%012lld) ps, (%015lld) as, (%064lld) zs\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); } From dbd25cdbd370cc2121d930a43471956ae0de3313 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 15:52:25 -0500 Subject: [PATCH 20/35] Update testing.c --- code/logic/testing.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 97cb222c..714a868a 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1021,11 +1021,9 @@ void fossil_test_execution_time(fossil_test_env_t *env) { int64_t microseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); int64_t nanoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); int64_t picoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); - int64_t femtoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0) * 1000000000000000); - int64_t attoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0 - picoseconds / 1000000000000.0 - femtoseconds / 1000000000000000.0) * 1000000000000000000); // Start the output paragraph for insights - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Insight: Based on the execution time analysis, we observe the following:\n" FOSSIL_TEST_COLOR_RESET); // Anomaly Detection & Optimization Insight @@ -1037,31 +1035,31 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Predictive Analysis Based on Execution Time Trends (simple heuristic) if (total_execution_time > 1.5 && env->fail_count > env->pass_count) { - printf("Prediction: The longer execution times combined with a higher failure count may indicate growing issues in test stability, possibly due to flaky tests or insufficient resource allocation.\n"); + printf("The longer execution times combined with a higher failure count may indicate growing issues in test stability, possibly due to flaky tests or insufficient resource allocation.\n"); } else if (total_execution_time < 0.5 && env->pass_count > env->fail_count) { - printf("Prediction: Short execution times with a high success rate indicate that tests are efficient and stable, suggesting that the testing environment is optimal and well-configured.\n"); + printf("Short execution times with a high success rate indicate that tests are efficient and stable, suggesting that the testing environment is optimal and well-configured.\n"); } // Repurpose time values to predict future performance trends double time_factor = total_execution_time * 1000; // Arbitrary scaling for future prediction if (time_factor > 1000.0) { - printf("Prediction: Given the current performance, future tests may take longer unless performance bottlenecks are addressed. Consider optimizing resource usage or revising test strategies.\n"); + printf("Given the current performance, future tests may take longer unless performance bottlenecks are addressed. Consider optimizing resource usage or revising test strategies.\n"); } else if (time_factor < 100.0) { - printf("Prediction: If the current trend holds, future tests will likely remain fast and stable, with minimal risk of performance degradation.\n"); + printf("If the current trend holds, future tests will likely remain fast and stable, with minimal risk of performance degradation.\n"); } // Test quality prediction based on execution time and pass rate if (env->pass_count > env->fail_count && total_execution_time < 1.0) { - printf("Prediction: The system is performing well with a high pass rate and short execution time, indicating good test quality and efficiency.\n"); + printf("The system is performing well with a high pass rate and short execution time, indicating good test quality and efficiency.\n"); } else if (env->fail_count > env->pass_count && total_execution_time > 1.0) { - printf("Prediction: The combination of longer execution time and a higher failure rate suggests potential issues with test reliability and stability that need to be addressed.\n"); + printf("The combination of longer execution time and a higher failure rate suggests potential issues with test reliability and stability that need to be addressed.\n"); } // Footer and execution time display - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tBreakdown time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tExecution time: (%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns, (%012lld) ps, (%015lld) as, (%064lld) zs\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tExecution time: (%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns, (%012lld) ps\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds, picoseconds); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); } void fossil_test_summary(fossil_test_env_t *env) { @@ -1103,9 +1101,9 @@ void fossil_test_summary(fossil_test_env_t *env) { env->end_execution_time = clock(); // TUI-like header and bold title - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==============================================================\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); fossil_test_comment(env); // Add comments based on results fossil_test_analyze(env); // Add analysis of test results From d044e9b3dea43791e144a928c1a838bf8b653d36 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:10:42 -0500 Subject: [PATCH 21/35] Update testing.c --- code/logic/testing.c | 89 +++++++++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 25 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 714a868a..d6bef65a 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1012,53 +1012,92 @@ void fossil_test_execution_time(fossil_test_env_t *env) { return; } - // Calculate the total execution time in seconds + // Calculate total execution time in seconds double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; - // Breakdown into smaller units of time + // Breakdown into smaller units int64_t seconds = (int64_t)total_execution_time; int64_t milliseconds = (int64_t)((total_execution_time - seconds) * 1000); int64_t microseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); int64_t nanoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); - int64_t picoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0 - nanoseconds / 1000000000.0) * 1000000000000); // Start the output paragraph for insights printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Insight: Based on the execution time analysis, we observe the following:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tInsight: Based on the execution time analysis, we observe the following:\n" FOSSIL_TEST_COLOR_RESET); // Anomaly Detection & Optimization Insight - if (total_execution_time > 2.0) { - printf("Execution time is unusually long, suggesting potential bottlenecks or inefficiencies in the test suite. Optimization strategies, such as test parallelization or resource allocation adjustments, could help reduce time consumption.\n"); - } else if (total_execution_time < 0.5) { - printf("Execution time is abnormally short, which might indicate skipped tests or a misconfiguration in the test environment. Ensure that tests are properly executed without skipping critical scenarios.\n"); + if (total_execution_time > 5.0) { + printf( + "Execution time is exceptionally long, indicating possible critical\n" + "inefficiencies, extensive test coverage, or hardware constraints.\n" + "Investigate parallel execution strategies, resource bottlenecks, or\n" + "excessive test dependencies. Consider breaking test suites into smaller\n" + "units to isolate performance-heavy areas.\n" + ); + } else if (total_execution_time > 2.0) { + printf( + "Execution time is unusually long, suggesting potential bottlenecks\n" + "or inefficiencies in the test suite. Optimization strategies, such as\n" + "test parallelization or resource allocation adjustments, could help\n" + "reduce time consumption.\n" + ); + } else if (total_execution_time < 0.2) { + printf( + "Execution time is abnormally short. This could mean tests were\n" + "skipped or misconfigured. Ensure full test coverage is executed and\n" + "no critical paths are being inadvertently bypassed in the\n" + "environment.\n" + ); } - // Predictive Analysis Based on Execution Time Trends (simple heuristic) - if (total_execution_time > 1.5 && env->fail_count > env->pass_count) { - printf("The longer execution times combined with a higher failure count may indicate growing issues in test stability, possibly due to flaky tests or insufficient resource allocation.\n"); + // Predictive Analysis Based on Execution Time Trends + if (total_execution_time > 2.5 && env->fail_count > env->pass_count) { + printf( + "Long execution times combined with a high failure rate suggest\n" + "instability, possibly due to flaky tests, unhandled race conditions,\n" + "or poor resource management. Analyze test patterns and stabilize\n" + "critical areas.\n" + ); } else if (total_execution_time < 0.5 && env->pass_count > env->fail_count) { - printf("Short execution times with a high success rate indicate that tests are efficient and stable, suggesting that the testing environment is optimal and well-configured.\n"); + printf( + "Fast execution times with a high pass rate indicate robust,\n" + "efficient testing. Maintain current strategies, but continue\n" + "monitoring to detect subtle regressions early in the pipeline.\n" + ); + } else if (env->pass_count == 0 && env->fail_count == 0) { + printf( + "No valid results recorded. This suggests an environment failure or\n" + "skipped execution. Confirm initialization, test registration, and\n" + "execution flows are working as intended without suppression or\n" + "misconfiguration.\n" + ); } - // Repurpose time values to predict future performance trends - double time_factor = total_execution_time * 1000; // Arbitrary scaling for future prediction - if (time_factor > 1000.0) { - printf("Given the current performance, future tests may take longer unless performance bottlenecks are addressed. Consider optimizing resource usage or revising test strategies.\n"); - } else if (time_factor < 100.0) { - printf("If the current trend holds, future tests will likely remain fast and stable, with minimal risk of performance degradation.\n"); - } - - // Test quality prediction based on execution time and pass rate + // Test Quality Prediction Based on Results and Timing if (env->pass_count > env->fail_count && total_execution_time < 1.0) { - printf("The system is performing well with a high pass rate and short execution time, indicating good test quality and efficiency.\n"); + printf( + "High test pass rate and low execution time indicate strong test\n" + "quality and efficient implementation. Continue leveraging modular,\n" + "independent test cases and assert coverage tracking.\n" + ); } else if (env->fail_count > env->pass_count && total_execution_time > 1.0) { - printf("The combination of longer execution time and a higher failure rate suggests potential issues with test reliability and stability that need to be addressed.\n"); + printf( + "Low test success and long runtime indicate potential architectural or\n" + "logical issues. Debug logs, tracing, and fine-grained profiling are\n" + "recommended for pinpointing instability sources.\n" + ); + } else if (env->fail_count == env->pass_count && total_execution_time > 1.5) { + printf( + "Even pass/fail distribution with extended execution suggests\n" + "non-determinism or edge cases dominating test coverage. Investigate\n" + "timing variability and data-sensitive behaviors.\n" + ); } // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tBreakdown time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tExecution time: (%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns, (%012lld) ps\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds, picoseconds); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\t(%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); } From 7a8ff3553467f82a4c173a9c794cccffffd935a8 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:17:46 -0500 Subject: [PATCH 22/35] Update testing.c --- code/logic/testing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index d6bef65a..fa0361dd 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1097,7 +1097,7 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\t(%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns\n" FOSSIL_TEST_COLOR_RESET, seconds, milliseconds, microseconds, nanoseconds); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\t(%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns\n" FOSSIL_TEST_COLOR_RESET, (int64_t)seconds, (int64_t)milliseconds, (int64_t)microseconds, (int64_t)nanoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); } From e70822b2191f93780a40cbd2fbe58201676f786a Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:27:50 -0500 Subject: [PATCH 23/35] Update testing.c --- code/logic/testing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index fa0361dd..890a32aa 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1097,7 +1097,7 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\t(%02lld) sec, (%03lld) ms, (%06lld) us, (%09lld) ns\n" FOSSIL_TEST_COLOR_RESET, (int64_t)seconds, (int64_t)milliseconds, (int64_t)microseconds, (int64_t)nanoseconds); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\t(%02ld) sec, (%03ld) ms, (%06ld) us, (%09ld) ns\n" FOSSIL_TEST_COLOR_RESET, (int64_t)seconds, (int64_t)milliseconds, (int64_t)microseconds, (int64_t)nanoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); } From d013166e9fe072bd62036c58a4154ca81ca64e8c Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:39:13 -0500 Subject: [PATCH 24/35] Update testing.c --- code/logic/testing.c | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 890a32aa..65c29757 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1016,10 +1016,10 @@ void fossil_test_execution_time(fossil_test_env_t *env) { double total_execution_time = (double)(env->end_execution_time - env->start_execution_time) / CLOCKS_PER_SEC; // Breakdown into smaller units - int64_t seconds = (int64_t)total_execution_time; - int64_t milliseconds = (int64_t)((total_execution_time - seconds) * 1000); - int64_t microseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); - int64_t nanoseconds = (int64_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); + int32_t seconds = (int32_t)total_execution_time; + int32_t milliseconds = (int32_t)((total_execution_time - seconds) * 1000); + int32_t microseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0) * 1000000); + int32_t nanoseconds = (int32_t)((total_execution_time - seconds - milliseconds / 1000.0 - microseconds / 1000000.0) * 1000000000); // Start the output paragraph for insights printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); @@ -1027,77 +1027,77 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Anomaly Detection & Optimization Insight if (total_execution_time > 5.0) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "Execution time is exceptionally long, indicating possible critical\n" "inefficiencies, extensive test coverage, or hardware constraints.\n" "Investigate parallel execution strategies, resource bottlenecks, or\n" "excessive test dependencies. Consider breaking test suites into smaller\n" - "units to isolate performance-heavy areas.\n" + "units to isolate performance-heavy areas.\n" FOSSIL_TEST_COLOR_RESET ); } else if (total_execution_time > 2.0) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "Execution time is unusually long, suggesting potential bottlenecks\n" "or inefficiencies in the test suite. Optimization strategies, such as\n" "test parallelization or resource allocation adjustments, could help\n" - "reduce time consumption.\n" + "reduce time consumption.\n" FOSSIL_TEST_COLOR_RESET ); } else if (total_execution_time < 0.2) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "Execution time is abnormally short. This could mean tests were\n" "skipped or misconfigured. Ensure full test coverage is executed and\n" "no critical paths are being inadvertently bypassed in the\n" - "environment.\n" + "environment.\n" FOSSIL_TEST_COLOR_RESET ); } // Predictive Analysis Based on Execution Time Trends if (total_execution_time > 2.5 && env->fail_count > env->pass_count) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "Long execution times combined with a high failure rate suggest\n" "instability, possibly due to flaky tests, unhandled race conditions,\n" "or poor resource management. Analyze test patterns and stabilize\n" - "critical areas.\n" + "critical areas.\n" FOSSIL_TEST_COLOR_RESET ); } else if (total_execution_time < 0.5 && env->pass_count > env->fail_count) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "Fast execution times with a high pass rate indicate robust,\n" "efficient testing. Maintain current strategies, but continue\n" - "monitoring to detect subtle regressions early in the pipeline.\n" + "monitoring to detect subtle regressions early in the pipeline.\n" FOSSIL_TEST_COLOR_RESET ); } else if (env->pass_count == 0 && env->fail_count == 0) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "No valid results recorded. This suggests an environment failure or\n" "skipped execution. Confirm initialization, test registration, and\n" "execution flows are working as intended without suppression or\n" - "misconfiguration.\n" + "misconfiguration.\n" FOSSIL_TEST_COLOR_RESET ); } // Test Quality Prediction Based on Results and Timing if (env->pass_count > env->fail_count && total_execution_time < 1.0) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "High test pass rate and low execution time indicate strong test\n" "quality and efficient implementation. Continue leveraging modular,\n" - "independent test cases and assert coverage tracking.\n" + "independent test cases and assert coverage tracking.\n" FOSSIL_TEST_COLOR_RESET ); } else if (env->fail_count > env->pass_count && total_execution_time > 1.0) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "Low test success and long runtime indicate potential architectural or\n" "logical issues. Debug logs, tracing, and fine-grained profiling are\n" - "recommended for pinpointing instability sources.\n" + "recommended for pinpointing instability sources.\n" FOSSIL_TEST_COLOR_RESET ); } else if (env->fail_count == env->pass_count && total_execution_time > 1.5) { - printf( + printf(FOSSIL_TEST_COLOR_CYAN "Even pass/fail distribution with extended execution suggests\n" "non-determinism or edge cases dominating test coverage. Investigate\n" - "timing variability and data-sensitive behaviors.\n" + "timing variability and data-sensitive behaviors.\n" FOSSIL_TEST_COLOR_RESET ); } // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\t(%02ld) sec, (%03ld) ms, (%06ld) us, (%09ld) ns\n" FOSSIL_TEST_COLOR_RESET, (int64_t)seconds, (int64_t)milliseconds, (int64_t)microseconds, (int64_t)nanoseconds); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_ITALIC "|\t(%02ld) sec, (%03ld) ms, (%06ld) us, (%09ld) ns\n" FOSSIL_TEST_COLOR_RESET, (int32_t)seconds, (int32_t)milliseconds, (int32_t)microseconds, (int32_t)nanoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); } @@ -1141,7 +1141,7 @@ void fossil_test_summary(fossil_test_env_t *env) { // TUI-like header and bold title printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); fossil_test_comment(env); // Add comments based on results From 70a0313ba06966cd9da1dc842681f45500f3e2c2 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:50:33 -0500 Subject: [PATCH 25/35] Update testing.c --- code/logic/testing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 65c29757..ca2676ac 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1097,7 +1097,7 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_ITALIC "|\t(%02ld) sec, (%03ld) ms, (%06ld) us, (%09ld) ns\n" FOSSIL_TEST_COLOR_RESET, (int32_t)seconds, (int32_t)milliseconds, (int32_t)microseconds, (int32_t)nanoseconds); + printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_ITALIC "|\t(%02d) sec, (%03d) ms, (%06d) us, (%09d) ns\n" FOSSIL_TEST_COLOR_RESET, (int32_t)seconds, (int32_t)milliseconds, (int32_t)microseconds, (int32_t)nanoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); } From c862809daf2fcf89980b31c7a226ca745a156775 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:57:37 -0500 Subject: [PATCH 26/35] Update testing.c --- code/logic/testing.c | 56 +++++--------------------------------------- 1 file changed, 6 insertions(+), 50 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index ca2676ac..0a5c364f 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -1027,70 +1027,26 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Anomaly Detection & Optimization Insight if (total_execution_time > 5.0) { - printf(FOSSIL_TEST_COLOR_CYAN + printf( "Execution time is exceptionally long, indicating possible critical\n" "inefficiencies, extensive test coverage, or hardware constraints.\n" "Investigate parallel execution strategies, resource bottlenecks, or\n" "excessive test dependencies. Consider breaking test suites into smaller\n" - "units to isolate performance-heavy areas.\n" FOSSIL_TEST_COLOR_RESET + "units to isolate performance-heavy areas.\n" ); } else if (total_execution_time > 2.0) { - printf(FOSSIL_TEST_COLOR_CYAN + printf( "Execution time is unusually long, suggesting potential bottlenecks\n" "or inefficiencies in the test suite. Optimization strategies, such as\n" "test parallelization or resource allocation adjustments, could help\n" - "reduce time consumption.\n" FOSSIL_TEST_COLOR_RESET + "reduce time consumption.\n" ); } else if (total_execution_time < 0.2) { - printf(FOSSIL_TEST_COLOR_CYAN + printf( "Execution time is abnormally short. This could mean tests were\n" "skipped or misconfigured. Ensure full test coverage is executed and\n" "no critical paths are being inadvertently bypassed in the\n" - "environment.\n" FOSSIL_TEST_COLOR_RESET - ); - } - - // Predictive Analysis Based on Execution Time Trends - if (total_execution_time > 2.5 && env->fail_count > env->pass_count) { - printf(FOSSIL_TEST_COLOR_CYAN - "Long execution times combined with a high failure rate suggest\n" - "instability, possibly due to flaky tests, unhandled race conditions,\n" - "or poor resource management. Analyze test patterns and stabilize\n" - "critical areas.\n" FOSSIL_TEST_COLOR_RESET - ); - } else if (total_execution_time < 0.5 && env->pass_count > env->fail_count) { - printf(FOSSIL_TEST_COLOR_CYAN - "Fast execution times with a high pass rate indicate robust,\n" - "efficient testing. Maintain current strategies, but continue\n" - "monitoring to detect subtle regressions early in the pipeline.\n" FOSSIL_TEST_COLOR_RESET - ); - } else if (env->pass_count == 0 && env->fail_count == 0) { - printf(FOSSIL_TEST_COLOR_CYAN - "No valid results recorded. This suggests an environment failure or\n" - "skipped execution. Confirm initialization, test registration, and\n" - "execution flows are working as intended without suppression or\n" - "misconfiguration.\n" FOSSIL_TEST_COLOR_RESET - ); - } - - // Test Quality Prediction Based on Results and Timing - if (env->pass_count > env->fail_count && total_execution_time < 1.0) { - printf(FOSSIL_TEST_COLOR_CYAN - "High test pass rate and low execution time indicate strong test\n" - "quality and efficient implementation. Continue leveraging modular,\n" - "independent test cases and assert coverage tracking.\n" FOSSIL_TEST_COLOR_RESET - ); - } else if (env->fail_count > env->pass_count && total_execution_time > 1.0) { - printf(FOSSIL_TEST_COLOR_CYAN - "Low test success and long runtime indicate potential architectural or\n" - "logical issues. Debug logs, tracing, and fine-grained profiling are\n" - "recommended for pinpointing instability sources.\n" FOSSIL_TEST_COLOR_RESET - ); - } else if (env->fail_count == env->pass_count && total_execution_time > 1.5) { - printf(FOSSIL_TEST_COLOR_CYAN - "Even pass/fail distribution with extended execution suggests\n" - "non-determinism or edge cases dominating test coverage. Investigate\n" - "timing variability and data-sensitive behaviors.\n" FOSSIL_TEST_COLOR_RESET + "environment.\n" ); } From 97f269de68a9499946f34f0edd657d797fd396d8 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:22:23 -0500 Subject: [PATCH 27/35] Update testing.c --- code/logic/testing.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 0a5c364f..392fbc3d 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -897,7 +897,7 @@ void fossil_test_comment(fossil_test_env_t *env) { // Dynamic comment based on test result if (env->pass_count > 0 && env->fail_count == 0 && env->timeout_count == 0) { // Positive outcome - playful - printf(FOSSIL_TEST_COLOR_GREEN "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, great_news_messages[rand() % (sizeof(great_news_messages) / sizeof(great_news_messages[0]))]); + printf(FOSSIL_TEST_COLOR_CYAN "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, great_news_messages[rand() % (sizeof(great_news_messages) / sizeof(great_news_messages[0]))]); } else if (env->fail_count > 0) { // Failure detected - humorous to lighten the mood printf(FOSSIL_TEST_COLOR_RED "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, humorous_messages[rand() % (sizeof(humorous_messages) / sizeof(humorous_messages[0]))]); @@ -906,7 +906,7 @@ void fossil_test_comment(fossil_test_env_t *env) { printf(FOSSIL_TEST_COLOR_ORANGE "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_messages[rand() % (sizeof(timeout_messages) / sizeof(timeout_messages[0]))]); } else if (env->pass_count == 0 && env->fail_count == 0 && env->timeout_count == 0) { // No results - sarcastic twist - printf(FOSSIL_TEST_COLOR_PURPLE "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, sarcastic_messages[rand() % (sizeof(sarcastic_messages) / sizeof(sarcastic_messages[0]))]); + printf(FOSSIL_TEST_COLOR_CYAN "Comment: %s\n" FOSSIL_TEST_COLOR_RESET, sarcastic_messages[rand() % (sizeof(sarcastic_messages) / sizeof(sarcastic_messages[0]))]); } else { // Mixed results - deeper analysis printf(FOSSIL_TEST_COLOR_CYAN "Comment: The test results are mixed. Consider analyzing individual test cases to uncover underlying issues.\n" FOSSIL_TEST_COLOR_RESET); @@ -925,9 +925,6 @@ void fossil_test_analyze(fossil_test_env_t *env) { if (test->status == TEST_STATUS_SKIP) { env->skip_count++; // Increment skipped count directly from env } - if (_ASSERT_COUNT == 0) { - // If no assertions, you can handle logic here if needed, but no longer need a counter - } test = test->next; } suite = suite->next; @@ -953,32 +950,32 @@ void fossil_test_analyze(fossil_test_env_t *env) { // Sort conditions from worst case to best case: // 1. Failure Rate -> 2. Timeout Rate -> 3. Skipped Rate -> 4. Success Rate - printf(FOSSIL_TEST_COLOR_BLUE "\nAnalysis Results:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN "\nAnalysis Results:\n" FOSSIL_TEST_COLOR_RESET); // Worst case: Failure rate if (env->fail_count > 0) { - printf("Failure rate: %.2f%%\n", failure_rate); + printf(FOSSIL_TEST_COLOR_CYAN "Failure rate: %.2f%%\n" FOSSIL_TEST_COLOR_RESET, failure_rate); } // Next worst: Timeout tests if (env->timeout_count > 0) { - printf("Timeout tests: %.2f%%\n", timeout_rate); + printf(FOSSIL_TEST_COLOR_CYAN "Timeout tests: %.2f%%\n" FOSSIL_TEST_COLOR_RESET, timeout_rate); } // Skipped tests next if (env->skip_count > 0) { - printf("Skipped tests: %.2f%% (%d tests)\n", skip_rate, env->skip_count); + printf(FOSSIL_TEST_COLOR_CYAN "Skipped tests: %.2f%% (%d tests)\n" FOSSIL_TEST_COLOR_RESET, skip_rate, env->skip_count); } // Best case: Success rate if (env->pass_count > 0) { - printf("Success rate: %.2f%%\n", success_rate); + printf(FOSSIL_TEST_COLOR_CYAN "Success rate: %.2f%%\n" FOSSIL_TEST_COLOR_RESET, success_rate); } // Additional insights - printf("Probability of success: %.2f\n", probability_of_success); - printf("Average test rate: %.2f%%\n", average_rate); - printf("Prediction (Future Success Rate): %.2f%%\n", prediction); + printf(FOSSIL_TEST_COLOR_CYAN "Probability of success: %.2f\n" FOSSIL_TEST_COLOR_RESET, probability_of_success); + printf(FOSSIL_TEST_COLOR_CYAN "Average test rate: %.2f%%\n" FOSSIL_TEST_COLOR_RESET, average_rate); + printf(FOSSIL_TEST_COLOR_CYAN "Prediction (Future Success Rate): %.2f%%\n" FOSSIL_TEST_COLOR_RESET, prediction); // Skipped tests analysis route if (env->skip_count > 0) { @@ -993,16 +990,16 @@ void fossil_test_suggest(fossil_test_env_t *env) { // Dynamic suggestion based on results and test state if (env->pass_count == 0 && env->fail_count == 0 && env->skip_count == 0 && env->timeout_count == 0 && env->empty_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 50]); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 50]); } else if (env->fail_count > 0) { printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, failure_suggestions[rand() % 50]); } else if (env->pass_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 50]); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 50]); } else if (env->timeout_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_suggestions[rand() % 50]); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, timeout_suggestions[rand() % 50]); } else if (env->skip_count > 0) { // Skipped tests specific suggestions - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: Review skipped tests for prerequisites or intentional exclusions. Ensure tests are not being skipped due to unmet conditions.\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Suggestion: Review skipped tests for prerequisites or intentional exclusions. Ensure tests are not being skipped due to unmet conditions.\n" FOSSIL_TEST_COLOR_RESET); } } @@ -1052,8 +1049,8 @@ void fossil_test_execution_time(fossil_test_env_t *env) { // Footer and execution time display printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_ITALIC "|\t(%02d) sec, (%03d) ms, (%06d) us, (%09d) ns\n" FOSSIL_TEST_COLOR_RESET, (int32_t)seconds, (int32_t)milliseconds, (int32_t)microseconds, (int32_t)nanoseconds); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\tExecution time:\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "|\t(%02d) sec, (%03d) ms, (%06d) us, (%09d) ns\n" FOSSIL_TEST_COLOR_RESET, (int32_t)seconds, (int32_t)milliseconds, (int32_t)microseconds, (int32_t)nanoseconds); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); } @@ -1097,7 +1094,7 @@ void fossil_test_summary(fossil_test_env_t *env) { // TUI-like header and bold title printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); - printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); fossil_test_comment(env); // Add comments based on results From 4ceba016e48832f49f8f86830b6b2c85cfd1fa25 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:49:58 -0500 Subject: [PATCH 28/35] Update testing.c --- code/logic/testing.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 392fbc3d..6e280813 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -710,7 +710,7 @@ void fossil_test_run_suite(fossil_test_suite_t *suite, fossil_test_env_t *env) { printf(FOSSIL_TEST_COLOR_BLUE "Running suite: %s\n" FOSSIL_TEST_COLOR_RESET, suite->name); } - if (env->options.shuffle_enabled){ + if (env->options.shuffle_enabled) { shuffle_test_cases(&suite->tests); } @@ -722,20 +722,24 @@ void fossil_test_run_suite(fossil_test_suite_t *suite, fossil_test_env_t *env) { suite->suite_setup_func(); } - double total_execution_time = 0.0; + clock_t suite_start = clock(); + fossil_test_case_t *current_test = suite->tests; while (current_test) { fossil_test_run_case(current_test, env); - total_execution_time += current_test->execution_time; current_test = current_test->next; } + clock_t suite_end = clock(); + double total_execution_time = (double)(suite_end - suite_start) / CLOCKS_PER_SEC; + if (suite->suite_teardown_func) { suite->suite_teardown_func(); } if (env->options.show_info) { - printf(FOSSIL_TEST_COLOR_CYAN "Total execution time for suite %s: %.3f seconds\n" FOSSIL_TEST_COLOR_RESET, suite->name, total_execution_time); + printf(FOSSIL_TEST_COLOR_CYAN "Total execution time for suite %s: %.3f seconds\n" FOSSIL_TEST_COLOR_RESET, + suite->name, total_execution_time); } } @@ -786,27 +790,35 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) // Run setup fossil_test_case_setup(test_case); - clock_t test_start_time = clock(); - clock_t timeout_limit = test_start_time + 3 * 60 * CLOCKS_PER_SEC; // 3 minutes timeout - _ASSERT_COUNT = 0; // Reset assertion count before running the test + clock_t test_start_time = clock(); + double timeout_seconds = 180.0; // 3 minutes timeout + double elapsed_seconds = 0.0; + if (setjmp(env->env) == 0) { // Attempt to run the test case for (int i = 0; i < env->options.repeat_count; i++) { + clock_t iter_start = clock(); + test_case->test_func(); - if (clock() > timeout_limit) { // Timeout check + + clock_t iter_end = clock(); + elapsed_seconds = (double)(iter_end - test_start_time) / CLOCKS_PER_SEC; + + if (elapsed_seconds > timeout_seconds) { test_case->status = TEST_STATUS_TTIMEOUT; - printf(FOSSIL_TEST_COLOR_ORANGE "TIMEOUT: " FOSSIL_TEST_COLOR_BLUE " %s\n" FOSSIL_TEST_COLOR_RESET, test_case->name); + printf(FOSSIL_TEST_COLOR_ORANGE "TIMEOUT: " FOSSIL_TEST_COLOR_BLUE "%s\n" FOSSIL_TEST_COLOR_RESET, test_case->name); break; } } } else { // Handle failure test_case->status = TEST_STATUS_FAIL; - printf(FOSSIL_TEST_COLOR_RED "FAILED: " FOSSIL_TEST_COLOR_BLUE " %s\n", test_case->name); + printf(FOSSIL_TEST_COLOR_RED "FAILED: " FOSSIL_TEST_COLOR_BLUE "%s\n", test_case->name); printf("Failure Message: %s\n" FOSSIL_TEST_COLOR_RESET, test_case->failure_message); } - test_case->execution_time = (double)(clock() - test_start_time) / CLOCKS_PER_SEC; + clock_t test_end_time = clock(); + test_case->execution_time = (double)(test_end_time - test_start_time) / CLOCKS_PER_SEC; // Warn if the test case contains no assertions if (_ASSERT_COUNT == 0) { @@ -820,7 +832,8 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) switch (test_case->status) { case TEST_STATUS_PASS: if (env->options.show_info) { - printf(FOSSIL_TEST_COLOR_GREEN "PASSED: " FOSSIL_TEST_COLOR_BLUE " %s (%.3f seconds)\n" FOSSIL_TEST_COLOR_RESET, test_case->name, test_case->execution_time); + printf(FOSSIL_TEST_COLOR_GREEN "PASSED: " FOSSIL_TEST_COLOR_BLUE "%s (%.3f seconds)\n" FOSSIL_TEST_COLOR_RESET, + test_case->name, test_case->execution_time); } break; case TEST_STATUS_FAIL: @@ -950,7 +963,6 @@ void fossil_test_analyze(fossil_test_env_t *env) { // Sort conditions from worst case to best case: // 1. Failure Rate -> 2. Timeout Rate -> 3. Skipped Rate -> 4. Success Rate - printf(FOSSIL_TEST_COLOR_CYAN "\nAnalysis Results:\n" FOSSIL_TEST_COLOR_RESET); // Worst case: Failure rate if (env->fail_count > 0) { @@ -1097,8 +1109,8 @@ void fossil_test_summary(fossil_test_env_t *env) { printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "\tFossil Test Summary\n" FOSSIL_TEST_COLOR_RESET); printf(FOSSIL_TEST_COLOR_BLUE FOSSIL_TEST_ATTR_BOLD "==================================================================================\n" FOSSIL_TEST_COLOR_RESET); - fossil_test_comment(env); // Add comments based on results fossil_test_analyze(env); // Add analysis of test results + fossil_test_comment(env); // Add comments based on results fossil_test_suggest(env); // Add suggestions for improvement fossil_test_execution_time(env); } From 034390296ac5b5a5587ef97fc427682c9a40c44c Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:50:36 -0500 Subject: [PATCH 29/35] Update testing.h --- code/logic/fossil/test/testing.h | 1 - 1 file changed, 1 deletion(-) diff --git a/code/logic/fossil/test/testing.h b/code/logic/fossil/test/testing.h index 8a3adec4..f2e64cd5 100644 --- a/code/logic/fossil/test/testing.h +++ b/code/logic/fossil/test/testing.h @@ -166,7 +166,6 @@ typedef struct fossil_test_env { int32_t fail_count; int32_t skip_count; int32_t empty_count; - int32_t no_assertion_count; int32_t timeout_count; int32_t unexpected_count; double start_execution_time; From afc7bdbc12f6910afe7577935340ba194b638514 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:53:39 -0500 Subject: [PATCH 30/35] Update testing.c --- code/logic/testing.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 6e280813..528d0334 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -793,17 +793,16 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) _ASSERT_COUNT = 0; // Reset assertion count before running the test clock_t test_start_time = clock(); - double timeout_seconds = 180.0; // 3 minutes timeout - double elapsed_seconds = 0.0; + double timeout_seconds = 180.0; // 3-minute timeout - if (setjmp(env->env) == 0) { // Attempt to run the test case + if (setjmp(env->env) == 0) { for (int i = 0; i < env->options.repeat_count; i++) { - clock_t iter_start = clock(); + clock_t start_iter = clock(); test_case->test_func(); - clock_t iter_end = clock(); - elapsed_seconds = (double)(iter_end - test_start_time) / CLOCKS_PER_SEC; + clock_t end_iter = clock(); + double elapsed_seconds = (double)(end_iter - test_start_time) / CLOCKS_PER_SEC; if (elapsed_seconds > timeout_seconds) { test_case->status = TEST_STATUS_TTIMEOUT; @@ -811,7 +810,7 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) break; } } - } else { // Handle failure + } else { test_case->status = TEST_STATUS_FAIL; printf(FOSSIL_TEST_COLOR_RED "FAILED: " FOSSIL_TEST_COLOR_BLUE "%s\n", test_case->name); printf("Failure Message: %s\n" FOSSIL_TEST_COLOR_RESET, test_case->failure_message); @@ -820,15 +819,12 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) clock_t test_end_time = clock(); test_case->execution_time = (double)(test_end_time - test_start_time) / CLOCKS_PER_SEC; - // Warn if the test case contains no assertions if (_ASSERT_COUNT == 0) { printf(FOSSIL_TEST_COLOR_YELLOW "WARNING: %s contains no assertions\n" FOSSIL_TEST_COLOR_RESET, test_case->name); } - // Run teardown fossil_fossil_test_case_teardown(test_case); - // Log result switch (test_case->status) { case TEST_STATUS_PASS: if (env->options.show_info) { From 950903893c10cd06b569e06c534fc8f972e27ffb Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 18:00:54 -0500 Subject: [PATCH 31/35] Update testing.c --- code/logic/testing.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 528d0334..9c15edc0 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -792,17 +792,15 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) _ASSERT_COUNT = 0; // Reset assertion count before running the test - clock_t test_start_time = clock(); + clock_t start_iter = clock(); double timeout_seconds = 180.0; // 3-minute timeout if (setjmp(env->env) == 0) { for (int i = 0; i < env->options.repeat_count; i++) { - clock_t start_iter = clock(); - test_case->test_func(); - clock_t end_iter = clock(); - double elapsed_seconds = (double)(end_iter - test_start_time) / CLOCKS_PER_SEC; + clock_t now = clock(); + double elapsed_seconds = (double)(now - start_iter) / CLOCKS_PER_SEC; if (elapsed_seconds > timeout_seconds) { test_case->status = TEST_STATUS_TTIMEOUT; @@ -816,8 +814,8 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) printf("Failure Message: %s\n" FOSSIL_TEST_COLOR_RESET, test_case->failure_message); } - clock_t test_end_time = clock(); - test_case->execution_time = (double)(test_end_time - test_start_time) / CLOCKS_PER_SEC; + clock_t end_iter = clock(); + test_case->execution_time = (double)(end_iter - start_iter) / CLOCKS_PER_SEC; if (_ASSERT_COUNT == 0) { printf(FOSSIL_TEST_COLOR_YELLOW "WARNING: %s contains no assertions\n" FOSSIL_TEST_COLOR_RESET, test_case->name); From c67cb13994a31e0176254e7ee3d65a6fbab868ba Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 18:14:50 -0500 Subject: [PATCH 32/35] Update testing.h --- code/logic/fossil/test/testing.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/logic/fossil/test/testing.h b/code/logic/fossil/test/testing.h index f2e64cd5..9207547a 100644 --- a/code/logic/fossil/test/testing.h +++ b/code/logic/fossil/test/testing.h @@ -295,8 +295,8 @@ void fossil_test_run_all(fossil_test_env_t *env); */ #define _FOSSIL_TEST_SKIP(test_name, message) \ test_name##_test_case.status = TEST_STATUS_SKIP; \ - test_name##_test_case.failure_message = message; \ - printf(FOSSIL_TEST_COLOR_YELLOW "SKIPPED: %s - %s\n" FOSSIL_TEST_COLOR_RESET, #test_name, message); \ + test_name##_test_case.failure_message = message; + // printf(FOSSIL_TEST_COLOR_YELLOW "SKIPPED: %s - %s\n" FOSSIL_TEST_COLOR_RESET, #test_name, message); \ /** * @brief Macro to define a test case. From 336bfe4006842a458425123ea7cd362dfb426f91 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 18:17:02 -0500 Subject: [PATCH 33/35] Update testing.c --- code/logic/testing.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index 9c15edc0..b9a878aa 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -817,9 +817,9 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) clock_t end_iter = clock(); test_case->execution_time = (double)(end_iter - start_iter) / CLOCKS_PER_SEC; - if (_ASSERT_COUNT == 0) { - printf(FOSSIL_TEST_COLOR_YELLOW "WARNING: %s contains no assertions\n" FOSSIL_TEST_COLOR_RESET, test_case->name); - } + // if (_ASSERT_COUNT == 0) { + // printf(FOSSIL_TEST_COLOR_YELLOW "WARNING: %s contains no assertions\n" FOSSIL_TEST_COLOR_RESET, test_case->name); + // } fossil_fossil_test_case_teardown(test_case); From a721694c8d136c66fbb2899d34f39efbadd27ff7 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 18:23:17 -0500 Subject: [PATCH 34/35] Update testing.h --- code/logic/fossil/test/testing.h | 1 - 1 file changed, 1 deletion(-) diff --git a/code/logic/fossil/test/testing.h b/code/logic/fossil/test/testing.h index 9207547a..6fd8fcdd 100644 --- a/code/logic/fossil/test/testing.h +++ b/code/logic/fossil/test/testing.h @@ -296,7 +296,6 @@ void fossil_test_run_all(fossil_test_env_t *env); #define _FOSSIL_TEST_SKIP(test_name, message) \ test_name##_test_case.status = TEST_STATUS_SKIP; \ test_name##_test_case.failure_message = message; - // printf(FOSSIL_TEST_COLOR_YELLOW "SKIPPED: %s - %s\n" FOSSIL_TEST_COLOR_RESET, #test_name, message); \ /** * @brief Macro to define a test case. From fd200900ce61d9b4064e304015091a20cc41d486 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 6 Apr 2025 19:02:00 -0500 Subject: [PATCH 35/35] Update testing.c --- code/logic/testing.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/code/logic/testing.c b/code/logic/testing.c index b9a878aa..2bfc2df5 100644 --- a/code/logic/testing.c +++ b/code/logic/testing.c @@ -817,10 +817,6 @@ void fossil_test_run_case(fossil_test_case_t *test_case, fossil_test_env_t *env) clock_t end_iter = clock(); test_case->execution_time = (double)(end_iter - start_iter) / CLOCKS_PER_SEC; - // if (_ASSERT_COUNT == 0) { - // printf(FOSSIL_TEST_COLOR_YELLOW "WARNING: %s contains no assertions\n" FOSSIL_TEST_COLOR_RESET, test_case->name); - // } - fossil_fossil_test_case_teardown(test_case); switch (test_case->status) { @@ -998,7 +994,7 @@ void fossil_test_suggest(fossil_test_env_t *env) { if (env->pass_count == 0 && env->fail_count == 0 && env->skip_count == 0 && env->timeout_count == 0 && env->empty_count > 0) { printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, empty_suite_suggestions[rand() % 50]); } else if (env->fail_count > 0) { - printf(FOSSIL_TEST_COLOR_CYAN "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, failure_suggestions[rand() % 50]); + printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, failure_suggestions[rand() % 50]); } else if (env->pass_count > 0) { printf(FOSSIL_TEST_COLOR_CYAN FOSSIL_TEST_ATTR_ITALIC "Suggestion: %s\n" FOSSIL_TEST_COLOR_RESET, success_suggestions[rand() % 50]); } else if (env->timeout_count > 0) {