source: trunk/source/tests/ansi-tests/revappend.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.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 19 22:37:43 2003
4;;;; Contains: Tests of REVAPPEND
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10(deftest revappend.1
11    (let* ((x (list 'a 'b 'c))
12           (y (list 'd 'e 'f))
13           (xcopy (make-scaffold-copy x))
14           (ycopy (make-scaffold-copy y))
15           )
16      (let ((result (revappend x y)))
17        (and
18         (check-scaffold-copy x xcopy)
19         (check-scaffold-copy y ycopy)
20         (eqt (cdddr result) y)
21         result)))
22  (c b a d e f))
23
24(deftest revappend.2
25    (revappend (copy-tree '(a b c d e)) 10)
26  (e d c b a . 10))
27
28(deftest revappend.3
29    (revappend nil 'a)
30  a)
31
32(deftest revappend.4
33    (revappend (copy-tree '(a (b c) d)) nil)
34  (d (b c) a))
35
36(deftest revappend.order.1
37  (let ((i 0) x y)
38    (values
39     (revappend (progn (setf x (incf i)) (copy-list '(a b c)))
40                (progn (setf y (incf i)) (copy-list '(d e f))))
41     i x y))
42  (c b a d e f) 2 1 2)
43
44(def-fold-test revappend.fold.1 (revappend '(x) nil))
45(def-fold-test revappend.fold.2 (revappend '(x y z) nil))
46
47;;; Error tests
48
49(deftest revappend.error.1
50  (signals-error (revappend) program-error)
51  t)
52
53(deftest revappend.error.2
54  (signals-error (revappend nil) program-error)
55  t)
56
57(deftest revappend.error.3
58  (signals-error (revappend nil nil nil) program-error)
59  t)
60
61(deftest revappend.error.4
62  (signals-error (revappend '(a . b) '(z)) type-error)
63  t)
Note: See TracBrowser for help on using the repository browser.