104 |
|
|
105 |
(deftest format.d.4 |
(deftest format.d.4 |
106 |
(with-standard-io-syntax |
(with-standard-io-syntax |
107 |
(loop for x = (ash 1 (+ 2 (random 80))) |
(loop with limit = 10 |
108 |
|
with count = 0 |
109 |
|
for x = (ash 1 (+ 2 (random 80))) |
110 |
for mincol = (random 30) |
for mincol = (random 30) |
111 |
for i = (- (random (+ x x)) x) |
for i = (- (random (+ x x)) x) |
112 |
for s1 = (format nil "~@D" i) |
for s1 = (format nil "~@D" i) |
113 |
for s2 = (format nil (format nil "~~~d@d" mincol) i) |
for format-string = (format nil "~~~d@d" mincol) |
114 |
|
for s2 = (format nil format-string i) |
115 |
for pos = (search s1 s2) |
for pos = (search s1 s2) |
116 |
repeat 1000 |
repeat 1000 |
117 |
when (or (null pos) |
when (or (null pos) |
120 |
(or (/= (length s2) mincol) |
(or (/= (length s2) mincol) |
121 |
(not (eql (position #\Space s2 :test-not #'eql) |
(not (eql (position #\Space s2 :test-not #'eql) |
122 |
(- (length s2) (length s1))))))) |
(- (length s2) (length s1))))))) |
123 |
collect (list i mincol s1 s2 pos))) |
collect (if (> (incf count) limit) |
124 |
|
"Count limit exceeded" |
125 |
|
(list i mincol s1 format-string s2 pos)) |
126 |
|
while (<= count limit))) |
127 |
nil) |
nil) |
128 |
|
|
129 |
(deftest formatter.d.4 |
(deftest formatter.d.4 |
130 |
(with-standard-io-syntax |
(with-standard-io-syntax |
131 |
(loop for x = (ash 1 (+ 2 (random 80))) |
(loop with limit = 10 |
132 |
|
with count = 0 |
133 |
|
for x = (ash 1 (+ 2 (random 80))) |
134 |
for mincol = (random 30) |
for mincol = (random 30) |
135 |
for i = (- (random (+ x x)) x) |
for i = (- (random (+ x x)) x) |
136 |
for s1 = (format nil "~@D" i) |
for s1 = (format nil "~@D" i) |
145 |
(or (/= (length s2) mincol) |
(or (/= (length s2) mincol) |
146 |
(not (eql (position #\Space s2 :test-not #'eql) |
(not (eql (position #\Space s2 :test-not #'eql) |
147 |
(- (length s2) (length s1))))))) |
(- (length s2) (length s1))))))) |
148 |
collect (list i mincol s1 s2 pos))) |
collect (if (> (incf count) limit) |
149 |
|
"Count limit exceeded" |
150 |
|
(list i mincol s1 s2 pos)) |
151 |
|
while (<= count limit))) |
152 |
nil) |
nil) |
153 |
|
|
154 |
(deftest format.d.5 |
(deftest format.d.5 |
213 |
(deftest format.d.7 |
(deftest format.d.7 |
214 |
(let ((fn (formatter "~v,v@D"))) |
(let ((fn (formatter "~v,v@D"))) |
215 |
(with-standard-io-syntax |
(with-standard-io-syntax |
216 |
(loop for x = (ash 1 (+ 2 (random 80))) |
(loop with limit = 10 |
217 |
|
with count = 0 |
218 |
|
for x = (ash 1 (+ 2 (random 80))) |
219 |
for mincol = (random 30) |
for mincol = (random 30) |
220 |
for padchar = (random-from-seq +standard-chars+) |
for padchar = (random-from-seq +standard-chars+) |
221 |
for i = (- (random (+ x x)) x) |
for i = (- (random (+ x x)) x) |
231 |
(or (/= (length s2) mincol) |
(or (/= (length s2) mincol) |
232 |
(find padchar s2 :end (- (length s2) (length s1)) |
(find padchar s2 :end (- (length s2) (length s1)) |
233 |
:test-not #'eql)))) |
:test-not #'eql)))) |
234 |
collect (list i mincol s1 s2 pos)))) |
collect (if (> (incf count) limit) |
235 |
|
"Count limit exceeded" |
236 |
|
(list i mincol s1 s2 s3 pos)) |
237 |
|
while (<= count limit)))) |
238 |
nil) |
nil) |
239 |
|
|
240 |
;;; Comma tests |
;;; Comma tests |