|
@@ -37,7 +37,10 @@ ENTT_DEBUG_TEST(PoccaPocmaAndPocsDeathTest, Functionalities) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TEST(IsPowerOfTwo, Functionalities) {
|
|
TEST(IsPowerOfTwo, Functionalities) {
|
|
|
- ASSERT_FALSE(entt::is_power_of_two(0u));
|
|
|
|
|
|
|
+ // constexpr-ness guaranteed
|
|
|
|
|
+ constexpr auto zero_is_power_of_two = entt::is_power_of_two(0u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_FALSE(zero_is_power_of_two);
|
|
|
ASSERT_TRUE(entt::is_power_of_two(1u));
|
|
ASSERT_TRUE(entt::is_power_of_two(1u));
|
|
|
ASSERT_TRUE(entt::is_power_of_two(2u));
|
|
ASSERT_TRUE(entt::is_power_of_two(2u));
|
|
|
ASSERT_TRUE(entt::is_power_of_two(4u));
|
|
ASSERT_TRUE(entt::is_power_of_two(4u));
|
|
@@ -47,7 +50,10 @@ TEST(IsPowerOfTwo, Functionalities) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TEST(NextPowerOfTwo, Functionalities) {
|
|
TEST(NextPowerOfTwo, Functionalities) {
|
|
|
- ASSERT_EQ(entt::next_power_of_two(0u), 1u);
|
|
|
|
|
|
|
+ // constexpr-ness guaranteed
|
|
|
|
|
+ constexpr auto next_power_of_two_of_zero = entt::next_power_of_two(0u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(next_power_of_two_of_zero, 1u);
|
|
|
ASSERT_EQ(entt::next_power_of_two(1u), 1u);
|
|
ASSERT_EQ(entt::next_power_of_two(1u), 1u);
|
|
|
ASSERT_EQ(entt::next_power_of_two(2u), 2u);
|
|
ASSERT_EQ(entt::next_power_of_two(2u), 2u);
|
|
|
ASSERT_EQ(entt::next_power_of_two(3u), 4u);
|
|
ASSERT_EQ(entt::next_power_of_two(3u), 4u);
|
|
@@ -63,7 +69,10 @@ ENTT_DEBUG_TEST(NextPowerOfTwoDeathTest, Functionalities) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TEST(FastMod, Functionalities) {
|
|
TEST(FastMod, Functionalities) {
|
|
|
- ASSERT_EQ(entt::fast_mod(0u, 8u), 0u);
|
|
|
|
|
|
|
+ // constexpr-ness guaranteed
|
|
|
|
|
+ constexpr auto fast_mod_of_zero = entt::fast_mod(0u, 8u);
|
|
|
|
|
+
|
|
|
|
|
+ ASSERT_EQ(fast_mod_of_zero, 0u);
|
|
|
ASSERT_EQ(entt::fast_mod(7u, 8u), 7u);
|
|
ASSERT_EQ(entt::fast_mod(7u, 8u), 7u);
|
|
|
ASSERT_EQ(entt::fast_mod(8u, 8u), 0u);
|
|
ASSERT_EQ(entt::fast_mod(8u, 8u), 0u);
|
|
|
}
|
|
}
|