diff options
author | Zvi Rackover <zvi.rackover@intel.com> | 2017-07-03 18:42:47 +0000 |
---|---|---|
committer | Zvi Rackover <zvi.rackover@intel.com> | 2017-07-03 18:42:47 +0000 |
commit | 5a8feb78939d6dab6fde8f193c9463c3af8442a0 (patch) | |
tree | c7901716a1d5cbdba1a48b8c3fc7b43fc0201da0 /unittests | |
parent | 787d8dd664061ee5d28c1e6c4cb76fcb5856fe2d (diff) |
MathExtras UnitTest: Assert that isPowerOf2(0) is false. NFC.
Summary:
This is a follow-up on D34077. Elena observed that the
correctness of the code relies on isPowerOf2(0) returning false.
Adding a test to cover this corner-case.
Reviewers: delena, davide, craig.topper
Reviewed By: davide
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34939
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/MathExtrasTest.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/unittests/Support/MathExtrasTest.cpp b/unittests/Support/MathExtrasTest.cpp index e26653b8a656..694a1f24d032 100644 --- a/unittests/Support/MathExtrasTest.cpp +++ b/unittests/Support/MathExtrasTest.cpp @@ -177,6 +177,7 @@ TEST(MathExtras, reverseBits) { } TEST(MathExtras, isPowerOf2_32) { + EXPECT_FALSE(isPowerOf2_32(0)); EXPECT_TRUE(isPowerOf2_32(1 << 6)); EXPECT_TRUE(isPowerOf2_32(1 << 12)); EXPECT_FALSE(isPowerOf2_32((1 << 19) + 3)); @@ -184,6 +185,7 @@ TEST(MathExtras, isPowerOf2_32) { } TEST(MathExtras, isPowerOf2_64) { + EXPECT_FALSE(isPowerOf2_64(0)); EXPECT_TRUE(isPowerOf2_64(1LL << 46)); EXPECT_TRUE(isPowerOf2_64(1LL << 12)); EXPECT_FALSE(isPowerOf2_64((1LL << 53) + 3)); |