Slight formatting improvement to find errors.

master
Zed A. Shaw 1 month ago
parent b8072ca3b1
commit ef8e63e7fb
  1. 9
      src/run.cpp
  2. 6
      tests/sample1.cpp
  3. 2
      tests/sample_failing.cpp

@ -6,9 +6,10 @@ namespace fuc2 {
int run(const Set& test_set) { int run(const Set& test_set) {
int fail_count = 0; int fail_count = 0;
std::vector<std::string> errors; std::vector<std::string> errors;
std::string file_name = test_set.location.file_name();
fmt::println("################# {} \"{}\" ###############", fmt::println("################# {} \"{}\" ###############",
test_set.location.file_name(), test_set.name); file_name, test_set.name);
for(const auto& [name, test] : test_set.tests) { for(const auto& [name, test] : test_set.tests) {
bool did_fail = false; bool did_fail = false;
@ -28,17 +29,17 @@ namespace fuc2 {
} }
std::string pass_fail = did_fail ? "🔴" : "🟢"; std::string pass_fail = did_fail ? "🔴" : "🟢";
fmt::println("{} {}\n==========", pass_fail, name); fmt::println("{} {}:{}\n==========", pass_fail, file_name, name);
} }
if(fail_count > 0) { if(fail_count > 0) {
fmt::println("🚨🚨🚨🚨🚨 FAIL COUNT: {} in {}", fail_count, test_set.location.file_name()); fmt::println("🚨🚨🚨🚨🚨 FAIL COUNT: {} in {}", fail_count, file_name);
for(auto& msg : errors) { for(auto& msg : errors) {
fmt::println("---------\n{}", msg); fmt::println("---------\n{}", msg);
} }
} else { } else {
fmt::println("👍 ALL PASS: {}", test_set.location.file_name()); fmt::println("👍 ALL PASS: {}", file_name);
} }
return fail_count; return fail_count;

@ -59,9 +59,9 @@ namespace sample1 {
.name="std::deque basic operations", .name="std::deque basic operations",
.options={ .fail_fast=false }, .options={ .fail_fast=false },
.tests={ .tests={
{"push_pop_back", test_push_pop_back}, {"test_push_pop_back", test_push_pop_back},
{"push_pop_front", test_push_pop_front}, {"test_push_pop_front", test_push_pop_front},
{"push_blows_up", test_push_blows_up}, {"test_push_blows_up", test_push_blows_up},
} }
}; };
} }

@ -39,7 +39,7 @@ namespace sample_failing {
.name="std::deque failing ops", .name="std::deque failing ops",
.options={ .fail_fast=false }, .options={ .fail_fast=false },
.tests={ .tests={
{"fail_pop_back", fail_push_pop_back}, {"fail_push_pop_back", fail_push_pop_back},
{"fail_blows_up", fail_blows_up}, {"fail_blows_up", fail_blows_up},
} }
}; };

Loading…
Cancel
Save