From 7eae6dd8d602bf0b84be1a35b12c2f1c2b9dcd53 Mon Sep 17 00:00:00 2001 From: ilitteri Date: Mon, 2 Dec 2024 16:26:50 -0300 Subject: [PATCH 1/2] Add success percentage to the hive report --- cmd/hive_report/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/hive_report/src/main.rs b/cmd/hive_report/src/main.rs index dd14e0d66..123b8d1df 100644 --- a/cmd/hive_report/src/main.rs +++ b/cmd/hive_report/src/main.rs @@ -62,7 +62,8 @@ fn main() -> Result<(), Box> { results.sort_by(|a, b| a.0.cmp(&b.0)); for (file_name, passed, total) in results { - println!("- {}: {}/{}", file_name, passed, total); + let success_percentage = (passed as f64 / total as f64) * 100.0; + println!("{file_name}: {passed}/{total} ({success_percentage:.02}%)"); } Ok(()) From f45b88d56b85d706e084a851e0b94549c71516e8 Mon Sep 17 00:00:00 2001 From: ilitteri Date: Mon, 2 Dec 2024 16:33:12 -0300 Subject: [PATCH 2/2] Add total tests report --- cmd/hive_report/src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/hive_report/src/main.rs b/cmd/hive_report/src/main.rs index 123b8d1df..ecabb4381 100644 --- a/cmd/hive_report/src/main.rs +++ b/cmd/hive_report/src/main.rs @@ -61,10 +61,15 @@ fn main() -> Result<(), Box> { // Sort by file name. results.sort_by(|a, b| a.0.cmp(&b.0)); - for (file_name, passed, total) in results { - let success_percentage = (passed as f64 / total as f64) * 100.0; + for (file_name, passed, total) in &results { + let success_percentage = (*passed as f64 / *total as f64) * 100.0; println!("{file_name}: {passed}/{total} ({success_percentage:.02}%)"); } + println!(); + let total_passed = results.iter().map(|(_, p, _)| p).sum::(); + let total_tests = results.iter().map(|(_, _, t)| t).sum::(); + let total_percentage = (total_passed as f64 / total_tests as f64) * 100.0; + println!("Total: {total_passed}/{total_tests} ({total_percentage:.02}%)"); Ok(()) }