15 |
(format nil "~A" nil))) |
(format nil "~A" nil))) |
16 |
"nil") |
"nil") |
17 |
|
|
18 |
|
(deftest formatter.a.2 |
19 |
|
(with-standard-io-syntax |
20 |
|
(let ((*print-case* :downcase)) |
21 |
|
(formatter-call-to-string (formatter "~A") nil))) |
22 |
|
"nil") |
23 |
|
|
24 |
(deftest format.a.3 |
(deftest format.a.3 |
25 |
(with-standard-io-syntax |
(with-standard-io-syntax |
26 |
(let ((*print-case* :capitalize)) |
(let ((*print-case* :capitalize)) |
27 |
(format nil "~a" nil))) |
(format nil "~a" nil))) |
28 |
"Nil") |
"Nil") |
29 |
|
|
30 |
|
(deftest formatter.a.3 |
31 |
|
(with-standard-io-syntax |
32 |
|
(let ((*print-case* :capitalize)) |
33 |
|
(formatter-call-to-string (formatter "~a") nil))) |
34 |
|
"Nil") |
35 |
|
|
36 |
(def-format-test format.a.4 |
(def-format-test format.a.4 |
37 |
"~:a" (nil) "()") |
"~:a" (nil) "()") |
38 |
|
|
43 |
"~:A" (#(nil)) "#(NIL)") |
"~:A" (#(nil)) "#(NIL)") |
44 |
|
|
45 |
(deftest format.a.7 |
(deftest format.a.7 |
46 |
(loop for c across +standard-chars+ |
(let ((fn (formatter "~a"))) |
47 |
for s1 = (string c) |
(loop for c across +standard-chars+ |
48 |
for s2 = (format nil "~a" s1) |
for s1 = (string c) |
49 |
unless (string= s1 s2) |
for s2 = (format nil "~a" s1) |
50 |
collect (list c s1 s2)) |
for s3 = (formatter-call-to-string fn s1) |
51 |
|
unless (and (string= s1 s2) (string= s2 s3)) |
52 |
|
collect (list c s1 s2 s3))) |
53 |
nil) |
nil) |
54 |
|
|
55 |
(deftest format.a.8 |
(deftest format.a.8 |
56 |
(loop with count = 0 |
(let ((fn (formatter "~A"))) |
57 |
for i from 0 below (min #x10000 char-code-limit) |
(loop with count = 0 |
58 |
for c = (code-char i) |
for i from 0 below (min #x10000 char-code-limit) |
59 |
for s1 = (and c (string c)) |
for c = (code-char i) |
60 |
for s2 = (and c (format nil "~A" s1)) |
for s1 = (and c (string c)) |
61 |
unless (or (null c) (string= s1 s2)) |
for s2 = (and c (format nil "~A" s1)) |
62 |
do (incf count) and collect (list c s1 s2) |
for s3 = (and c (formatter-call-to-string fn s1)) |
63 |
when (> count 100) collect "count limit exceeded" and do (loop-finish)) |
unless (or (null c) (string= s1 s2) (string= s2 s3)) |
64 |
|
do (incf count) and collect (list c s1 s2 s3) |
65 |
|
when (> count 100) collect "count limit exceeded" and do (loop-finish))) |
66 |
nil) |
nil) |
67 |
|
|
68 |
(deftest format.a.9 |
(deftest format.a.9 |
70 |
(apply |
(apply |
71 |
#'values |
#'values |
72 |
(loop for i from 1 to 10 |
(loop for i from 1 to 10 |
73 |
for s1 = (format nil "~~~d@a" i) |
for fmt = (format nil "~~~d@a" i) |
74 |
for s2 = (format nil s1 nil) |
for s = (format nil fmt nil) |
75 |
collect s2))) |
for fn = (eval `(formatter ,fmt)) |
76 |
|
for s2 = (formatter-call-to-string fn nil) |
77 |
|
do (assert (string= s s2)) |
78 |
|
collect s))) |
79 |
"NIL" |
"NIL" |
80 |
"NIL" |
"NIL" |
81 |
"NIL" |
"NIL" |
92 |
(apply |
(apply |
93 |
#'values |
#'values |
94 |
(loop for i from 1 to 10 |
(loop for i from 1 to 10 |
95 |
for s1 = (format nil "~~~da" i) |
for fmt = (format nil "~~~da" i) |
96 |
for s2 = (format nil s1 nil) |
for s = (format nil fmt nil) |
97 |
collect s2))) |
for fn = (eval `(formatter ,fmt)) |
98 |
|
for s2 = (formatter-call-to-string fn nil) |
99 |
|
do (assert (string= s s2)) |
100 |
|
collect s))) |
101 |
"NIL" |
"NIL" |
102 |
"NIL" |
"NIL" |
103 |
"NIL" |
"NIL" |
114 |
(apply |
(apply |
115 |
#'values |
#'values |
116 |
(loop for i from 1 to 10 |
(loop for i from 1 to 10 |
117 |
for s1 = (format nil "~~~d@:A" i) |
for fmt = (format nil "~~~d@:A" i) |
118 |
for s2 = (format nil s1 nil) |
for s = (format nil fmt nil) |
119 |
collect s2))) |
for fn = (eval `(formatter ,fmt)) |
120 |
|
for s2 = (formatter-call-to-string fn nil) |
121 |
|
do (assert (string= s s2)) |
122 |
|
collect s))) |
123 |
"()" |
"()" |
124 |
"()" |
"()" |
125 |
" ()" |
" ()" |
136 |
(apply |
(apply |
137 |
#'values |
#'values |
138 |
(loop for i from 1 to 10 |
(loop for i from 1 to 10 |
139 |
for s1 = (format nil "~~~d:a" i) |
for fmt = (format nil "~~~d:a" i) |
140 |
for s2 = (format nil s1 nil) |
for s = (format nil fmt nil) |
141 |
collect s2))) |
for fn = (eval `(formatter ,fmt)) |
142 |
|
for s2 = (formatter-call-to-string fn nil) |
143 |
|
do (assert (string= s s2)) |
144 |
|
collect s))) |
145 |
"()" |
"()" |
146 |
"()" |
"()" |
147 |
"() " |
"() " |
157 |
(with-standard-io-syntax |
(with-standard-io-syntax |
158 |
(apply |
(apply |
159 |
#'values |
#'values |
160 |
(loop for i from 1 to 10 |
(let ((fn (formatter "~V:a"))) |
161 |
for s2 = (format nil "~v:A" i nil) |
(loop for i from 1 to 10 |
162 |
collect s2))) |
for s = (format nil "~v:A" i nil) |
163 |
|
for s2 = (formatter-call-to-string fn i nil) |
164 |
|
do (assert (string= s s2)) |
165 |
|
collect s)))) |
166 |
"()" |
"()" |
167 |
"()" |
"()" |
168 |
"() " |
"() " |
178 |
(with-standard-io-syntax |
(with-standard-io-syntax |
179 |
(apply |
(apply |
180 |
#'values |
#'values |
181 |
(loop for i from 1 to 10 |
(let ((fn (formatter "~V@:A"))) |
182 |
for s2 = (format nil "~v:@a" i nil) |
(loop for i from 1 to 10 |
183 |
collect s2))) |
for s = (format nil "~v:@a" i nil) |
184 |
|
for s2 = (formatter-call-to-string fn i nil) |
185 |
|
do (assert (string= s s2)) |
186 |
|
collect s)))) |
187 |
"()" |
"()" |
188 |
"()" |
"()" |
189 |
" ()" |
" ()" |
242 |
;;; With minpad |
;;; With minpad |
243 |
|
|
244 |
(deftest format.a.29 |
(deftest format.a.29 |
245 |
(loop for i from -4 to 10 |
(let ((fn (formatter "~v,,2A"))) |
246 |
collect (format nil "~v,,2A" i "ABC")) |
(loop for i from -4 to 10 |
247 |
|
for s = (format nil "~v,,2A" i "ABC") |
248 |
|
for s2 = (formatter-call-to-string fn i "ABC") |
249 |
|
do (assert (string= s s2)) |
250 |
|
collect s)) |
251 |
("ABC " |
("ABC " |
252 |
"ABC " |
"ABC " |
253 |
"ABC " |
"ABC " |
311 |
"~3,,vA" (nil "ABC") "ABC") |
"~3,,vA" (nil "ABC") "ABC") |
312 |
|
|
313 |
(deftest format.a.44 |
(deftest format.a.44 |
314 |
(loop for i from 0 to 6 |
(let ((fn (formatter "~3,,vA"))) |
315 |
collect (format nil "~3,,vA" i "ABC")) |
(loop for i from 0 to 6 |
316 |
|
for s =(format nil "~3,,vA" i "ABC") |
317 |
|
for s2 = (formatter-call-to-string fn i "ABC") |
318 |
|
do (assert (string= s s2)) |
319 |
|
collect s)) |
320 |
("ABC" |
("ABC" |
321 |
"ABC " |
"ABC " |
322 |
"ABC " |
"ABC " |
326 |
"ABC ")) |
"ABC ")) |
327 |
|
|
328 |
(deftest format.a.44a |
(deftest format.a.44a |
329 |
(loop for i from 0 to 6 |
(let ((fn (formatter "~3,,v@A"))) |
330 |
collect (format nil "~3,,v@A" i "ABC")) |
(loop for i from 0 to 6 |
331 |
|
for s = (format nil "~3,,v@A" i "ABC") |
332 |
|
for s2 = (formatter-call-to-string fn i "ABC") |
333 |
|
do (assert (string= s s2)) |
334 |
|
collect s)) |
335 |
("ABC" |
("ABC" |
336 |
" ABC" |
" ABC" |
337 |
" ABC" |
" ABC" |