19 #include "gtest/gtest.h" 25 TEST(MathTest, testPower) {
26 EXPECT_EQ(0.,
Power(0, 42));
27 EXPECT_EQ(1.,
Power(0, 0));
28 EXPECT_EQ(1.,
Power(1, 0));
29 EXPECT_EQ(1.,
Power(1, 42));
30 EXPECT_EQ(4.,
Power(2, 2));
33 TEST(MathTest, testPow2) {
34 EXPECT_EQ(0.,
Pow2(0));
35 EXPECT_EQ(1.,
Pow2(1));
36 EXPECT_EQ(4.,
Pow2(2));
37 EXPECT_EQ(49.,
Pow2(7));
40 TEST(MathTest, testDeg2rad) {
41 EXPECT_NEAR(M_PI,
DegToRad(180.), 1e-9);
42 EXPECT_NEAR(2. * M_PI,
DegToRad(360. - 1e-9), 1e-6);
45 TEST(MathTest, testRad2deg) {
46 EXPECT_NEAR(180.,
RadToDeg(M_PI), 1e-9);
47 EXPECT_NEAR(360.,
RadToDeg(2. * M_PI - 1e-9), 1e-6);
50 TEST(MathTest, testNormalizeAngleDifference) {
constexpr double RadToDeg(double rad)
constexpr T Power(T base, int exponent)
constexpr double DegToRad(double deg)
T NormalizeAngleDifference(T difference)