hash-table-rehash-size.lsp 1.15 KB
Newer Older
1 2 3 4 5 6 7 8 9
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Fri Nov 28 05:47:24 2003
;;;; Contains: Tests for HASH-TABLE-REHASH-SIZE

(in-package :cl-test)

(deftest hash-table-rehash-size.1
  (typep* (hash-table-rehash-size (make-hash-table))
sds's avatar
sds committed
10
          '(or (integer 1 *) (float (1.0) *)))
11 12 13 14
  t)

(deftest hash-table-rehash-size.2
  (loop for test in '(eq eql equal equalp)
sds's avatar
sds committed
15 16 17
        unless (typep* (hash-table-rehash-size (make-hash-table :test test))
                       '(or (integer 1 *) (float (1.0) *)))
        collect test)
18 19 20 21
  nil)

(deftest hash-table-rehash-size.3
  (loop for test in '(eq eql equal equalp)
sds's avatar
sds committed
22 23 24 25
        for fn = (symbol-function test)
        unless (typep* (hash-table-rehash-size (make-hash-table :test fn))
                       '(or (integer 1 *) (float (1.0) *)))
        collect test)
26 27 28
  nil)

(deftest hash-table-rehash-size.error.1
29 30
  (signals-error (hash-table-rehash-size) program-error)
  t)
31 32

(deftest hash-table-rehash-size.error.2
33
  (signals-error (hash-table-rehash-size (make-hash-table) nil)
sds's avatar
sds committed
34
                 program-error)
35
  t)
36 37

(deftest hash-table-rehash-size.error.3
38
  (check-type-error #'hash-table-rehash-size #'hash-table-p)
39
  nil)