[Aptitude-devel] r2997 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver

Daniel Burrows dburrows@costa.debian.org
Sun, 10 Apr 2005 02:54:57 +0000


Author: dburrows
Date: Sun Apr 10 02:54:54 2005
New Revision: 2997

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc
Log:
Sprinkle asserts to figure out whodunit.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun Apr 10 02:54:54 2005
@@ -1,5 +1,10 @@
 2005-04-09  Daniel Burrows  <dburrows@debian.org>
 
+	* src/generic/problemresolver/problemresolver.h, src/generic/problemresolver/test.cc:
+
+	  Add asserts in order to try and track down where the IDs that
+	  are too large for the version array are coming from.
+
 	* src/generic/problemresolver/problemresolver.h:
 
 	  Use map's operator< to order solutions rather than hacking my

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	Sun Apr 10 02:54:54 2005
@@ -518,7 +518,10 @@
     int new_action_score=s.get_action_score();
 
     new_action_score+=step_score;
+
+    assert(v.get_id()<universe.get_version_count());
     new_action_score+=version_scores[v.get_id()];
+    assert(v.get_package().current_version().get_id()<universe.get_version_count());
     new_action_score-=version_scores[v.get_package().current_version().get_id()];
 
     std::set<dep> new_broken;
@@ -665,6 +668,7 @@
    */
   void set_version_score(version &ver, int score)
   {
+    assert(ver.get_id()<universe.get_version_count());
     version_scores[ver.get_id()]=score;
   }
 
@@ -673,12 +677,14 @@
    */
   void add_version_score(version &ver, int score)
   {
+    assert(ver.get_id()<universe.get_version_count());
     version_scores[ver.get_id()]+=score;
   }
 
   /** \return the score of the version ver. */
   int get_version_score(version &ver)
   {
+    assert(ver.get_id()<universe.get_version_count());
     return version_scores[ver.get_id()];
   }
 

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc	Sun Apr 10 02:54:54 2005
@@ -345,7 +345,7 @@
       return real_package->get_name();
     }
 
-    int get_id() const
+    unsigned int get_id() const
     {
       return real_package->get_id();
     }
@@ -403,7 +403,7 @@
       return real_version->get_name();
     }
 
-    int get_id() const
+    unsigned int get_id() const
     {
       return real_version->get_id();
     }