summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/ConstantRangeTest.cpp
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
commit0d1390356312fbaff47dcbffa53d2579de47378f (patch)
tree119d098082d6b2a6810a5a1e35cf90252bb8eba2 /llvm/unittests/Support/ConstantRangeTest.cpp
parente9812bdac5c678e635fde0b056087cea89589e06 (diff)
downloadbcm5719-llvm-0d1390356312fbaff47dcbffa53d2579de47378f.tar.gz
bcm5719-llvm-0d1390356312fbaff47dcbffa53d2579de47378f.zip
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. llvm-svn: 76289
Diffstat (limited to 'llvm/unittests/Support/ConstantRangeTest.cpp')
-rw-r--r--llvm/unittests/Support/ConstantRangeTest.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/llvm/unittests/Support/ConstantRangeTest.cpp b/llvm/unittests/Support/ConstantRangeTest.cpp
index 3ebb92967fd..b77ac6aece0 100644
--- a/llvm/unittests/Support/ConstantRangeTest.cpp
+++ b/llvm/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) {
OpenPOWER on IntegriCloud