svref.lsp 583 Bytes
Newer Older
pfdietz's avatar
pfdietz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Wed Jan 22 21:39:30 2003
;;;; Contains: Tests of SVREF

(in-package :cl-test)

(deftest svref.1
  (let ((a (vector 1 2 3 4)))
    (loop for i below 4 collect (svref a i)))
  (1 2 3 4))

(deftest svref.2
  (let ((a (vector 1 2 3 4)))
    (values
     (loop for i below 4
	   collect (setf (svref a i) (+ i 10)))
     a))
  (10 11 12 13)
  #(10 11 12 13))

;;; Error tests

(deftest svref.error.1
  (classify-error (svref))
  program-error)

(deftest svref.error.2
  (classify-error (svref (vector 1)))
  program-error)