diff --git a/ansi-tests/gclload2.lsp b/ansi-tests/gclload2.lsp index 631ecfab39b7120428e850b62fe504f0a1bfd25a..7f2faba9523a1965e241675cbb7e8832790a3b73 100644 --- a/ansi-tests/gclload2.lsp +++ b/ansi-tests/gclload2.lsp @@ -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 diff --git a/ansi-tests/hash-table-p.lsp b/ansi-tests/hash-table-p.lsp new file mode 100644 index 0000000000000000000000000000000000000000..0013f8be3230f9c31174118acf03dd72b5d4899f --- /dev/null +++ b/ansi-tests/hash-table-p.lsp @@ -0,0 +1,43 @@ +;-*- 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) + diff --git a/ansi-tests/hash-table.lsp b/ansi-tests/hash-table.lsp index fb6c5fd2f968868a45ab56711d41dcbba7dd97b2..fdac74949f32dfaf2167ab384700fdcea9e396dd 100644 --- a/ansi-tests/hash-table.lsp +++ b/ansi-tests/hash-table.lsp @@ -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) - diff --git a/ansi-tests/load-hash-tables.lsp b/ansi-tests/load-hash-tables.lsp new file mode 100644 index 0000000000000000000000000000000000000000..b0f2899ba78f4ad8257ee8e0dc2dc79f8f2047aa --- /dev/null +++ b/ansi-tests/load-hash-tables.lsp @@ -0,0 +1,3 @@ +(load "hash-table.lsp") +(load "make-hash-table.lsp") +(load "hash-table-p.lsp") \ No newline at end of file diff --git a/ansi-tests/make-hash-table.lsp b/ansi-tests/make-hash-table.lsp index b6750efa43e4f3547d252cadbf5ae5d85aa1b113..db6e7a3738216f9e4af136fcd3406f0834460328 100644 --- a/ansi-tests/make-hash-table.lsp +++ b/ansi-tests/make-hash-table.lsp @@ -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) + + + + + + + + + + +