source: trunk/source/tests/ansi-tests/consp.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.2 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 19 21:27:16 2003
4;;;; Contains: Tests of CONSP
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10;; Lists satisfy consp
11(deftest consp-list
12  (notnot-mv (consp '(a)))
13  t)
14
15;; cons satisfies consp
16(deftest consp-cons
17  (notnot-mv (consp (cons nil nil)))
18  t)
19
20;; nil is not a consp
21(deftest consp-nil
22  (consp nil)
23  nil)
24
25;; The empty list is not a cons
26(deftest consp-empty-list
27  (consp (list))
28  nil)
29
30;; A single element list is a cons
31(deftest consp-single-element-list
32  (notnot-mv (consp (list 'a)))
33  t)
34
35;; For everything in *universe*, it is either an atom, or satisfies
36;; consp, but not both
37(deftest consp-xor-atom-universe
38  (check-predicate #'(lambda (x) (or (and (consp x) (not (atom x)))
39                                     (and (not (consp x)) (atom x)))))
40  nil)
41
42;; Everything in type cons satisfies consp, and vice versa
43(deftest consp-cons-universe
44  (check-type-predicate 'consp 'cons)
45  nil)
46
47(deftest consp.order.1
48  (let ((i 0))
49    (values (consp (incf i)) i))
50  nil 1)
51
52;;; Error tests
53
54(deftest consp.error.1
55  (signals-error (consp) program-error)
56  t)
57
58(deftest consp.error.2
59  (signals-error (consp 'a 'b) program-error)
60  t)
Note: See TracBrowser for help on using the repository browser.