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

Daniel Burrows dburrows at costa.debian.org
Wed Aug 31 23:28:56 UTC 2005


Author: dburrows
Date: Wed Aug 31 23:28:54 2005
New Revision: 4028

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/tests/test_wtree.cc
Log:
Write a test to detect the bug where the children of the
smallest element in the right subtree get lost.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Aug 31 23:28:54 2005
@@ -1,5 +1,10 @@
 2005-08-31  Daniel Burrows  <dburrows at debian.org>
 
+	* tests/test_wtree.cc:
+
+	  Write a test targetted at the bug that showed up today in
+	  imm::set.
+
 	* tests/Makefile.am, tests/interactive_set_test.cc:
 
 	  Add a simple interactive test for the set code.

Modified: branches/aptitude-0.3/aptitude/tests/test_wtree.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/tests/test_wtree.cc	(original)
+++ branches/aptitude-0.3/aptitude/tests/test_wtree.cc	Wed Aug 31 23:28:54 2005
@@ -633,6 +633,26 @@
       int *vals = NULL;
       assertWTreeValues(t, vals, 0);
     }
+
+    // Test for a specific error that occurs when deleting a node for
+    // which the smallest element of the right child has its own right
+    // child.
+    //
+    // \todo this is tuned for a specific balancing implementation and
+    // might not detect an equivalent error in another implementation.
+    {
+      t = imm::set<int>();
+      t.insert(50);
+      t.insert(75);
+      t.insert(25);
+      t.insert(62);
+      t.insert(87);
+      t.insert(68);
+      t.erase(50);
+
+      int vals[] = {25, 62, 68, 75, 87};
+      assertWTreeValues(t, vals, 5);
+    }
   }
 
   void mapTest()



More information about the Aptitude-svn-commit mailing list