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

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

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

File size: 1.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Mon Jan 13 15:13:07 2003
4;;;; Contains: Tests of APPLY
5
6(in-package :cl-test)
7
8;;; Error cases
9
10(deftest apply.error.1
11  (signals-error (apply) program-error)
12  t)
13
14(deftest apply.error.2
15  (signals-error (apply #'cons) program-error)
16  t)
17
18(deftest apply.error.3
19  (signals-error (apply #'cons nil) program-error)
20  t)
21
22(deftest apply.error.4
23  (signals-error (apply #'cons (list 1 2 3))
24                 program-error)
25  t)
26
27;;; Non-error cases
28
29(deftest apply.1
30  (apply #'cons 'a 'b nil)
31  (a . b))
32
33(deftest apply.2
34  (apply #'cons 'a '(b))
35  (a . b))
36
37(deftest apply.3
38  (apply #'cons '(a b))
39  (a . b))
40
41(deftest apply.4
42  (let ((zeros (make-list (min 10000 (1- call-arguments-limit))
43                          :initial-element 1)))
44    (apply #'+ zeros))
45  #.(min 10000 (1- call-arguments-limit)))
46
47(deftest apply.5
48  (apply 'cons '(a b))
49  (a . b))
50
51(deftest apply.6
52  (macrolet ((%m (z) z))
53            (apply (expand-in-current-env (%m 'cons)) 1 2 nil))
54  (1 . 2))
55
56(deftest apply.7
57  (macrolet ((%m (z) z))
58            (apply #'cons (expand-in-current-env (%m 1)) '(2)))
59  (1 . 2))
60
61(deftest apply.8
62  (macrolet ((%m (z) z))
63            (apply #'cons (expand-in-current-env (%m '(1 2)))))
64  (1 . 2))
65
66(deftest apply.order.1
67  (let ((i 0) x y z)
68    (values
69     (apply (progn (setf x (incf i))
70                   #'list)
71            (progn (setf y (incf i))
72                   'b)
73            (progn (setf z (incf i))
74                   (list 'a)))
75     i x y z))
76  (b a) 3 1 2 3)
77
Note: See TracBrowser for help on using the repository browser.