-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathtest_numeric.cpp
More file actions
24 lines (19 loc) · 1.06 KB
/
test_numeric.cpp
File metadata and controls
24 lines (19 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <string>
#include "flamegpu/detail/numeric.h"
#include "gtest/gtest.h"
namespace flamegpu {
TEST(TestNumeric, approxExactlyDivisible) {
/**
* Test that approxExactlyDivisible returns the expected value(s) for a number of cases, including values which were an issue for the original wrapped spatial messaging implementation (see #1157)
*/
ASSERT_TRUE(detail::numeric::approxExactlyDivisible<float>(1, 0.05f));
ASSERT_TRUE(detail::numeric::approxExactlyDivisible<float>(1, 0.04f));
ASSERT_TRUE(detail::numeric::approxExactlyDivisible<float>(2, 0.05f));
ASSERT_TRUE(detail::numeric::approxExactlyDivisible<float>(1, 0.005f));
ASSERT_TRUE(detail::numeric::approxExactlyDivisible<float>(50.0f, 10));
ASSERT_TRUE(detail::numeric::approxExactlyDivisible<float>(100000, 0.05f));
ASSERT_FALSE(detail::numeric::approxExactlyDivisible<float>(1, 0.03f));
ASSERT_FALSE(detail::numeric::approxExactlyDivisible<float>(50.1f, 10));
ASSERT_FALSE(detail::numeric::approxExactlyDivisible<float>(100000, 0.03f));
}
} // namespace flamegpu