Commit 28656a1a authored by Thomas Schlichter's avatar Thomas Schlichter

add test log2_approx.boundaries

parent d6f9bcd1
......@@ -16,6 +16,15 @@ TEST(log2_approx, complete)
EXPECT_EQ(log2_approx(i), log2_approx_ref(i));
}
TEST(log2_approx, boundaries)
{
for (int i = 0; i < 32; i++) {
uint32_t i2 = std::pow(2.0, i + 0.5);
EXPECT_EQ(log2_approx(i2), i) << "log2(" << i2 << ")";
EXPECT_EQ(log2_approx(i2 + 1), i + 1) << "log2(" << i2 + 1 << ")";
}
}
TEST(log2_approx64, boundaries)
{
for (int i = 0; i < 64; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment