Fix Wold-style-cast error (#2125)

* Add Wold-style-cast to cmake flags
* Fix old style cast in catch_stats.hpp
* Fix old style cast in catch_stats.cpp
This commit is contained in:
Roman Proskuryakov authored and GitHub committed 2020-12-28 14:00:19 +01:00
1 parent 045feff834
commit 0acb371b92
9 files changed
+9 -8

No files matched your search

+1 -1
View File
@@ -182,7 +182,7 @@ namespace Catch {
double k0 = -n * nd;
double k1 = sb2 - n * sg2 + nd;
double det = k1 * k1 - 4 * sg2 * k0;
return (int)(-2. * k0 / (k1 + std::sqrt(det)));
return static_cast<int>(-2. * k0 / (k1 + std::sqrt(det)));
};
auto var_out = [n, sb2, sg2](double c) {
+1 -1
View File
@@ -102,7 +102,7 @@ namespace Catch {
double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5));
int n = static_cast<int>(resample.size());
double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / (double)n;
double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / static_cast<double>(n);
// degenerate case with uniform samples
if (prob_n == 0) return { point, point, point, confidence_level };