comparison tests/automated/hash-table-tests.el @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children db7c7e251153
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
162 162
163 (let ((ht (make-hash-table :size 100 :rehash-threshold .6 :test 'eq))) 163 (let ((ht (make-hash-table :size 100 :rehash-threshold .6 :test 'eq)))
164 (dotimes (j iterations) 164 (dotimes (j iterations)
165 (puthash (+ one 0.0) t ht) 165 (puthash (+ one 0.0) t ht)
166 (puthash (+ two 0.0) t ht) 166 (puthash (+ two 0.0) t ht)
167 (puthash (concat "1" "2") t ht) 167 (puthash (cons 1 2) t ht)
168 (puthash (concat "3" "4") t ht)) 168 (puthash (cons 3 4) t ht))
169 (Assert (eq (hashtable-test-function ht) 'eq)) 169 (Assert (eq (hashtable-test-function ht) 'eq))
170 (Assert (eq (hash-table-test ht) 'eq)) 170 (Assert (eq (hash-table-test ht) 'eq))
171 (Assert (= (* iterations 4) (hash-table-count ht))) 171 (Assert (= (* iterations 4) (hash-table-count ht)))
172 (Assert (eq nil (gethash 1.0 ht))) 172 (Assert (eq nil (gethash 1.0 ht)))
173 (Assert (eq nil (gethash "12" ht))) 173 (Assert (eq nil (gethash '(1 . 2) ht)))
174 (check-copy ht) 174 (check-copy ht)
175 ) 175 )
176 176
177 (let ((ht (make-hash-table :size 100 :rehash-threshold .6 :test 'eql))) 177 (let ((ht (make-hash-table :size 100 :rehash-threshold .6 :test 'eql)))
178 (dotimes (j iterations) 178 (dotimes (j iterations)
179 (puthash (+ one 0.0) t ht) 179 (puthash (+ one 0.0) t ht)
180 (puthash (+ two 0.0) t ht) 180 (puthash (+ two 0.0) t ht)
181 (puthash (concat "1" "2") t ht) 181 (puthash (cons 1 2) t ht)
182 (puthash (concat "3" "4") t ht)) 182 (puthash (cons 3 4) t ht))
183 (Assert (eq (hashtable-test-function ht) 'eql)) 183 (Assert (eq (hashtable-test-function ht) 'eql))
184 (Assert (eq (hash-table-test ht) 'eql)) 184 (Assert (eq (hash-table-test ht) 'eql))
185 (Assert (= (+ 2 (* 2 iterations)) (hash-table-count ht))) 185 (Assert (= (+ 2 (* 2 iterations)) (hash-table-count ht)))
186 (Assert (eq t (gethash 1.0 ht))) 186 (Assert (eq t (gethash 1.0 ht)))
187 (Assert (eq nil (gethash "12" ht))) 187 (Assert (eq nil (gethash '(1 . 2) ht)))
188 (check-copy ht) 188 (check-copy ht)
189 ) 189 )
190 190
191 (let ((ht (make-hash-table :size 100 :rehash-threshold .6 :test 'equal))) 191 (let ((ht (make-hash-table :size 100 :rehash-threshold .6 :test 'equal)))
192 (dotimes (j iterations) 192 (dotimes (j iterations)
193 (puthash (+ one 0.0) t ht) 193 (puthash (+ one 0.0) t ht)
194 (puthash (+ two 0.0) t ht) 194 (puthash (+ two 0.0) t ht)
195 (puthash (concat "1" "2") t ht) 195 (puthash (cons 1 2) t ht)
196 (puthash (concat "3" "4") t ht)) 196 (puthash (cons 3 4) t ht))
197 (Assert (eq (hashtable-test-function ht) 'equal)) 197 (Assert (eq (hashtable-test-function ht) 'equal))
198 (Assert (eq (hash-table-test ht) 'equal)) 198 (Assert (eq (hash-table-test ht) 'equal))
199 (Assert (= 4 (hash-table-count ht))) 199 (Assert (= 4 (hash-table-count ht)))
200 (Assert (eq t (gethash 1.0 ht))) 200 (Assert (eq t (gethash 1.0 ht)))
201 (Assert (eq t (gethash "12" ht))) 201 (Assert (eq t (gethash '(1 . 2) ht)))
202 (check-copy ht) 202 (check-copy ht)
203 ) 203 )
204 204
205 )) 205 ))
206 206