[llvm] r286551 - [ADT/MathExtras] Add tests for PowerOf2Floor (previously untested).

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 18:38:24 PST 2016


Author: davide
Date: Thu Nov 10 20:38:24 2016
New Revision: 286551

URL: http://llvm.org/viewvc/llvm-project?rev=286551&view=rev
Log:
[ADT/MathExtras] Add tests for PowerOf2Floor (previously untested).

Modified:
    llvm/trunk/unittests/Support/MathExtrasTest.cpp

Modified: llvm/trunk/unittests/Support/MathExtrasTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/MathExtrasTest.cpp?rev=286551&r1=286550&r2=286551&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/MathExtrasTest.cpp (original)
+++ llvm/trunk/unittests/Support/MathExtrasTest.cpp Thu Nov 10 20:38:24 2016
@@ -171,6 +171,12 @@ TEST(MathExtras, PowerOf2Ceil) {
   EXPECT_EQ(8, PowerOf2Ceil(7));
 }
 
+TEST(MathExtras, PowerOf2Floor) {
+  EXPECT_EQ(0, PowerOf2Floor(0));
+  EXPECT_EQ(8, PowerOf2Floor(8));
+  EXPECT_EQ(4, PowerOf2Floor(7));
+}
+
 TEST(MathExtras, ByteSwap_32) {
   EXPECT_EQ(0x44332211u, ByteSwap_32(0x11223344));
   EXPECT_EQ(0xDDCCBBAAu, ByteSwap_32(0xAABBCCDD));




More information about the llvm-commits mailing list