source: trunk/source/tests/ansi-tests/svref.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.2 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Wed Jan 22 21:39:30 2003
4;;;; Contains: Tests of SVREF
5
6(in-package :cl-test)
7
8(deftest svref.1
9  (let ((a (vector 1 2 3 4)))
10    (loop for i below 4 collect (svref a i)))
11  (1 2 3 4))
12
13(deftest svref.2
14  (let ((a (vector 1 2 3 4)))
15    (values
16     (loop for i below 4
17           collect (setf (svref a i) (+ i 10)))
18     a))
19  (10 11 12 13)
20  #(10 11 12 13))
21
22(deftest svref.order.1
23  (let ((v (vector 'a 'b 'c 'd))
24        (i 0) a b)
25    (values
26     (svref (progn (setf a (incf i)) v)
27            (progn (setf b (incf i)) 2))
28     i a b))
29  c 2 1 2)
30
31(deftest svref.order.2
32  (let ((v (vector 'a 'b 'c 'd))
33        (i 0) a b c)
34    (values
35     (setf
36      (svref (progn (setf a (incf i)) v)
37             (progn (setf b (incf i)) 2))
38      (progn (setf c (incf i)) 'w))
39     v i a b c))
40  w #(a b w d) 3 1 2 3)
41
42
43;;; Error tests
44
45(deftest svref.error.1
46  (signals-error (svref) program-error)
47  t)
48
49(deftest svref.error.2
50  (signals-error (svref (vector 1)) program-error)
51  t)
52
53(deftest svref.error.3
54  (signals-error (svref (vector 1) 0 0) program-error)
55  t)
56
57(deftest svref.error.4
58  (signals-error (svref (vector 1) 0 nil) program-error)
59  t)
Note: See TracBrowser for help on using the repository browser.