[funds-cvs] r92 - trunk/funds/tests/trees

abaine at common-lisp.net abaine at common-lisp.net
Thu Jul 12 00:56:21 UTC 2007


Author: abaine
Date: Wed Jul 11 20:56:20 2007
New Revision: 92

Modified:
   trunk/funds/tests/trees/avl-tree-test.lisp
Log:
Made test-tree-insert much more rigorous.

Modified: trunk/funds/tests/trees/avl-tree-test.lisp
==============================================================================
--- trunk/funds/tests/trees/avl-tree-test.lisp	(original)
+++ trunk/funds/tests/trees/avl-tree-test.lisp	Wed Jul 11 20:56:20 2007
@@ -34,8 +34,13 @@
   (assert-avl-valid (make-avl-tree)))
 
 (define-test test-tree-insert
-  (let ((tree (random-tree)))
-    (assert-avl-valid tree)))
+  (loop with tree = (make-avl-tree)
+	with elements = '()
+	repeat 1000
+	do (let ((next (random 500)))
+	     (assert-avl-valid (setf tree (tree-insert tree next (random 1000))))
+	     (assert-equal (length (setf elements (remove-duplicates (cons next elements))))
+			   (tree-weight tree)))))
 
 (define-test test-tree-remove
   (loop with tree = (random-tree)



More information about the Funds-cvs mailing list