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

« back to all changes in this revision

Viewing changes to ansi-tests/push.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 22:05:34 2003
 
4
;;;; Contains: Tests of PUSH
 
5
 
 
6
(in-package :cl-test)
 
7
 
 
8
(compile-and-load "cons-aux.lsp")
 
9
 
 
10
;;; See also places.lsp
 
11
 
 
12
(deftest push.1
 
13
  (let ((x nil))
 
14
    (push 'a x))
 
15
  (a))
 
16
 
 
17
(deftest push.2
 
18
  (let ((x 'b))
 
19
    (push 'a x)
 
20
    (push 'c x))
 
21
  (c a . b))
 
22
 
 
23
(deftest push.3
 
24
  (let ((x (copy-tree '(a))))
 
25
    (push x x)
 
26
    (and
 
27
     (eqt (car x) (cdr x))
 
28
     x))
 
29
  ((a) a))
 
30
 
 
31
(deftest push.order.1
 
32
  (let ((x (list nil)) (i 0) a b)
 
33
    (values
 
34
     (push (progn (setf a (incf i)) 'z)
 
35
           (car (progn (setf b (incf i)) x)))
 
36
     x
 
37
     i a b))
 
38
  (z) ((z)) 2 1 2)
 
39
 
 
40
(deftest push.order.2
 
41
  (let ((x (vector nil nil nil nil))
 
42
        (y (vector 'a 'b 'c 'd))
 
43
        (i 1))
 
44
    (push (aref y (incf i)) (aref x (incf i)))
 
45
    (values x y i))
 
46
  #(nil nil nil (c))
 
47
  #(a b c d)
 
48
  3)
 
49
 
 
50
(def-macro-test push.error.1 (push x y))
 
51
 
 
52
;;; Need to add push vs. various accessors