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

« back to all changes in this revision

Viewing changes to ansi-tests/cons.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 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
;;; Error tests
 
40
 
 
41
(deftest cons.error.1
 
42
  (signals-error (cons) program-error)
 
43
  t)
 
44
 
 
45
(deftest cons.error.2
 
46
  (signals-error (cons 'a) program-error)
 
47
  t)
 
48
 
 
49
(deftest cons.error.3
 
50
  (signals-error (cons 'a 'b 'c) program-error)
 
51
  t)