diff options
| author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-07-16 18:08:12 +0000 |
|---|---|---|
| committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-07-16 18:08:12 +0000 |
| commit | 99504c577cc58bbc4979216dfaa360bec27e99c7 (patch) | |
| tree | 8ac7902a4636fd6366d1020e0b61abdb6d6d4e83 /llvm/unittests/Support/ConstantRangeTest.cpp | |
| parent | 10e8207c9eedf02013899bb3eb4ce535d51512a5 (diff) | |
| download | llvm-99504c577cc58bbc4979216dfaa360bec27e99c7.zip llvm-99504c577cc58bbc4979216dfaa360bec27e99c7.tar.gz llvm-99504c577cc58bbc4979216dfaa360bec27e99c7.tar.bz2 | |
make ConstantRange::getSetSize() properly compute the size of wrapped and full sets.
Make it always return APInts with the same bitwidth for the same ConstantRange bitwidth to simply clients
llvm-svn: 160294
Diffstat (limited to 'llvm/unittests/Support/ConstantRangeTest.cpp')
| -rw-r--r-- | llvm/unittests/Support/ConstantRangeTest.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/unittests/Support/ConstantRangeTest.cpp b/llvm/unittests/Support/ConstantRangeTest.cpp index 72540c6..6d2510c 100644 --- a/llvm/unittests/Support/ConstantRangeTest.cpp +++ b/llvm/unittests/Support/ConstantRangeTest.cpp @@ -114,11 +114,15 @@ TEST_F(ConstantRangeTest, SingleElement) { } TEST_F(ConstantRangeTest, GetSetSize) { - EXPECT_EQ(Full.getSetSize(), APInt(16, 0)); - EXPECT_EQ(Empty.getSetSize(), APInt(16, 0)); - EXPECT_EQ(One.getSetSize(), APInt(16, 1)); - EXPECT_EQ(Some.getSetSize(), APInt(16, 0xaa0)); - EXPECT_EQ(Wrap.getSetSize(), APInt(16, 0x10000 - 0xaa0)); + EXPECT_EQ(Full.getSetSize(), APInt(17, 65536)); + EXPECT_EQ(Empty.getSetSize(), APInt(17, 0)); + EXPECT_EQ(One.getSetSize(), APInt(17, 1)); + EXPECT_EQ(Some.getSetSize(), APInt(17, 0xaa0)); + + ConstantRange Wrap(APInt(4, 7), APInt(4, 3)); + ConstantRange Wrap2(APInt(4, 8), APInt(4, 7)); + EXPECT_EQ(Wrap.getSetSize(), APInt(5, 12)); + EXPECT_EQ(Wrap2.getSetSize(), APInt(5, 15)); } TEST_F(ConstantRangeTest, GetMinsAndMaxes) { |
