summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2009-07-10 09:23:08 -0700
committerDaniel Burrows <dburrows@debian.org>2009-07-10 09:23:08 -0700
commit99e8d5fb497b5534aa6f7248411b78791dac4df5 (patch)
treef1704dba4a16b7b66df2fdbe6d456a5b08d08053 /tests
parent6b5c3cdd330bc8027eeceda163e1990a2258f6c8 (diff)
parent4a562a1a9d8905e6416ce7de0177968ed1404fa2 (diff)
downloadaptitude-99e8d5fb497b5534aa6f7248411b78791dac4df5.tar.gz
Merge with backout.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_resolver.cc85
1 files changed, 83 insertions, 2 deletions
diff --git a/tests/test_resolver.cc b/tests/test_resolver.cc
index 778a9ec8..d4bc8ce9 100644
--- a/tests/test_resolver.cc
+++ b/tests/test_resolver.cc
@@ -409,7 +409,47 @@ private:
catch(NoMoreSolutions)
{
LOG_TRACE(logger, "Success: only one solution was found.");
- return;
+
+ r.mandate_version(b.version_from_name("v2"));
+
+ try
+ {
+ sol = r.find_next_solution(1000, NULL);
+ LOG_TRACE(logger, "Got another solution after a second mandate: " << sol);
+
+ choice_set expected_solution2;
+ expected_solution2.insert_or_narrow(choice::make_install_version(b.version_from_name("v2"), 0));
+ assertSameEffect(expected_solution2, sol.get_choices());
+ }
+ catch(NoMoreSolutions)
+ {
+ LOG_ERROR(logger, "Mandating a second solution didn't cancel the first mandate.");
+ CPPUNIT_FAIL("Mandating a second solution didn't cancel the first mandate.");
+ }
+
+ try
+ {
+ sol = r.find_next_solution(1000, NULL);
+ LOG_ERROR(logger, "Got an extra solution: " << sol);
+ CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated.");
+ }
+ catch(NoMoreSolutions)
+ {
+ try
+ {
+ dep av1d1 = *a.version_from_name("v1").deps_begin();
+ r.harden(av1d1);
+ r.unharden(av1d1);
+
+ sol = r.find_next_solution(1000, NULL);
+ LOG_ERROR(logger, "Got an extra solution: " << sol);
+ CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated, and after breaking the dep was rejected and unrejected.");
+ }
+ catch(NoMoreSolutions)
+ {
+ return;
+ }
+ }
}
LOG_ERROR(logger, "Found an unexpected solution: " << sol);
@@ -456,7 +496,48 @@ private:
catch(NoMoreSolutions)
{
LOG_TRACE(logger, "Success: only one solution was found.");
- return;
+
+
+ r.mandate_version(b.version_from_name("v2"));
+
+ try
+ {
+ sol = r.find_next_solution(1000, NULL);
+ LOG_TRACE(logger, "Got another solution after a second mandate: " << sol);
+
+ choice_set expected_solution2;
+ expected_solution2.insert_or_narrow(choice::make_install_version(b.version_from_name("v2"), 0));
+ assertSameEffect(expected_solution2, sol.get_choices());
+ }
+ catch(NoMoreSolutions)
+ {
+ LOG_ERROR(logger, "Mandating a second solution didn't cancel the first mandate.");
+ CPPUNIT_FAIL("Mandating a second solution didn't cancel the first mandate.");
+ }
+
+ try
+ {
+ sol = r.find_next_solution(1000, NULL);
+ LOG_ERROR(logger, "Got an extra solution: " << sol);
+ CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated.");
+ }
+ catch(NoMoreSolutions)
+ {
+ try
+ {
+ version bv3(b.version_from_name("v3"));
+ r.reject_version(bv3);
+ r.unreject_version(bv3);
+
+ sol = r.find_next_solution(1000, NULL);
+ LOG_ERROR(logger, "Got an extra solution: " << sol);
+ CPPUNIT_FAIL("Too many solutions after a solution was re-enabled because a solver was mandated, and after a version was rejected and unrejected.");
+ }
+ catch(NoMoreSolutions)
+ {
+ return;
+ }
+ }
}
LOG_ERROR(logger, "Found an unexpected solution: " << sol);