95 lines
3.2 KiB
Plaintext
95 lines
3.2 KiB
Plaintext
;; Function To Be Tested: LIST
|
|
;;
|
|
;; Source: Guy L Steele's CLTL
|
|
;; Section: 15.2 Lists
|
|
;; Page: 267
|
|
;;
|
|
;; Created By: Karin M. Sye, Kelly Roach
|
|
;;
|
|
;; Creation Date: June 27,1986
|
|
;;
|
|
;; Last Update: Jan 28, 1987 Jim Blum - moved DEFSTRUCT into :before DO-TEST-GROUP
|
|
;; in list4 test due to SUN problem.
|
|
;;
|
|
;; Filed As: {ERIS}<LISPCORE>CML>TEST>15-2-LIST.TEST
|
|
;;
|
|
;;
|
|
;; Syntax: (LIST &REST ARGS)
|
|
;;
|
|
;; Function Description:
|
|
;; LIST constructs and returns a list of its arguments.
|
|
;; For example:
|
|
;;
|
|
;; (LIST 3 4 'A (CAR '(B . C)) (+ 6 -2)) => (3 4 A B 4)
|
|
;;
|
|
;;
|
|
;; Argument(s): ARGS - anything
|
|
;;
|
|
;; Returns: a pure list
|
|
;;
|
|
|
|
|
|
|
|
(do-test "test list0 - test case copied from page 267 of CLtL"
|
|
(equal (list 3 4 'a (car '(b . c)) (+ 6 -2)) '(3 4 a b 4)))
|
|
|
|
;;ROACH 25-JUN-86 This test fails because Xerox's Lisp has
|
|
;;an upper limit on the number of arguments a function can take.
|
|
;;This upper limit on the number of arguments is currently 80.
|
|
;;
|
|
;;(do-test "test list1 - can list take 100 arguments ??"
|
|
;; (equal (list 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999
|
|
;; 999 999 999 999 999 999 999 999 999 999)
|
|
;; (make-list 100 :initial-element 999)))
|
|
|
|
|
|
(do-test "test list2"
|
|
(equal (list "evening" 'sun 'reflected "in Lake" 'Shanti) '("evening" sun reflected "in Lake" Shanti)))
|
|
|
|
|
|
(do-test "test list3 - nested list functions"
|
|
(and
|
|
(equal (setq aa (list (list (list (list (list (list (list (list (list (list 'a 'b 'c 'd 'e 'f 'g 'h 'i 'j 'k)))))))))))
|
|
'((((((((((a b c d e f g h i j k)))))))))) )
|
|
(equal (list aa aa aa aa aa)
|
|
'( ((((((((((a b c d e f g h i j k)))))))))) ((((((((((a b c d e f g h i j k))))))))))
|
|
((((((((((a b c d e f g h i j k)))))))))) ((((((((((a b c d e f g h i j k))))))))))
|
|
((((((((((a b c d e f g h i j k)))))))))) ))))
|
|
|
|
(do-test-group (more-tests
|
|
:before
|
|
(defmacro mac () `(list ,(* 2 2) ,(list-length ())))
|
|
)
|
|
(do-test "test list4"
|
|
(progn
|
|
(setq aa '(a b c d e f g h))
|
|
(equal (list (last aa)
|
|
(nth 3 aa)
|
|
(nthcdr 5 aa)
|
|
(list (car aa) (endp aa))
|
|
(progn 1 2 3 (setq x 1 y 2 z 3))
|
|
(prog2 (defun fun () "fun1") (fun))
|
|
(prog1 (setq a 100) (setq a (1+ a)))
|
|
(mac)
|
|
)
|
|
'( (h) d (f g h) (a nil) 3 "fun1" 100 (4 0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(do-test "test list5"
|
|
(equal (list 1.009 'a (cons 3 4) (funcall #'list 2.009 #\g "string") (every #'evenp '(2 4 6 8)) (not (or 1 100 1000 0))
|
|
(apply #'list 'm 'n 'b '(88)) (list (+ 2 3) (caddr '(w x y z))) )
|
|
'(1.009 a (3 . 4) (2.009 #\g "string") t nil (m n b 88) (5 y))))
|
|
|
|
STOP
|