1 | #include "test.h" |
---|---|
2 | #include <gtest/gtest.h> |
3 | |
4 | #include <base/math.h> |
5 | |
6 | TEST(Math, FixedPointRoundtrip) |
7 | { |
8 | for(int i = 0; i < 100000; ++i) |
9 | { |
10 | const float Number = i / 1000.0f; |
11 | EXPECT_NEAR(Number, fx2f(f2fx(Number)), 0.0005f); |
12 | EXPECT_EQ(i, f2fx(fx2f(i))); |
13 | } |
14 | } |
15 |