source: trunk/source/tests/ansi-tests/cons.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.0 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 19 21:24:25 2003
4;;;; Contains: Tests for CONS
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10;;; Various easy tests of cons
11
12(deftest cons-of-symbols
13  (cons 'a 'b)
14  (a . b))
15
16(deftest cons-with-nil
17  (cons 'a nil)
18  (a))
19
20;;; successive calls to cons produces results that are equal, but not eq
21(deftest cons-eq-equal
22  (let ((x (cons 'a 'b))
23        (y (cons 'a 'b)))
24    (and (not (eqt x y))
25         (equalt x y)))
26  t)
27
28;;; list can be expressed as a bunch of conses (with nil)
29(deftest cons-equal-list
30  (equalt (cons 'a (cons 'b (cons 'c nil)))
31          (list 'a 'b 'c))
32  t)
33
34;;; Order of evaluation of cons arguments
35(deftest cons.order.1
36  (let ((i 0)) (values (cons (incf i) (incf i)) i))
37  (1 . 2) 2)
38
39(def-fold-test cons.fold.1 (cons 'a 'b))
40
41;;; Error tests
42
43(deftest cons.error.1
44  (signals-error (cons) program-error)
45  t)
46
47(deftest cons.error.2
48  (signals-error (cons 'a) program-error)
49  t)
50
51(deftest cons.error.3
52  (signals-error (cons 'a 'b 'c) program-error)
53  t)
Note: See TracBrowser for help on using the repository browser.