~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to ansi-tests/nth-value.lsp

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;-*- Mode:     Lisp -*-
 
2
;;;; Author:   Paul Dietz
 
3
;;;; Created:  Sat Oct 19 08:24:14 2002
 
4
;;;; Contains: Tests of NTH-VALUE
 
5
 
 
6
(in-package :cl-test)
 
7
 
 
8
(deftest nth-value.1
 
9
  (nth-value 0 'a)
 
10
  a)
 
11
 
 
12
(deftest nth-value.2
 
13
  (nth-value 1 'a)
 
14
  nil)
 
15
 
 
16
(deftest nth-value.3
 
17
  (nth-value 0 (values))
 
18
  nil)
 
19
 
 
20
(deftest nth-value.4
 
21
  (loop for i from 0 to 19
 
22
        collect (nth-value i (values 'a 'b 'c 'd 'e 'f 'g 'h 'i 'j 'k
 
23
                                     'l 'm 'n 'o 'p 'q 'r 's)))
 
24
  (a b c d e f g h i j k l m n o p q r s nil))
 
25
 
 
26
(deftest nth-value.5
 
27
  (nth-value 100 'a)
 
28
  nil)
 
29
 
 
30
(deftest nth-value.order.1
 
31
  (let ((i 0) x y)
 
32
    (values
 
33
     (nth-value (progn (setf x (incf i)) 3)
 
34
                (progn (setf y (incf i)) (values 'a 'b 'c 'd 'e 'f 'g)))
 
35
     i x y))
 
36
  d 2 1 2)
 
37
 
 
38
(deftest nth-value.error.1
 
39
  (signals-error (funcall (macro-function 'nth-value))
 
40
                 program-error)
 
41
  t)
 
42
  
 
43
(deftest nth-value.error.2
 
44
  (signals-error (funcall (macro-function 'nth-value)
 
45
                           '(nth-value 1 '(a b c)))
 
46
                 program-error)
 
47
  t)
 
48
 
 
49
(deftest nth-value.error.3
 
50
  (signals-error (funcall (macro-function 'nth-value)
 
51
                           '(nth-value 1 '(a b c))
 
52
                           nil nil)
 
53
                 program-error)
 
54
  t)