update.
[chise/xemacs-chise.git.1] / tests / automated / hash-table-tests.el
index 0c7247e..f3465c2 100644 (file)
@@ -41,7 +41,7 @@
   (dolist (size '(0 1 100))
     (dolist (rehash-size '(1.1 9.9))
       (dolist (rehash-threshold '(0.2 .9))
-       (dolist (weakness '(nil t key value))
+       (dolist (weakness '(nil key value key-or-value key-and-value))
          (dolist (data '(() (1 2) (1 2 3 4)))
            (let ((ht (make-hash-table
                       :test test
              (Assert (eq weakness (hash-table-weakness ht))))))))))
 
 (loop for (fun weakness) in '((make-hashtable nil)
-                             (make-weak-hashtable t)
+                             (make-weak-hashtable key-and-value)
                              (make-key-weak-hashtable key)
                              (make-value-weak-hashtable value))
   do (Assert (eq weakness (hash-table-weakness (funcall fun 10)))))
 
 (loop for (type weakness) in '((non-weak nil)
-                              (weak t)
+                              (weak key-and-value)
                               (key-weak key)
                               (value-weak value))
   do (Assert (equal (make-hash-table :type type)
 
   (let ((k-sum 0) (v-sum 0))
     (maphash #'(lambda (k v) (incf k-sum k) (incf v-sum v)) ht)
-    (print k-sum)
-    (print v-sum)
     (Assert (= k-sum (/ (* size (- size 1)) 2)))
     (Assert (= v-sum (- k-sum))))
 
     (dotimes (j iterations)
       (puthash (+ one 0.0) t ht)
       (puthash (+ two 0.0) t ht)
-      (puthash (concat "1" "2") t ht)
-      (puthash (concat "3" "4") t ht))
+      (puthash (cons 1 2) t ht)
+      (puthash (cons 3 4) t ht))
     (Assert (eq (hashtable-test-function ht) 'eq))
     (Assert (eq (hash-table-test ht) 'eq))
     (Assert (= (* iterations 4) (hash-table-count ht)))
     (Assert (eq nil (gethash 1.0 ht)))
-    (Assert (eq nil (gethash "12" ht)))
+    (Assert (eq nil (gethash '(1 . 2) ht)))
     (check-copy ht)
     )
 
     (dotimes (j iterations)
       (puthash (+ one 0.0) t ht)
       (puthash (+ two 0.0) t ht)
-      (puthash (concat "1" "2") t ht)
-      (puthash (concat "3" "4") t ht))
+      (puthash (cons 1 2) t ht)
+      (puthash (cons 3 4) t ht))
     (Assert (eq (hashtable-test-function ht) 'eql))
     (Assert (eq (hash-table-test ht) 'eql))
     (Assert (= (+ 2 (* 2 iterations)) (hash-table-count ht)))
     (Assert (eq t (gethash 1.0 ht)))
-    (Assert (eq nil (gethash "12" ht)))
+    (Assert (eq nil (gethash '(1 . 2) ht)))
     (check-copy ht)
     )
 
     (dotimes (j iterations)
       (puthash (+ one 0.0) t ht)
       (puthash (+ two 0.0) t ht)
-      (puthash (concat "1" "2") t ht)
-      (puthash (concat "3" "4") t ht))
+      (puthash (cons 1 2) t ht)
+      (puthash (cons 3 4) t ht))
     (Assert (eq (hashtable-test-function ht) 'equal))
     (Assert (eq (hash-table-test ht) 'equal))
     (Assert (= 4 (hash-table-count ht)))
     (Assert (eq t (gethash 1.0 ht)))
-    (Assert (eq t (gethash "12" ht)))
+    (Assert (eq t (gethash '(1 . 2) ht)))
     (check-copy ht)
     )