111 lines
3.2 KiB
Plaintext
111 lines
3.2 KiB
Plaintext
;; Function To Be Tested: HArrayP
|
|
;;
|
|
;; Source: IRM, p 9.2
|
|
;;
|
|
;; Chapter 9: Conditionals And Iterative Statements
|
|
;; Section 1: Data Type Predicates
|
|
;;
|
|
;; Created By: Henry Cate III
|
|
;;
|
|
;; Creation Date: March 17, 1987
|
|
;;
|
|
;; Last Update:
|
|
;;
|
|
;; Filed As: {eris}<lispcore>test>DataTypes>HArrayP.test
|
|
;;
|
|
;;
|
|
|
|
|
|
(do-test "test simple cases"
|
|
(let* ((temp-harray1 (il:hasharray 5))
|
|
(temp-harray2 (il:hasharray 3 1.7)))
|
|
(and
|
|
(equal temp-harray1 (il:harrayp temp-harray1))
|
|
(equal temp-harray2 (il:harrayp temp-harray2))
|
|
(eq nil (il:harrayp -5))
|
|
(eq nil (il:harrayp 1000000))
|
|
(eq nil (il:harrayp 'a-floatp))
|
|
(eq nil (il:harrayp 12.34))
|
|
)))
|
|
|
|
|
|
(do-test "Test various combinations"
|
|
(let* ((temp-harray1 (il:hasharray 3 5))
|
|
(temp-harray2 (il:hasharray 10 2.5))
|
|
(temp-harray3 (il:hasharray 4 nil)))
|
|
(and
|
|
(equal temp-harray1 (il:harrayp temp-harray1))
|
|
(equal temp-harray2 (il:harrayp temp-harray2))
|
|
(equal temp-harray3 (il:harrayp temp-harray3))
|
|
)))
|
|
|
|
|
|
(do-test "Test go on own function"
|
|
(flet ((temp-small nil (il:hasharray 3)))
|
|
(test-defun temp-fun nil (make-hash-table))
|
|
(and
|
|
(il:harrayp (temp-small))
|
|
(il:harrayp (temp-fun))
|
|
)))
|
|
|
|
|
|
(do-test "Try various types of Litatoms"
|
|
(and
|
|
(eq nil (il:harrayp 'ABCDEFGHIJKLMNOPQRSTUVWXYZ))
|
|
(eq nil (il:harrayp 'A-couple-dashs))
|
|
(eq nil (il:harrayp 'Numbers-1234567890))
|
|
|
|
(eq nil (il:harrayp 'il:other-packags))
|
|
(eq nil (il:harrayp 'il:other-packagsNumbers-1234567890))
|
|
(eq nil (il:harrayp 'il:other-packagsA-couple-dashs))
|
|
|
|
(eq nil (il:harrayp T))
|
|
(eq nil (il:harrayp nil))
|
|
(eq nil (il:harrayp ()))
|
|
(eq nil (il:harrayp '()))
|
|
(eq nil (il:harrayp (list)))
|
|
(eq nil (il:harrayp (eq 1 2)))
|
|
))
|
|
|
|
|
|
(do-test "Test stop on own function"
|
|
(flet ((tee nil t) (nill nil nil) (temp-litatom nil 'litatom)
|
|
(temp-string nil "string"))
|
|
(test-defun temp-fun nil 'litatom)
|
|
(test-setq temp-litatom 'il:temp-pointed)
|
|
(and
|
|
(eq nil (il:harrayp (tee)))
|
|
(eq nil (il:harrayp (nill)))
|
|
(eq nil (il:harrayp (temp-litatom)))
|
|
(eq nil (il:harrayp (temp-string)))
|
|
(eq nil (il:harrayp (temp-fun)))
|
|
(eq nil (il:harrayp temp-litatom))
|
|
)))
|
|
|
|
|
|
(do-test "Stop on harrayps from system functions"
|
|
(and
|
|
(eq nil (il:harrayp (car '(#*1001 '#( 5 4 3 2 1)))))
|
|
(eq nil (il:harrayp (second '(#\. #\k))))
|
|
))
|
|
|
|
|
|
(do-test "Test other datatypes aren't lists"
|
|
(and
|
|
(eq nil (il:harrayp #\backspace)) ; character
|
|
(eq nil (il:harrayp #\*)) ; character
|
|
(eq nil (il:harrayp #\.)) ; character
|
|
(eq nil (il:harrayp (car (list-all-packages)))) ; packages
|
|
(eq nil (il:harrayp (pathname nil))) ; pathname
|
|
(eq nil (il:harrayp *random-state*)) ; ramdom state
|
|
(eq nil (il:harrayp #'cons)) ; compiled function
|
|
(eq nil (il:harrayp (copy-readtable))) ; readtable
|
|
(eq nil (il:harrayp #*1001)) ; simple-bit-vector
|
|
(eq nil (il:harrayp "twine")) ; simple-string
|
|
(eq nil (il:harrayp (make-synonym-stream nil))) ; stream
|
|
(eq nil (il:harrayp '#( 5 4 3 2 1))) ; vector
|
|
))
|
|
|
|
STOP
|
|
|