remhash tests
[jscl.git] / tests / hash-tables.lisp
1
2 (let ((ht (make-hash-table))
3       (key "foo"))
4   (setf (gethash key ht) 10)
5   (test (null (gethash "foo" ht)))
6   (test (equal (gethash key ht) 10))
7   (setf (gethash 'foo ht) "lisp")
8   (test (string= (gethash 'foo ht) "lisp")))
9
10
11 (let ((ht (make-hash-table :test #'equal)))
12   (setf (gethash "foo" ht) 10)
13   (test (equal (gethash "foo" ht) 10)))
14
15
16 (let ((ht (make-hash-table :test #'equal)))
17   (setf (gethash "foo" ht) 10)
18   (test (eq (remhash "foo" ht) t))
19   (test (eq (remhash "foo" ht) nil))
20   (test (null (gethash "foo" ht))))
21
22