source: trunk/source/tests/ansi-tests/get-properties.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 2.3 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Apr 20 07:37:00 2003
4;;;; Contains: Tests of GET-PROPERTIES
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10(deftest get-properties.1
11  (get-properties nil nil)
12  nil nil nil)
13
14(deftest get-properties.2
15  (get-properties '(a b) nil)
16  nil nil nil)
17
18(deftest get-properties.3
19  (get-properties '(a b c d) '(a))
20  a b (a b c d))
21
22(deftest get-properties.4
23  (get-properties '(a b c d) '(c))
24  c d (c d))
25
26(deftest get-properties.5
27  (get-properties '(a b c d) '(c a))
28  a b (a b c d))
29
30(deftest get-properties.6
31  (get-properties '(a b c d) '(b))
32  nil nil nil)
33
34(deftest get-properties.7
35  (get-properties '("aa" b c d) (list (copy-seq "aa")))
36  nil nil nil)
37
38;;; I removed the next test (noticed by Duane Rettig) because
39;;; the non-eqness of numbers may not be necesarily preserved.
40;;; The standard says numbers may be copied at any time, and
41;;; this might mean eql numbers are copied to a canonical eq
42;;; value
43#|
44(deftest get-properties.8
45  (get-properties '(1000000000000 b c d) (list (1+ 999999999999)))
46  nil nil nil)
47|#
48
49(deftest get-properties.9
50  (let* ((x (copy-list '(a b c d e f g h a c)))
51         (xcopy (make-scaffold-copy x))
52         (y (copy-list '(x y f g)))
53         (ycopy (make-scaffold-copy y)))
54    (multiple-value-bind
55        (indicator value tail)
56        (get-properties x y)
57      (and
58       (check-scaffold-copy x xcopy)
59       (check-scaffold-copy y ycopy)
60       (eqt tail (nthcdr 6 x))
61       (values indicator value tail))))
62  g h (g h a c))
63
64(deftest get-properties.order.1
65  (let ((i 0) x y)
66    (values
67     (multiple-value-list
68      (get-properties (progn (setf x (incf i)) '(a b c d))
69                      (progn (setf y (incf i)) '(c))))
70     i x y))
71  (c d (c d)) 2 1 2)
72
73(deftest get-properties.error.1
74  (signals-error (get-properties) program-error)
75  t)
76
77(deftest get-properties.error.2
78  (signals-error (get-properties nil) program-error)
79  t)
80
81(deftest get-properties.error.3
82  (signals-error (get-properties nil nil nil) program-error)
83  t)
84
85(deftest get-properties.error.4
86  (signals-error (get-properties '(a 1 b 2 c 3) '(x . y)) type-error)
87  t)
88
89(deftest get-properties.error.5
90  (signals-error (get-properties '(a 1 b 2 c 3 . d) '(x y)) type-error)
91  t)
92
93(deftest get-properties.error.6
94  (signals-error (get-properties '(a 1 b 2 c . d) '(x y)) type-error)
95  t)
Note: See TracBrowser for help on using the repository browser.