From b100a65010dfed1b4532d75a345a630d5f27e7b4 Mon Sep 17 00:00:00 2001
From: pfdietz <pfdietz@localhost>
Date: Tue, 30 Sep 2003 11:41:35 +0000
Subject: [PATCH] Start of hash table tests.

---
 ansi-tests/gclload2.lsp         |   5 +-
 ansi-tests/hash-table-p.lsp     |  43 ++++++++++++++
 ansi-tests/hash-table.lsp       |  30 ----------
 ansi-tests/load-hash-tables.lsp |   3 +
 ansi-tests/make-hash-table.lsp  | 101 ++++++++++++++++++++++++++++++--
 5 files changed, 143 insertions(+), 39 deletions(-)
 create mode 100644 ansi-tests/hash-table-p.lsp
 create mode 100644 ansi-tests/load-hash-tables.lsp

diff --git a/ansi-tests/gclload2.lsp b/ansi-tests/gclload2.lsp
index 631ecfab..7f2faba9 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 00000000..0013f8be
--- /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 fb6c5fd2..fdac7494 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 00000000..b0f2899b
--- /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 b6750efa..db6e7a37 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)
+
+
+
+
+
+
+
+
+
+
+
      
     
-- 
GitLab