1 | ;-*- Mode: Lisp -*- |
---|
2 | ;;;; Author: Paul Dietz |
---|
3 | ;;;; Created: Thu Jun 10 19:31:01 2004 |
---|
4 | ;;;; Contains: Tests of printing of backquote forms (and fragments thereof) |
---|
5 | |
---|
6 | (in-package :cl-test) |
---|
7 | |
---|
8 | (compile-and-load "printer-aux.lsp") |
---|
9 | (compile-and-load "backquote-aux.lsp") |
---|
10 | |
---|
11 | (deftest print.backquote.random.1 |
---|
12 | (let* ((x '`(a ,b ,@c (d . ,e) ,.f #(1 2 ,p ,@q ,.r s) g)) |
---|
13 | (y (copy-tree x))) |
---|
14 | (or |
---|
15 | (loop |
---|
16 | repeat 20 |
---|
17 | nconc (randomly-check-readability y :test #'is-similar)) |
---|
18 | (and (not (equal x y)) (list :modified x y)))) |
---|
19 | nil) |
---|
20 | |
---|
21 | (deftest print.backquote.random.2 |
---|
22 | (let* ((x '`(,@a ,@b)) |
---|
23 | (y (copy-tree x))) |
---|
24 | (or |
---|
25 | (loop |
---|
26 | repeat 20 |
---|
27 | nconc (randomly-check-readability y :test #'is-similar)) |
---|
28 | (and (not (is-similar x y)) (list :modified x y)))) |
---|
29 | nil) |
---|
30 | |
---|
31 | (deftest print.backquote.random.3 |
---|
32 | (let* ((x '`(,.a ,.b)) |
---|
33 | (y (copy-tree x))) |
---|
34 | (or |
---|
35 | (loop |
---|
36 | repeat 20 |
---|
37 | nconc (randomly-check-readability y :test #'is-similar)) |
---|
38 | (and (not (is-similar x y)) (list :modified x y)))) |
---|
39 | nil) |
---|
40 | |
---|
41 | (deftest print.backquote.random.4 |
---|
42 | (let* ((x '`(,a ,b)) |
---|
43 | (y (copy-tree x))) |
---|
44 | (or |
---|
45 | (loop |
---|
46 | repeat 20 |
---|
47 | nconc (randomly-check-readability y :test #'is-similar)) |
---|
48 | (and (not (is-similar x y)) (list :modified x y)))) |
---|
49 | nil) |
---|
50 | |
---|
51 | (deftest print.backquote.random.5 |
---|
52 | (let* ((x '`#(,a ,b)) |
---|
53 | (y (copy-tree x))) |
---|
54 | (or |
---|
55 | (loop |
---|
56 | repeat 20 |
---|
57 | nconc (randomly-check-readability y :test #'is-similar)) |
---|
58 | (and (not (is-similar x y)) (list :modified x y)))) |
---|
59 | nil) |
---|
60 | |
---|
61 | (deftest print.backquote.random.6 |
---|
62 | (let ((x '`(,@a ,@b))) |
---|
63 | (and (consp x) |
---|
64 | (symbolp (car x)) |
---|
65 | (loop |
---|
66 | repeat 20 |
---|
67 | nconc (randomly-check-readability (list (car x)) :test #'is-similar)))) |
---|
68 | nil) |
---|
69 | |
---|
70 | (deftest print.backquote.random.7 |
---|
71 | (let ((x '`(,.a ,.b))) |
---|
72 | (and (consp x) |
---|
73 | (symbolp (car x)) |
---|
74 | (loop |
---|
75 | repeat 20 |
---|
76 | nconc (randomly-check-readability (list (car x)) :test #'is-similar)))) |
---|
77 | nil) |
---|
78 | |
---|
79 | (deftest print.backquote.random.8 |
---|
80 | (let ((x '`(,a ,b))) |
---|
81 | (and (consp x) |
---|
82 | (symbolp (car x)) |
---|
83 | (loop |
---|
84 | repeat 20 |
---|
85 | nconc (randomly-check-readability (list (car x)) :test #'is-similar)))) |
---|
86 | nil) |
---|
87 | |
---|
88 | (deftest print.backquote.random.9 |
---|
89 | (let ((x '`#(,a ,b))) |
---|
90 | (and (consp x) |
---|
91 | (symbolp (car x)) |
---|
92 | (loop |
---|
93 | repeat 20 |
---|
94 | nconc (randomly-check-readability (list (car x)) :test #'is-similar)))) |
---|
95 | nil) |
---|
96 | |
---|
97 | (deftest print.backquote.random.10 |
---|
98 | (let ((x '`#(,a , .b))) |
---|
99 | (loop |
---|
100 | repeat 20 |
---|
101 | nconc (randomly-check-readability x :test #'is-similar))) |
---|
102 | nil) |
---|
103 | |
---|
104 | (deftest print.backquote.random.11 |
---|
105 | (let ((x '`#(,a , @b))) |
---|
106 | (loop |
---|
107 | repeat 20 |
---|
108 | nconc (randomly-check-readability x :test #'is-similar))) |
---|
109 | nil) |
---|
110 | |
---|
111 | (deftest print.backquote.random.12 |
---|
112 | (let ((x '`#(,a ,b c))) |
---|
113 | (and (consp x) |
---|
114 | (symbolp (car x)) |
---|
115 | (loop |
---|
116 | repeat 20 |
---|
117 | nconc (randomly-check-readability (list (car x)) :test #'is-similar)))) |
---|
118 | nil) |
---|
119 | |
---|
120 | (deftest print.backquote.random.13 |
---|
121 | (let* ((x '`#(,a ,b c)) |
---|
122 | (y (copy-tree x))) |
---|
123 | (or |
---|
124 | (loop |
---|
125 | repeat 20 |
---|
126 | nconc (randomly-check-readability x :test #'is-similar)) |
---|
127 | (and (not (is-similar x y)) (list :modified x y)))) |
---|
128 | nil) |
---|
129 | |
---|
130 | (deftest print.backquote.random.14 |
---|
131 | (loop for x = (make-random-backquoted-form 100) |
---|
132 | repeat 500 |
---|
133 | nconc (randomly-check-readability x :test #'is-similar)) |
---|
134 | nil) |
---|