diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-07-18 06:34:42 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-07-18 06:34:42 +0000 |
commit | 50695f139ae372c9949dfddce603c83f49377b99 (patch) | |
tree | 1e69e339c818903ac78cd8ed80335c25c1a5f5d7 /unittests | |
parent | f32df06245b31a8c6d7336bb40ba0602b0bf2f8a (diff) | |
download | external_llvm-50695f139ae372c9949dfddce603c83f49377b99.zip external_llvm-50695f139ae372c9949dfddce603c83f49377b99.tar.gz external_llvm-50695f139ae372c9949dfddce603c83f49377b99.tar.bz2 |
Replace intersectWith with maximalIntersectWith. The latter guarantees that
all values belonging to the intersection will belong to the resulting range.
The former was inconsistent about that point (either way is fine, just pick
one.) This is part of PR4545.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/ConstantRangeTest.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/unittests/Support/ConstantRangeTest.cpp b/unittests/Support/ConstantRangeTest.cpp index 3ebb929..b77ac6a 100644 --- a/unittests/Support/ConstantRangeTest.cpp +++ b/unittests/Support/ConstantRangeTest.cpp @@ -203,22 +203,13 @@ TEST_F(ConstantRangeTest, IntersectWith) { EXPECT_TRUE(Some.intersectWith(Wrap).isEmptySet()); EXPECT_TRUE(One.intersectWith(Wrap).isEmptySet()); EXPECT_EQ(One.intersectWith(Wrap), Wrap.intersectWith(One)); -} -TEST_F(ConstantRangeTest, MaximalIntersectWith) { - EXPECT_TRUE(Empty.maximalIntersectWith(Full).isEmptySet()); - EXPECT_TRUE(Empty.maximalIntersectWith(Empty).isEmptySet()); - EXPECT_TRUE(Empty.maximalIntersectWith(One).isEmptySet()); - EXPECT_TRUE(Empty.maximalIntersectWith(Some).isEmptySet()); - EXPECT_TRUE(Empty.maximalIntersectWith(Wrap).isEmptySet()); - EXPECT_TRUE(Full.maximalIntersectWith(Full).isFullSet()); - EXPECT_TRUE(Some.maximalIntersectWith(Some) == Some); - EXPECT_TRUE(Some.maximalIntersectWith(One) == One); - EXPECT_TRUE(Full.maximalIntersectWith(One) == One); - EXPECT_TRUE(Full.maximalIntersectWith(Some) == Some); - EXPECT_TRUE(Some.maximalIntersectWith(Wrap).isEmptySet()); - EXPECT_TRUE(One.maximalIntersectWith(Wrap).isEmptySet()); - EXPECT_EQ(One.maximalIntersectWith(Wrap), Wrap.maximalIntersectWith(One)); + // Klee generated testcase from PR4545. + // The intersection of i16 [4, 2) and [6, 5) is disjoint, looking like + // 01..4.6789ABCDEF where the dots represent values not in the intersection. + ConstantRange LHS(APInt(16, 4), APInt(16, 2)); + ConstantRange RHS(APInt(16, 6), APInt(16, 5)); + EXPECT_EQ(LHS.intersectWith(RHS), LHS); } TEST_F(ConstantRangeTest, UnionWith) { |