1
0
mirror of synced 2026-04-29 21:27:41 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/17-2-SVREF.TEST

49 lines
1.3 KiB
Plaintext

;; Function To Be Tested: svref
;;
;; Source: Common Lisp by Guy Steele
;; Section 17.2: Array Access Page: 291
;;
;; Created By: John Park
;;
;; Creation Date: June 9, 86
;;
;; Last Update: Aug 8, 86
;;
;; Filed as: {eris}<lispcore>cml>test>17-2-svref.test
;;
;; Syntax: svref simple-vector index
;;
;; Function Description: This function accesses and returns the element of
;; a simple vector specified by the index. The index must be non-negative and ;; less than the length of the vector.
;;
;; Argument(s): vector and index
;;
;; Returns: element specified by the index
;;
;; Constraints/limitations: None
(do-test-group vector-access-test
:before (progn
(setq vector1 (vector 'a 'b 'c 'd 'e 'f))
(setq vector2 (vector 'A 2 10 4.3 "hello" -1.7)))
(do-test svref-test1 (and (eq (svref vector1 0) 'a)
(eq (svref vector1 1) 'b)
(eq (svref vector1 2) 'c)
(eq (svref vector1 3) 'd)
(eq (svref vector1 4) 'e)
(eq (svref vector1 5) 'f)))
(do-test svref-test2 (and (equal (svref vector2 0 ) 'A)
(equal (svref vector2 1 ) 2)
(equal (svref vector2 2 ) 10)
(equalp (svref vector2 3 ) 4.3)
(equal (svref vector2 4) "hello")
(equalp (svref vector2 5) -1.7))))
STOP