@@ -934,10 +934,11 @@ int fossil_pizza_run_all(fossil_pizza_engine_t* engine) {
934934}
935935
936936// --- Summary Report ---
937+
937938const char * fossil_test_summary_feedback (const fossil_pizza_score_t * score ) {
938939 if (!score ) return "No results available." ;
939940
940- static char message [256 ];
941+ static char message [512 ];
941942 int total = score -> passed + score -> failed + score -> skipped +
942943 score -> timeout + score -> unexpected + score -> empty ;
943944
@@ -946,20 +947,110 @@ const char* fossil_test_summary_feedback(const fossil_pizza_score_t* score) {
946947 double pass_rate = (double )score -> passed / total * 100.0 ;
947948 double fail_ratio = (double )(score -> failed + score -> unexpected ) / total ;
948949
950+ // --- Primary Summary Pool (50 messages) ---
951+ static const char * summaries [] = {
952+ // Perfect
953+ "Perfect stability: all tests passed." ,
954+ "Outstanding run: no issues detected." ,
955+ "Flawless baseline: zero failures." ,
956+ "Solid confidence: all cases succeeded." ,
957+ "Full coverage success: suite passed without error." ,
958+ // Near perfect
959+ "Near-perfect: minor failures present." ,
960+ "Almost clean: one or two cases failed." ,
961+ "Very strong performance with isolated gaps." ,
962+ "Excellent reliability, but not absolute." ,
963+ "A few adjustments needed for total success." ,
964+ // Strong but not perfect
965+ "High pass rate, suite largely stable." ,
966+ "Reliability confirmed, with minor issues." ,
967+ "Above expectations, but not flawless." ,
968+ "Strong resilience across test cases." ,
969+ "Overall positive results, but check edge cases." ,
970+ // Mixed results
971+ "Balanced outcome: passes and failures split." ,
972+ "Moderate reliability: issues present but not overwhelming." ,
973+ "Inconsistent behavior detected in suite." ,
974+ "Suite stability is uneven." ,
975+ "Test reliability shows room for improvement." ,
976+ // Failure-heavy
977+ "High failure rate detected, needs investigation." ,
978+ "Many cases failed, stability concerns raised." ,
979+ "Serious regression: majority of cases did not pass." ,
980+ "Multiple failures indicate critical bugs." ,
981+ "Widespread issues identified across the suite." ,
982+ // Timeouts
983+ "Some cases failed to finish in time." ,
984+ "Timeouts suggest performance bottlenecks." ,
985+ "Long-running operations caused instability." ,
986+ "Multiple timeouts detected — review efficiency." ,
987+ "Suite affected by delays or infinite loops." ,
988+ // Skipped
989+ "Several cases were skipped." ,
990+ "Coverage gaps: too many skipped tests." ,
991+ "Partial run — skipped cases limit reliability." ,
992+ "Suite execution incomplete due to skipped cases." ,
993+ "Large number of skips indicates missing dependencies." ,
994+ // Empty
995+ "No implemented tests detected." ,
996+ "Test placeholders exist but contain no logic." ,
997+ "Suite mostly empty, coverage not achieved." ,
998+ "Untested code paths remain." ,
999+ "Define actual logic before re-running." ,
1000+ // Unexpected
1001+ "Unexpected results indicate possible undefined behavior." ,
1002+ "Test suite produced anomalies not mapped in criteria." ,
1003+ "Unexpected output raises questions about correctness." ,
1004+ "Unstable behavior — criteria may be mismatched." ,
1005+ "Suite generated results outside defined expectations." ,
1006+ // Critical
1007+ "Catastrophic regression: system integrity at risk." ,
1008+ "Severe instability detected, halt release pipeline." ,
1009+ "Suite outcome suggests major defects." ,
1010+ "Reliability too low for deployment." ,
1011+ "Critical failures demand immediate review."
1012+ };
1013+
1014+ const char * chosen = NULL ;
1015+
1016+ // --- Selection Logic ---
9491017 if (pass_rate == 100.0 ) {
950- snprintf ( message , sizeof ( message ), "Perfect run! All tests passed. Great job." );
1018+ chosen = summaries [ rand () % 5 ]; // Perfect pool
9511019 } else if (fail_ratio > 0.5 ) {
952- snprintf ( message , sizeof ( message ), "High failure rate detected. Investigate the failing and unexpected tests." );
1020+ chosen = summaries [ 20 + ( rand () % 5 )]; // Failure-heavy pool
9531021 } else if (score -> timeout > 0 ) {
954- snprintf ( message , sizeof ( message ), "Some tests timed out. Check for infinite loops or delays." );
1022+ chosen = summaries [ 25 + ( rand () % 5 )]; // Timeout pool
9551023 } else if (score -> skipped > 0 ) {
956- snprintf ( message , sizeof ( message ), "Some tests were skipped. Make sure all dependencies are in place." );
1024+ chosen = summaries [ 30 + ( rand () % 5 )]; // Skipped pool
9571025 } else if (score -> empty > 0 && score -> passed == 0 ) {
958- snprintf (message , sizeof (message ), "All tests are empty or unimplemented." );
1026+ chosen = summaries [35 + (rand () % 5 )]; // Empty pool
1027+ } else if (score -> unexpected > 0 ) {
1028+ chosen = summaries [40 + (rand () % 5 )]; // Unexpected pool
1029+ } else if (pass_rate > 90.0 ) {
1030+ chosen = summaries [5 + (rand () % 5 )]; // Near-perfect pool
1031+ } else if (pass_rate > 70.0 ) {
1032+ chosen = summaries [10 + (rand () % 5 )]; // Strong but not perfect
1033+ } else if (pass_rate > 40.0 ) {
1034+ chosen = summaries [15 + (rand () % 5 )]; // Mixed pool
9591035 } else {
960- snprintf ( message , sizeof ( message ), "Test run completed. Review failures and improve reliability." );
1036+ chosen = summaries [ 45 + ( rand () % 5 )]; // Critical pool
9611037 }
9621038
1039+ // --- Hints Section ---
1040+ char hints [256 ] = {0 };
1041+ if (score -> failed > 0 )
1042+ strncat (hints , " Check failing cases for regressions." , sizeof (hints ) - strlen (hints ) - 1 );
1043+ if (score -> timeout > 0 )
1044+ strncat (hints , " Review timeouts for performance issues." , sizeof (hints ) - strlen (hints ) - 1 );
1045+ if (score -> skipped > 0 )
1046+ strncat (hints , " Ensure skipped tests are intentional." , sizeof (hints ) - strlen (hints ) - 1 );
1047+ if (score -> unexpected > 0 )
1048+ strncat (hints , " Unexpected outcomes may need criteria review." , sizeof (hints ) - strlen (hints ) - 1 );
1049+ if (score -> empty > 0 )
1050+ strncat (hints , " Implement empty test stubs for full coverage." , sizeof (hints ) - strlen (hints ) - 1 );
1051+
1052+ snprintf (message , sizeof (message ), "%s%s" , chosen , hints );
1053+
9631054 return message ;
9641055}
9651056
0 commit comments