Commit 0d052e4c authored by Matthias Vallentin's avatar Matthias Vallentin

Do not let expected failures distort success

parent 2404d2b2
...@@ -419,7 +419,8 @@ bool engine::run(bool colorize, ...@@ -419,7 +419,8 @@ bool engine::run(bool colorize,
unsigned percent_good = 100; unsigned percent_good = 100;
if (total_bad > 0) { if (total_bad > 0) {
auto tmp = (100000.0 * static_cast<double>(total_good)) auto tmp = (100000.0 * static_cast<double>(total_good))
/ static_cast<double>(total_good + total_bad); / static_cast<double>(total_good + total_bad
- total_bad_expected);
percent_good = static_cast<unsigned>(tmp / 1000.0); percent_good = static_cast<unsigned>(tmp / 1000.0);
} }
auto title = std::string{"summary"}; auto title = std::string{"summary"};
...@@ -434,7 +435,7 @@ bool engine::run(bool colorize, ...@@ -434,7 +435,7 @@ bool engine::run(bool colorize,
if (total_bad > 0) { if (total_bad > 0) {
log.info() << " (" << color(green) << total_good << color(reset) << '/' log.info() << " (" << color(green) << total_good << color(reset) << '/'
<< color(red) << total_bad << color(reset) << ")"; << color(red) << total_bad << color(reset) << ")";
if (total_bad_expected) { if (total_bad_expected > 0) {
log.info() log.info()
<< ' ' << color(cyan) << total_bad_expected << color(reset) << ' ' << color(cyan) << total_bad_expected << color(reset)
<< " failures expected"; << " failures expected";
...@@ -442,7 +443,8 @@ bool engine::run(bool colorize, ...@@ -442,7 +443,8 @@ bool engine::run(bool colorize,
} }
log.info() << '\n' << indent << "time: " << color(yellow) log.info() << '\n' << indent << "time: " << color(yellow)
<< render(runtime) << '\n' << color(reset) << indent << render(runtime) << '\n' << color(reset) << indent
<< "success: " << (total_bad > 0 ? color(red) : color(green)) << "success: "
<< (total_bad == total_bad_expected ? color(green) : color(red))
<< percent_good << "%" << color(reset) << "\n\n" << color(cyan) << percent_good << "%" << color(reset) << "\n\n" << color(cyan)
<< bar << color(reset) << '\n'; << bar << color(reset) << '\n';
return total_bad == total_bad_expected; return total_bad == total_bad_expected;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment