| 1 |
function print_test_summary(testResults) |
| 2 |
% Print a comprehensive test summary |
| 3 |
|
| 4 |
if isempty(testResults) |
| 5 |
fprintf('\nNo test results to display.\n'); |
| 6 |
return; |
| 7 |
end |
| 8 |
|
| 9 |
totalTests = length(testResults); |
| 10 |
passedTests = sum([testResults.passed]); |
| 11 |
failedTests = totalTests - passedTests; |
| 12 |
|
| 13 |
fprintf('\n%s\n', repmat('=', 1, 50)); |
| 14 |
fprintf('TEST SUMMARY\n'); |
| 15 |
fprintf('%s\n', repmat('=', 1, 50)); |
| 16 |
fprintf('Total tests: %d\n', totalTests); |
| 17 |
fprintf('Passed: %d (%.1f%%)\n', passedTests, 100*passedTests/totalTests); |
| 18 |
fprintf('Failed: %d (%.1f%%)\n', failedTests, 100*failedTests/totalTests); |
| 19 |
|
| 20 |
if failedTests > 0 |
| 21 |
fprintf('\nFAILED TESTS:\n'); |
| 22 |
fprintf('%s\n', repmat('-', 1, 30)); |
| 23 |
for i = 1:totalTests |
| 24 |
if ~testResults(i).passed |
| 25 |
fprintf('• %s\n', testResults(i).name); |
| 26 |
if ~isempty(testResults(i).message) |
| 27 |
fprintf(' ↪ %s\n', testResults(i).message); |
| 28 |
end |
| 29 |
end |
| 30 |
end |
| 31 |
end |
| 32 |
|
| 33 |
fprintf('%s\n\n', repmat('=', 1, 50)); |
| 34 |
end |