summaryrefslogtreecommitdiff
path: root/src/unittest/test_utilities.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2018-04-02 23:51:08 +0200
committerGitHub <noreply@github.com>2018-04-02 23:51:08 +0200
commit2481ea27ce0f423f3e6f3522539d20e1500cf572 (patch)
tree73251dcbf9146d7499177f59b266d8c60b0eaae7 /src/unittest/test_utilities.cpp
parente98fd934ce17a7af0b4629fc88158373303c88a0 (diff)
downloadminetest-2481ea27ce0f423f3e6f3522539d20e1500cf572.tar.gz
minetest-2481ea27ce0f423f3e6f3522539d20e1500cf572.tar.bz2
minetest-2481ea27ce0f423f3e6f3522539d20e1500cf572.zip
Fix many issues reported by clang-tidy (#7189)
* Fix many issues reported by clang-tidy We have many issues in code related to some performance to float <-> double. Clang-tidy reported it in performance-type-promotion-in-math-fn I fixed many of them. It's not ready for a promote to blocking Also fix some value which should be const-ref
Diffstat (limited to 'src/unittest/test_utilities.cpp')
-rw-r--r--src/unittest/test_utilities.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/unittest/test_utilities.cpp b/src/unittest/test_utilities.cpp
index d73975b9f..95c34a9c7 100644
--- a/src/unittest/test_utilities.cpp
+++ b/src/unittest/test_utilities.cpp
@@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "test.h"
+#include <cmath>
#include "util/numeric.h"
#include "util/string.h"
@@ -111,13 +112,13 @@ void TestUtilities::testAngleWrapAround()
UASSERT(fabs(modulo360f(-365.5) - (-5.5)) < 0.001);
for (float f = -720; f <= -360; f += 0.25) {
- UASSERT(fabs(modulo360f(f) - modulo360f(f + 360)) < 0.001);
+ UASSERT(std::fabs(modulo360f(f) - modulo360f(f + 360)) < 0.001);
}
for (float f = -1440; f <= 1440; f += 0.25) {
- UASSERT(fabs(modulo360f(f) - fmodf(f, 360)) < 0.001);
- UASSERT(fabs(wrapDegrees_180(f) - ref_WrapDegrees180(f)) < 0.001);
- UASSERT(fabs(wrapDegrees_0_360(f) - ref_WrapDegrees_0_360(f)) < 0.001);
+ UASSERT(std::fabs(modulo360f(f) - fmodf(f, 360)) < 0.001);
+ UASSERT(std::fabs(wrapDegrees_180(f) - ref_WrapDegrees180(f)) < 0.001);
+ UASSERT(std::fabs(wrapDegrees_0_360(f) - ref_WrapDegrees_0_360(f)) < 0.001);
UASSERT(wrapDegrees_0_360(fabs(wrapDegrees_180(f) - wrapDegrees_0_360(f))) < 0.001);
}
}