From 28656a1adff749c05cee4ef809752cf359fd1b7d Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 2 Oct 2024 11:25:52 +0200 Subject: [PATCH] add test log2_approx.boundaries --- openair1/PHY/TOOLS/tests/test_log2_approx.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openair1/PHY/TOOLS/tests/test_log2_approx.cpp b/openair1/PHY/TOOLS/tests/test_log2_approx.cpp index 2a8536a3c1..6728041c52 100644 --- a/openair1/PHY/TOOLS/tests/test_log2_approx.cpp +++ b/openair1/PHY/TOOLS/tests/test_log2_approx.cpp @@ -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++) {