Commit c361c9af authored by Dominik Charousset's avatar Dominik Charousset

Fix possible division by float zero

parent 8f15eaf5
...@@ -405,9 +405,12 @@ bool engine::run(bool colorize, ...@@ -405,9 +405,12 @@ bool engine::run(bool colorize,
break; break;
} }
} }
auto percent_good = unsigned percent_good = 100;
static_cast<unsigned>(double(100000 * total_good) if (total_bad > 0) {
/ double(total_good + total_bad)) / 1000.0; auto tmp = (100000.0 * total_good)
/ static_cast<double>(total_good + total_bad);
percent_good = static_cast<unsigned>(tmp / 1000.0);
}
auto title = std::string{"summary"}; auto title = std::string{"summary"};
auto pad = std::string((bar.size() - title.size()) / 2, ' '); auto pad = std::string((bar.size() - title.size()) / 2, ' ');
auto indent = std::string(24, ' '); auto indent = std::string(24, ' ');
......
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