aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-02-20 13:00:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-02-20 13:00:06 +0000
commitad4da0fc321230261b4d0387f0ec216eb8aa50ca (patch)
tree46df094a9b70df155db7ba54ad220991d7bc86de /unittests
parent52981c4b6016d9f0e295e0771ec0a50dd073b4b3 (diff)
Move the SplatByte helper to APInt and generalize it a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/APIntTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/unittests/ADT/APIntTest.cpp b/unittests/ADT/APIntTest.cpp
index 2510bc738d..f129fa71c8 100644
--- a/unittests/ADT/APIntTest.cpp
+++ b/unittests/ADT/APIntTest.cpp
@@ -522,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));
+}
+
}