summaryrefslogtreecommitdiff
path: root/Source/UnitTests
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-05-10 19:06:19 -0400
committerLioncash <mathew1800@gmail.com>2018-05-10 19:42:20 -0400
commitba01f6dba3cf1858ed64bc7f1abee744ffd313ec (patch)
tree277ae9faa7dabc173cbe2d2c9b77db850d5c682e /Source/UnitTests
parent3cca05185029ae4572529bf986675c772cc0ac5a (diff)
CommonFuncs: Convert ROUND_UP_POW2 macro to a function
Also move it to MathUtils where it belongs with the rest of the power-of-two functions. This gets rid of pollution of the current scope of any translation unit with b<value> macros that aren't intended to be used directly.
Diffstat (limited to 'Source/UnitTests')
-rw-r--r--Source/UnitTests/Common/CommonFuncsTest.cpp8
-rw-r--r--Source/UnitTests/Common/MathUtilTest.cpp8
2 files changed, 8 insertions, 8 deletions
diff --git a/Source/UnitTests/Common/CommonFuncsTest.cpp b/Source/UnitTests/Common/CommonFuncsTest.cpp
index 8808290771..6582eef1cc 100644
--- a/Source/UnitTests/Common/CommonFuncsTest.cpp
+++ b/Source/UnitTests/Common/CommonFuncsTest.cpp
@@ -18,14 +18,6 @@ TEST(CommonFuncs, ArraySizeFunction)
(void)test2;
}
-TEST(CommonFuncs, RoundUpPow2Macro)
-{
- EXPECT_EQ(4, ROUND_UP_POW2(3));
- EXPECT_EQ(4, ROUND_UP_POW2(4));
- EXPECT_EQ(8, ROUND_UP_POW2(6));
- EXPECT_EQ(0x40000000, ROUND_UP_POW2(0x23456789));
-}
-
TEST(CommonFuncs, CrashMacro)
{
EXPECT_DEATH({ Crash(); }, "");
diff --git a/Source/UnitTests/Common/MathUtilTest.cpp b/Source/UnitTests/Common/MathUtilTest.cpp
index 4b21ace1c4..2b808e7be5 100644
--- a/Source/UnitTests/Common/MathUtilTest.cpp
+++ b/Source/UnitTests/Common/MathUtilTest.cpp
@@ -30,3 +30,11 @@ TEST(MathUtil, IntLog2)
EXPECT_EQ(3, IntLog2(15));
EXPECT_EQ(63, IntLog2(0xFFFFFFFFFFFFFFFFull));
}
+
+TEST(MathUtil, NextPowerOf2)
+{
+ EXPECT_EQ(4, MathUtil::NextPowerOf2(3));
+ EXPECT_EQ(4, MathUtil::NextPowerOf2(4));
+ EXPECT_EQ(8, MathUtil::NextPowerOf2(6));
+ EXPECT_EQ(0x40000000, MathUtil::NextPowerOf2(0x23456789));
+}