Commit b100a650 authored by pfdietz's avatar pfdietz

Start of hash table tests.

parent 2d1f46f3
......@@ -25,10 +25,7 @@
(load "load-arrays.lsp")
;;; Tests of hash tables
(load "hash-table.lsp")
(load "make-hash-table.lsp")
; More to come
(load "load-hash-tables.lsp")
;;; Tests of packages
......
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Tue Sep 16 21:58:37 2003
;;;; Contains: Tests for HASH-TABLE-P
(in-package :cl-test)
(deftest hash-table-p.1
(loop for e in '(nil t 1 10.0 (a b c) #(a b c) #*1011
#0aNIL #2a((a b)(c d)) #p"foo"
"bar" #\a 3/5 #c(1.0 2.0))
when (hash-table-p e)
collect e)
nil)
(deftest hash-table-p.2
(loop for e in *universe*
for p = (typep e 'hash-table)
for q = (hash-table-p e)
always (if p q (not q)))
t)
(deftest hash-table-p.3
(let ((i 0))
(values (hash-table-p (incf i)) i))
nil 1)
(deftest hash-table-p.4
(hash-table-p t)
nil)
(deftest hash-table-p.5
(notnot-mv (hash-table-p (make-hash-table)))
t)
(deftest hash-table-p.error.1
(classify-error (hash-table-p))
program-error)
(deftest hash-table-p.error.2
(classify-error (let ((h (make-hash-table))) (hash-table-p h nil)))
program-error)
......@@ -34,36 +34,6 @@
(notnot-mv (typep (make-hash-table) (find-class 'hash-table)))
t)
;;;
(deftest hash-table-p.1
(loop for e in '(nil t 1 10.0 (a b c) #(a b c) #*1011
#0aNIL #2a((a b)(c d)) #p"foo"
"bar" #\a 3/5 #c(1.0 2.0))
when (hash-table-p e)
collect e)
nil)
(deftest hash-table-p.2
(loop for e in *universe*
for p = (typep e 'hash-table)
for q = (hash-table-p e)
always (if p q (not q)))
t)
(deftest hash-table-p.3
(let ((i 0))
(values (hash-table-p (incf i)) i))
nil 1)
(deftest hash-table-p.error.1
(classify-error (hash-table-p))
program-error)
(deftest hash-table-p.error.2
(classify-error (let ((h (make-hash-table))) (hash-table-p h nil)))
program-error)
......
(load "hash-table.lsp")
(load "make-hash-table.lsp")
(load "hash-table-p.lsp")
\ No newline at end of file
......@@ -4,13 +4,104 @@
;;;; Contains: Tests for MAKE-HASH-TABLE
(in-package :cl-test)
#|
(deftest make-hash-table.1
(let ((ht (make-hash-table)))
(values
(check-values (typep ht 'hash-table))
(notnot (check-values (hash-table-p ht)))
(check-values (hash-table-count ht))
|#
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.2
(let ((ht (make-hash-table :size 0)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.3
(let ((ht (make-hash-table :size 100)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.4
(let ((ht (make-hash-table :test #'eq)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.5
(let ((ht (make-hash-table :test 'eq)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.6
(let ((ht (make-hash-table :test #'eql)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.7
(let ((ht (make-hash-table :test 'eql)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.8
(let ((ht (make-hash-table :test #'equal)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.9
(let ((ht (make-hash-table :test 'equal)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.10
(let ((ht (make-hash-table :test #'equalp)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
(deftest make-hash-table.11
(let ((ht (make-hash-table :test 'equalp)))
(values
(notnot (typep ht 'hash-table))
(notnot (hash-table-p ht))
(hash-table-count ht)))
t t 0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment