diff options
Diffstat (limited to 'unittests/ADT/APIntTest.cpp')
-rw-r--r-- | unittests/ADT/APIntTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/unittests/ADT/APIntTest.cpp b/unittests/ADT/APIntTest.cpp index 2a4c5b4c49..f129fa71c8 100644 --- a/unittests/ADT/APIntTest.cpp +++ b/unittests/ADT/APIntTest.cpp @@ -56,6 +56,14 @@ TEST(APIntTest, i33_Count) { #endif TEST(APIntTest, i65_Count) { + APInt i65(65, 0, true); + EXPECT_EQ(65u, i65.countLeadingZeros()); + EXPECT_EQ(0u, i65.countLeadingOnes()); + EXPECT_EQ(0u, i65.getActiveBits()); + EXPECT_EQ(1u, i65.getActiveWords()); + EXPECT_EQ(65u, i65.countTrailingZeros()); + EXPECT_EQ(0u, i65.countPopulation()); + APInt i65minus(65, 0, true); i65minus.setBit(64); EXPECT_EQ(0u, i65minus.countLeadingZeros()); @@ -514,4 +522,14 @@ TEST(APIntTest, Rotate) { EXPECT_EQ(Rot, Big.rotr(144)); } +TEST(APIntTest, Splat) { + APInt ValA(8, 0x01); + EXPECT_EQ(ValA, APInt::getSplat(8, ValA)); + EXPECT_EQ(APInt(64, 0x0101010101010101ULL), APInt::getSplat(64, ValA)); + + APInt ValB(3, 5); + EXPECT_EQ(APInt(4, 0xD), APInt::getSplat(4, ValB)); + EXPECT_EQ(APInt(15, 0xDB6D), APInt::getSplat(15, ValB)); +} + } |