@@ -130,28 +130,71 @@ void Orchestrator::print_summary() const
130130 size_t failed = failed_assertions ();
131131 size_t passed = total - failed;
132132
133- std::cout << " \n === Test Summary ===" << " \n " ;
134- std::cout << " Total assertions: " << total << " \n " ;
135- std::cout << " Passed: " << passed << " \n " ;
136- std::cout << " Failed: " << failed << " \n " ;
133+ std::cout << " \n " ;
137134
138- if (failed > 0 )
135+ // Group tests by suite
136+ std::unordered_map<std::string, std::vector<std::pair<std::string, const Test *>>> suites_map;
137+ for (const auto &[test_key, test] : tests_)
138+ {
139+ suites_map[test->suite_name ()].emplace_back (test->name (), test.get ());
140+ }
141+
142+ for (const auto &[suite_name, suite_tests] : suites_map)
139143 {
140- std::cout << " =================== " << " \n " ;
141- std::cout << " Failed assertions: " << " \n " ;
142- for (const auto &[test_key, assertions ] : assertions_ )
144+ std::cout << " --- " << suite_name << " --- \n " ;
145+
146+ for (const auto &[test_name, test ] : suite_tests )
143147 {
144- for (const auto &assertion : assertions)
148+ std::string test_key = test->suite_name () + " ::" + test->name ();
149+ auto assertions_it = assertions_.find (test_key);
150+
151+ bool test_has_failures = false ;
152+ std::vector<std::string> failed_descriptions;
153+
154+ if (assertions_it != assertions_.end ())
145155 {
146- if (!assertion.result_ )
156+ const auto &assertions = assertions_it->second ;
157+ for (const auto &assertion : assertions)
147158 {
148- std::cout << " [" << test_key << " ] " << assertion.description_ << " \n " ;
159+ if (!assertion.result_ )
160+ {
161+ test_has_failures = true ;
162+ failed_descriptions.push_back (assertion.description_ );
163+ }
149164 }
150165 }
166+
167+ if (test_has_failures)
168+ {
169+ std::cout << " [FAIL] " << test_name << " \n " ;
170+ for (const auto &desc : failed_descriptions)
171+ {
172+ std::cout << " " << desc << " \n " ;
173+ }
174+ }
175+ else
176+ {
177+ std::cout << " [PASS] " << test_name << " \n " ;
178+ }
151179 }
180+ std::cout << " \n " ;
181+ }
182+
183+ std::cout << " --- Total Summary ---\n " ;
184+ std::cout << " Total assertions: " << total << " \n " ;
185+ std::cout << " Passed: " << passed << " \n " ;
186+ std::cout << " Failed: " << failed << " \n " ;
187+
188+ if (failed == 0 )
189+ {
190+ std::cout << " All tests passed!\n " ;
191+ }
192+ else
193+ {
194+ std::cout << failed << " assertion(s) failed\n " ;
152195 }
153196
154- std::cout << " ===================" << std::endl;
197+ std::cout << " ==================== \n " << std::endl;
155198}
156199
157200void Orchestrator::parse_args (int argc, char *argv[])
@@ -172,9 +215,10 @@ void Orchestrator::parse_args(int argc, char *argv[])
172215
173216void Orchestrator::write_xml_output () const
174217{
218+ // No XML output requested
175219 if (xml_output_path_.empty ())
176220 {
177- return ; // No XML output requested
221+ return ;
178222 }
179223
180224 std::ofstream xml_file (xml_output_path_);
0 commit comments