source: trunk/source/tests/ansi-tests/copy-alist.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:  Sun Apr 20 07:29:07 2003
4;;;; Contains: Tests of COPY-ALIST
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10(deftest copy-alist.1
11    (let* ((x (copy-tree '((a . b) (c . d) nil (e f) ((x) ((y z)) w)
12                           ("foo" . "bar") (#\w . 1.234)
13                           (1/3 . 4123.4d5))))
14           (xcopy (make-scaffold-copy x))
15           (result (copy-alist x)))
16      (and
17       (check-scaffold-copy x xcopy)
18       (= (length x) (length result))
19       (every #'(lambda (p1 p2)
20                  (or (and (null p1) (null p2))
21                      (and (not (eqt p1 p2))
22                           (eqlt (car p1) (car p2))
23                           (eqlt (cdr p1) (cdr p2)))))
24              x result)
25       t))
26  t)
27
28(def-fold-test copy-alist.2 (copy-alist '((a . b) nil (c . d))))
29(def-fold-test copy-alist.3 (car (copy-alist '((a . b) nil (c . d)))))
30(def-fold-test copy-alist.4 (caddr (copy-alist '((a . b) nil (c . d)))))
31
32;;; Error tests
33
34(deftest copy-alist.error.1
35  (signals-error (copy-alist) program-error)
36  t)
37
38(deftest copy-alist.error.2
39  (signals-error (copy-alist nil nil) program-error)
40  t)
41
42(deftest copy-alist.error.3
43  (signals-error (copy-alist '((a . b) . c)) type-error)
44  t)
Note: See TracBrowser for help on using the repository browser.