source: trunk/source/tests/ansi-tests/copy-tree.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.1 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 19 21:31:33 2003
4;;;; Contains: Tests of COPY-TREE
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10;; Try copy-tree on a tree containing elements of various kinds
11(deftest copy-tree.1
12  (let* ((x (cons 'a (list
13                     (cons 'b 'c)
14                     (cons 1 1.2)
15                     (list (list "abcde"
16                                 (make-array '(10) :initial-element
17                                             (cons 'e 'f)))
18                                'g))))
19         (y (copy-tree x)))
20    (check-cons-copy x y))
21  t)
22
23;; Try copy-tree on *universe*
24(deftest copy-tree.2
25  (let* ((x (copy-list *universe*))
26         (y (copy-tree x)))
27    (check-cons-copy x y))
28  t)
29
30(deftest copy-tree.order.1
31  (let ((i 0))
32    (values
33     (copy-tree (progn (incf i) '(a b c)))
34     i))
35  (a b c) 1)
36
37(def-fold-test copy-tree.fold.1 (copy-tree '(a . b)))
38(def-fold-test copy-tree.fold.2 (copy-tree '(a)))
39(def-fold-test copy-tree.fold.3 (copy-tree '(a b c d e)))
40
41;;; Error tests
42
43(deftest copy-tree.error.1
44  (signals-error (copy-tree) program-error)
45  t)
46
47(deftest copy-tree.error.2
48  (signals-error (copy-tree 'a 'b) program-error)
49  t)
Note: See TracBrowser for help on using the repository browser.