[elephant-cvs] CVS elephant/tests

ieslick ieslick at common-lisp.net
Tue Feb 20 19:12:59 UTC 2007


Update of /project/elephant/cvsroot/elephant/tests
In directory clnet:/tmp/cvs-serv13701/tests

Modified Files:
	MigrationTests.lisp testcollections.lisp testindexing.lisp 
Log Message:
Export btree utilities; implement efficient map operators, reimplement get-instance methods; add test of map-index; better declarations

--- /project/elephant/cvsroot/elephant/tests/MigrationTests.lisp	2006/02/23 14:42:16	1.2
+++ /project/elephant/cvsroot/elephant/tests/MigrationTests.lisp	2007/02/20 19:12:59	1.3
@@ -34,9 +34,9 @@
 ;; use for the migration tests.
 
 ;; This this configuration for testing between BDB and SQL....
-(setq *test-path-primary* *testpg-spec*)
+;;(setq *test-path-primary* *testpg-spec*)
 ;; (setq *test-path-primary* *testsqlite3-path*)
-(setq *test-path-secondary* *testbdb-spec*)
+;;(setq *test-path-secondary* *testbdb-spec*)
 
 
 ;; This this configuration for testing from one BDB repository to another...
@@ -45,5 +45,5 @@
 (setq *test-path-secondary* *testbdb-spec2*)
 
 (do-migration-tests *testbdb-spec* *testbdb-spec2*)
-(do-migration-tests *testbdb-spec2* *testpg-spec*)
+;;(do-migration-tests *testbdb-spec2* *testpg-spec*)
 
--- /project/elephant/cvsroot/elephant/tests/testcollections.lisp	2007/02/04 10:08:28	1.16
+++ /project/elephant/cvsroot/elephant/tests/testcollections.lisp	2007/02/20 19:12:59	1.17
@@ -312,6 +312,17 @@
 	  (= (slot2 v) 600))))
   t)
 
+(deftest map-indexed-index
+    (let ((sum 0))
+      (flet ((collector (key value pkey)
+	       (incf sum (slot1 value))))
+	(map-index #'collector index1 :start nil :end 10)
+	(map-index #'collector index1 :start 690 :end nil)
+	(map-index #'collector index1 :start 400 :end 410))
+      sum)
+  267299)
+
+
 (deftest rem-kv
     (with-transaction (:store-controller *store-controller*)
       (let ((ibt (make-indexed-btree *store-controller*)))
--- /project/elephant/cvsroot/elephant/tests/testindexing.lisp	2007/02/08 22:33:35	1.26
+++ /project/elephant/cvsroot/elephant/tests/testindexing.lisp	2007/02/20 19:12:59	1.27
@@ -428,6 +428,13 @@
 		  (push val objects)))))
       objects)))
 
+(defun normal-lookup ()
+  (let ((normal-check nil))
+    (dotimes (i *range-size*)
+      (push (length (normal-range-lookup *stress-count* *range-size*))
+	    normal-check))
+    normal-check))
+
 (defun indexed-range-lookup (class count size)
   (let* ((start (/ count 2))
 	 (end (1- (+ start size)))
@@ -436,8 +443,13 @@
     res
     ))
 
-
-
+(defun index-lookup ()
+  (let ((index-check nil))
+    (dotimes (i *range-size*)
+      (push (length (indexed-range-lookup 'stress-index *stress-count* *range-size*))
+	    index-check))
+    index-check))
+  
 (deftest indexing-timing
     (progn
       (make-stress-classes)
@@ -458,18 +470,12 @@
 	  (indexed-stress-setup *stress-count* 'stress-index :stress2 10))
 
 	(setf start (get-internal-run-time))
-	(dotimes (i *range-size*)
-	  (declare (ignore i))
-	  (push (length (normal-range-lookup *stress-count* *range-size*))
-		normal-check))
+	(setf normal-check (normal-lookup))
 	(setf end (get-internal-run-time))
 	(setf normal-time (/ (- end start 0.0) internal-time-units-per-second))
 
 	(setf start (get-internal-run-time))
-	(dotimes (i *range-size*)
-	  (declare (ignore i))
-	  (push (length (indexed-range-lookup 'stress-index *stress-count* *range-size*))
-		index-check))
+	(setf index-check (index-lookup))
 	(setf end (get-internal-run-time))
 	(setf index-time (/ (- end start 0.0) internal-time-units-per-second))
 	(format t "~%Ranged get of ~A/~A objects = Linear: ~A sec Indexed: ~A sec~%"




More information about the Elephant-cvs mailing list