clrhash.lsp 1.57 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Fri Nov 28 09:33:40 2003
;;;; Contains: Tests of CLRHASH

6

7 8 9 10 11 12 13

(deftest clrhash.1
  (let ((table (make-hash-table)))
    (setf (gethash 'a table) 'b)
    (values
     (hash-table-count table)
     (equalt (multiple-value-list (clrhash table))
sds's avatar
sds committed
14
             (list table))
15 16 17 18 19 20 21 22 23
     (hash-table-count table)))
  1 t 0)

(deftest clrhash.2
  (let ((table (make-hash-table :test 'eq)))
    (setf (gethash 'a table) 'b)
    (values
     (hash-table-count table)
     (equalt (multiple-value-list (clrhash table))
sds's avatar
sds committed
24
             (list table))
25 26 27 28 29 30 31 32 33
     (hash-table-count table)))
  1 t 0)

(deftest clrhash.3
  (let ((table (make-hash-table :test 'equal)))
    (setf (gethash 'a table) 'b)
    (values
     (hash-table-count table)
     (equalt (multiple-value-list (clrhash table))
sds's avatar
sds committed
34
             (list table))
35 36 37 38 39 40 41 42 43
     (hash-table-count table)))
  1 t 0)

(deftest clrhash.4
  (let ((table (make-hash-table :test 'equalp)))
    (setf (gethash 'a table) 'b)
    (values
     (hash-table-count table)
     (equalt (multiple-value-list (clrhash table))
sds's avatar
sds committed
44
             (list table))
45 46 47 48 49 50 51 52 53
     (hash-table-count table)))
  1 t 0)

(deftest clrhash.5
  (let ((table (make-hash-table :test 'eql)))
    (setf (gethash 'a table) 'b)
    (values
     (hash-table-count table)
     (equalt (multiple-value-list (clrhash table))
sds's avatar
sds committed
54
             (list table))
55 56 57 58 59 60
     (hash-table-count table)))
  1 t 0)

;;;

(deftest clrhash.error.1
61 62
  (signals-error (clrhash) program-error)
  t)
63 64

(deftest clrhash.error.2
65
  (signals-error (clrhash (make-hash-table) nil)
sds's avatar
sds committed
66
                 program-error)
67 68
  t)

69