summaryrefslogtreecommitdiff
path: root/tests/test_choice_set.cc
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2009-04-08 19:33:12 -0700
committerDaniel Burrows <dburrows@debian.org>2009-04-08 19:33:12 -0700
commita86347892fc41008ea7013aa005d4b649b1b6cec (patch)
tree5e63f6862f604f2e4400644f132551dd5e0820a8 /tests/test_choice_set.cc
parentc685b3c47136b1fd4dd9dd1323a981285c3951f2 (diff)
downloadaptitude-a86347892fc41008ea7013aa005d4b649b1b6cec.tar.gz
Add a test of choice_set::remove_overlaps.
Diffstat (limited to 'tests/test_choice_set.cc')
-rw-r--r--tests/test_choice_set.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_choice_set.cc b/tests/test_choice_set.cc
index 19b31e1b..041137c5 100644
--- a/tests/test_choice_set.cc
+++ b/tests/test_choice_set.cc
@@ -43,6 +43,7 @@ class Choice_Set_Test : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE(Choice_Set_Test);
CPPUNIT_TEST(testInsertNarrow);
+ CPPUNIT_TEST(testRemoveOverlaps);
CPPUNIT_TEST(testGetVersionOf);
CPPUNIT_TEST(testClone);
CPPUNIT_TEST(testContainsChoice);
@@ -249,6 +250,49 @@ public:
test_contents_iterator(s);
}
+ void testRemoveOverlaps()
+ {
+ const choice c1(make_install_version(av1));
+ const choice c2(make_install_version_from_dep_source(bv1, bv2d1));
+ const choice c3(make_install_version(cv2));
+ const choice c4(make_break_soft_dep(av2d1));
+ const choice c5(make_break_soft_dep(bv2d1));
+
+ choice_set s;
+ s.insert_or_narrow(c1);
+ s.insert_or_narrow(c2);
+ s.insert_or_narrow(c3);
+ s.insert_or_narrow(c4);
+ s.insert_or_narrow(c5);
+
+
+ CPPUNIT_ASSERT(s.contains(c1));
+ const choice r1(make_install_version_from_dep_source(av1, av2d1));
+ s.remove_overlaps(r1);
+ CPPUNIT_ASSERT(!s.contains(r1));
+ CPPUNIT_ASSERT(!s.contains(c1));
+
+ CPPUNIT_ASSERT(s.contains(c2));
+ const choice r2(make_install_version(bv1));
+ s.remove_overlaps(r2);
+ CPPUNIT_ASSERT(!s.contains(r2));
+ CPPUNIT_ASSERT(!s.contains(c2));
+
+ CPPUNIT_ASSERT(s.contains(c3));
+ const choice r3(make_install_version(cv2));
+ s.remove_overlaps(r3);
+ CPPUNIT_ASSERT(!s.contains(r3));
+ CPPUNIT_ASSERT(!s.contains(c3));
+
+ CPPUNIT_ASSERT(s.contains(c4));
+ const choice r4(make_break_soft_dep(av2d1));
+ s.remove_overlaps(r4);
+ CPPUNIT_ASSERT(!s.contains(r4));
+ CPPUNIT_ASSERT(!s.contains(c4));
+
+ CPPUNIT_ASSERT(s.contains(c5));
+ }
+
void testContainsChoice()
{
choice_set s;