source: trunk/source/tests/ansi-tests/and.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.3 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Fri Oct 18 07:23:48 2002
4;;;; Contains: Tests for AND
5
6(in-package :cl-test)
7
8(deftest and.1
9  (and)
10  t)
11
12(deftest and.2
13  (and nil)
14  nil)
15
16(deftest and.3
17  (and 'a)
18  a)
19
20(deftest and.4
21  (and (values 'a 'b 'c))
22  a b c)
23
24(deftest and.5 (and (values)))
25
26(deftest and.6
27  (and (values t nil) 'a)
28  a)
29
30(deftest and.7
31  (and nil (values 'a 'b 'c))
32  nil)
33
34(deftest and.8
35  (and (values 1 nil) (values nil 2))
36  nil 2)
37
38(deftest and.9
39  (and (values nil t) t)
40  nil)
41
42;;; Test that explicit calls to macroexpand in subforms
43;;; are done in the correct environment
44
45(deftest and.10
46  (macrolet
47   ((%m (z) z))
48   (and (expand-in-current-env (%m :a))
49        (expand-in-current-env (%m :b))
50        (expand-in-current-env (%m :c))))
51  :c)
52
53;;; Error tests
54
55(deftest and.order.1
56  (let ((x 0))
57    (values (and nil (incf x))
58            x))
59  nil 0)
60
61(deftest and.order.2
62  (let ((i 0) a b c d)
63    (values
64     (and (setf a (incf i))
65          (setf b (incf i))
66          (setf c (incf i))
67          (setf d (incf i)))
68     i a b c d))
69  4 4 1 2 3 4)
70
71(deftest and.error.1
72  (signals-error (funcall (macro-function 'and))
73                 program-error)
74  t)
75
76(deftest and.error.2
77  (signals-error (funcall (macro-function 'and) '(and))
78                 program-error)
79  t)
80
81(deftest and.error.3
82  (signals-error (funcall (macro-function 'and) '(and) nil nil)
83                 program-error)
84  t)
Note: See TracBrowser for help on using the repository browser.