[Support] Add isShiftedMask_32/isShiftedMask_64 unit test coverage

This commit is contained in:
Simon Pilgrim 2022-02-04 17:06:48 +00:00
parent 39ceea26c5
commit 0b989a03b9
1 changed files with 14 additions and 0 deletions

View File

@ -175,6 +175,20 @@ TEST(MathExtras, reverseBits) {
EXPECT_EQ(0x5400000000000000ULL, reverseBits(NZ64));
}
TEST(MathExtras, isShiftedMask_32) {
EXPECT_FALSE(isShiftedMask_32(0x01010101));
EXPECT_TRUE(isShiftedMask_32(0xf0000000));
EXPECT_TRUE(isShiftedMask_32(0xffff0000));
EXPECT_TRUE(isShiftedMask_32(0xff << 1));
}
TEST(MathExtras, isShiftedMask_64) {
EXPECT_FALSE(isShiftedMask_64(0x0101010101010101ull));
EXPECT_TRUE(isShiftedMask_64(0xf000000000000000ull));
EXPECT_TRUE(isShiftedMask_64(0xffff000000000000ull));
EXPECT_TRUE(isShiftedMask_64(0xffull << 55));
}
TEST(MathExtras, isPowerOf2_32) {
EXPECT_FALSE(isPowerOf2_32(0));
EXPECT_TRUE(isPowerOf2_32(1 << 6));