source: trunk/source/tests/ansi-tests/remhash.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Fri Nov 28 08:58:06 2003
4;;;; Contains: Tests of REMHASH
5
6(in-package :cl-test)
7
8(deftest remhash.1
9  (let ((table (make-hash-table)))
10    (values (gethash 'a table)
11            (remhash 'a table)
12            (setf (gethash 'a table) 'b)
13            (gethash 'a table)
14            (notnot (remhash 'a table))
15            (gethash 'a table)))
16  nil nil b b t nil)
17
18(deftest remhash.2
19  (let ((table (make-hash-table :test 'eq)))
20    (values (gethash 'a table)
21            (remhash 'a table)
22            (setf (gethash 'a table) 'b)
23            (gethash 'a table)
24            (notnot (remhash 'a table))
25            (gethash 'a table)))
26  nil nil b b t nil)
27
28(deftest remhash.3
29  (let ((table (make-hash-table :test 'equal)))
30    (values (gethash 'a table)
31            (remhash 'a table)
32            (setf (gethash 'a table) 'b)
33            (gethash 'a table)
34            (notnot (remhash 'a table))
35            (gethash 'a table)))
36  nil nil b b t nil)
37
38(deftest remhash.4
39  (let ((table (make-hash-table :test 'equalp)))
40    (values (gethash 'a table)
41            (remhash 'a table)
42            (setf (gethash 'a table) 'b)
43            (gethash 'a table)
44            (notnot (remhash 'a table))
45            (gethash 'a table)))
46  nil nil b b t nil)
47
48(deftest remhash.5
49  (remhash 'a (make-hash-table))
50  nil)
51
52(deftest remhash.6
53  (notnot-mv (remhash nil (let ((table (make-hash-table)))
54                            (setf (gethash nil table) t)
55                            table)))
56  t)
57
58(deftest remhash.order.1
59  (let ((i 0) x y)
60    (values
61     (remhash (progn (setf x (incf i)) 'a)
62              (progn (setf y (incf i)) (make-hash-table)))
63     i x y))
64  nil 2 1 2)
65
66;;; Error tests
67
68(deftest remhash.error.1
69  (signals-error (remhash) program-error)
70  t)
71
72(deftest remhash.error.2
73  (signals-error (remhash 'a) program-error)
74  t)
75
76(deftest remhash.error.3
77  (signals-error (remhash 'a (make-hash-table) nil) program-error)
78  t)
79
80
81
82
83
84
85
86           
Note: See TracBrowser for help on using the repository browser.