aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-07-18 06:34:42 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-07-18 06:34:42 +0000
commit3a4a884c1618d94202ee714ea5c899cd80d1c536 (patch)
tree1e69e339c818903ac78cd8ed80335c25c1a5f5d7 /unittests
parentd370d776aa6f28866563cdc85abbc32f20a96ec7 (diff)
downloadexternal_llvm-3a4a884c1618d94202ee714ea5c899cd80d1c536.zip
external_llvm-3a4a884c1618d94202ee714ea5c899cd80d1c536.tar.gz
external_llvm-3a4a884c1618d94202ee714ea5c899cd80d1c536.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.cpp21
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) {