[Aptitude-svn-commit] r4053 - in branches/aptitude-0.3/aptitude: . tests

Daniel Burrows dburrows at costa.debian.org
Tue Sep 6 18:50:43 UTC 2005


Author: dburrows
Date: Tue Sep  6 18:50:41 2005
New Revision: 4053

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/tests/test_resolver.cc
Log:
Add test for the rejections-gone-wild bug.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Sep  6 18:50:41 2005
@@ -1,5 +1,10 @@
 2005-09-06  Daniel Burrows  <dburrows at debian.org>
 
+	* tests/test_resolver.cc:
+
+	  Add a basic test that the rejection system won't go nuts and
+	  reject other versions of the same package.
+
 	* tests/test_wtree.cc:
 
 	  Strip out some useless debugging dumps and correct some thinkos

Modified: branches/aptitude-0.3/aptitude/tests/test_resolver.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/tests/test_resolver.cc	(original)
+++ branches/aptitude-0.3/aptitude/tests/test_resolver.cc	Tue Sep  6 18:50:41 2005
@@ -82,6 +82,7 @@
 
   CPPUNIT_TEST(testActionCompare);
   CPPUNIT_TEST(testSolutionCompare);
+  CPPUNIT_TEST(testRejections);
 
   CPPUNIT_TEST_SUITE_END();
 
@@ -274,6 +275,29 @@
 
     assertLtEquivalent(s7, s7, solcmp);
   }
+
+  // Check that rejections of versions don't block out all versions of
+  // the package (this actually happened once).  As installing version
+  // 2 of everything is a solution, rejecting the third versions
+  // should be OK.
+  void testRejections()
+  {
+    dummy_universe_ref u = parseUniverse(dummy_universe_1);
+    dummy_resolver r(10, -300, -100, -100000, 0, 50000, u);
+
+    r.reject_version(u.find_package("a").version_from_name("v3"));
+    r.reject_version(u.find_package("b").version_from_name("v3"));
+    r.reject_version(u.find_package("c").version_from_name("v3"));
+
+    try
+      {
+	r.find_next_solution(1000000);
+      }
+    catch(NoMoreSolutions)
+      {
+	CPPUNIT_FAIL("Expected at least one solution, got none.");
+      }
+  }
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ResolverTest);



More information about the Aptitude-svn-commit mailing list