1 ;;;; tests related to sequences
3 ;;;; This file is impure because we want to be able to use DEFUN.
5 ;;;; This software is part of the SBCL system. See the README file for
8 ;;;; While most of SBCL is derived from the CMU CL system, the test
9 ;;;; files (like this one) were written from scratch after the fork
12 ;;;; This software is in the public domain and is provided with
13 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
14 ;;;; more information.
16 (load "assertoid.lisp")
19 (:use
:cl
:assertoid
))
21 (in-package :seq-test
)
23 ;;; helper functions for exercising SEQUENCE code on data of many
24 ;;; specialized types, and in many different optimization scenarios
25 (defun for-every-seq-1 (base-seq snippet
)
26 (dolist (seq-type '(list
29 (simple-array character
1)
31 (simple-array (signed-byte 4) 1)
32 (vector (signed-byte 4))))
33 (flet ((entirely (eltype)
34 (every (lambda (el) (typep el eltype
)) base-seq
)))
35 (dolist (declaredness '(nil t
))
36 (dolist (optimization '(((speed 3) (space 0))
39 ((speed 0) (space 1))))
40 (let* ((seq (if (eq seq-type
'list
)
41 (coerce base-seq
'list
)
42 (destructuring-bind (type-first &rest type-rest
)
46 (destructuring-bind (eltype one
) type-rest
49 (coerce base-seq seq-type
)
52 (destructuring-bind (eltype) type-rest
54 (let ((initial-element
55 (cond ((subtypep eltype
'character
)
57 ((subtypep eltype
'number
)
70 (lambda-expr `(lambda (seq)
72 `((declare (type ,seq-type seq
))))
73 (declare (optimize ,@optimization
))
75 (format t
"~&~S~%" lambda-expr
)
76 (multiple-value-bind (fun warnings-p failure-p
)
77 (compile nil lambda-expr
)
78 (when (or warnings-p failure-p
)
79 (error "~@<failed compilation:~2I ~_LAMBDA-EXPR=~S ~_WARNINGS-P=~S ~_FAILURE-P=~S~:@>"
80 lambda-expr warnings-p failure-p
))
81 (format t
"~&~S ~S~%~S~%~S ~S~%"
82 base-seq snippet seq-type declaredness optimization
)
83 (format t
"~&(TYPEP SEQ 'SIMPLE-ARRAY)=~S~%"
84 (typep seq
'simple-array
))
85 (unless (funcall fun seq
)
86 (error "~@<failed test:~2I ~_BASE-SEQ=~S ~_SNIPPET=~S ~_SEQ-TYPE=~S ~_DECLAREDNESS=~S ~_OPTIMIZATION=~S~:@>"
92 (defun for-every-seq (base-seq snippets
)
93 (dolist (snippet snippets
)
94 (for-every-seq-1 base-seq snippet
)))
96 ;;; a wrapper to hide declared type information from the compiler, so
97 ;;; we don't get stopped by compiler warnings about e.g. compiling
98 ;;; (POSITION 1 #() :KEY #'ABS) when #() has been coerced to a string.
99 (defun indiscriminate (fun)
100 (lambda (&rest rest
) (apply fun rest
)))
102 ;;; asymmetric test arg order example from ANSI FIND definition page
103 (assert (eql #\space
; original example, depends on ASCII character ordering
104 (find #\d
"here are some letters that can be looked at"
106 (assert (eql #\e
; modified example, depends only on standard a-z ordering
107 (find #\f "herearesomeletters" :test
#'char
>)))
108 (assert (eql 4 ; modified more, avoids charset technicalities completely
109 (find 5 '(6 4) :test
'>)))
111 ;;; tests of FIND, POSITION, FIND-IF, and POSITION-IF (and a few for
112 ;;; deprecated FIND-IF-NOT and POSITION-IF-NOT too)
114 '((null (find 1 seq
))
115 (null (find 1 seq
:from-end t
))
116 (null (position 1 seq
:key
(indiscriminate #'abs
)))
117 (null (position nil seq
:test
(constantly t
)))
118 (null (position nil seq
:test nil
))
119 (null (position nil seq
:test-not nil
))
120 (null (find-if #'1+ seq
:key
(indiscriminate #'log
)))
121 (null (position-if #'identity seq
:from-end t
))
122 (null (find-if-not #'packagep seq
))
123 (null (position-if-not #'packagep seq
:key nil
))))
125 '((null (find 2 seq
))
126 ;; Get the argument ordering for asymmetric tests like #'> right.
127 ;; (bug reported and fixed by Alexey Dejneka sbcl-devel 2001-10-17)
128 (eql 1 (find 2 seq
:test
#'>))
129 (find 2 seq
:key
#'1+)
130 (find 1 seq
:from-end t
)
131 (null (find 1 seq
:from-end t
:start
1))
132 (null (find 0 seq
:from-end t
))
133 (eql 0 (position 1 seq
:key
#'abs
))
134 (null (position nil seq
:test
'equal
))
135 (eql 1 (find-if #'1- seq
:key
#'log
))
136 (eql 0 (position-if #'identity seq
:from-end t
))
137 (null (find-if-not #'sin seq
))
138 (eql 0 (position-if-not #'packagep seq
:key
'identity
))))
139 (for-every-seq #(1 2 3 2 1)
141 (find 3 seq
:from-end
'yes
)
142 (eql 1 (position 1.5 seq
:test
#'<))
143 (eql 0 (position 0 seq
:key
'1-
))
144 (eql 4 (position 0 seq
:key
'1-
:from-end t
))
145 (eql 2 (position 4 seq
:key
'1+))
146 (eql 2 (position 4 seq
:key
'1+ :from-end t
))
147 (eql 1 (position 2 seq
))
148 (eql 1 (position 2 seq
:start
1))
149 (null (find 2 seq
:start
1 :end
1))
150 (eql 3 (position 2 seq
:start
2))
151 (eql 3 (position 2 seq
:key nil
:from-end t
))
152 (eql 2 (position 3 seq
:test
'=))
153 (eql 0 (position 3 seq
:test-not
'equalp
))
154 (eql 2 (position 3 seq
:test
'equal
:from-end t
))
155 (null (position 4 seq
:test
#'eql
))
156 (null (find-if #'packagep seq
))
157 (eql 1 (find-if #'plusp seq
))
158 (eql 3 (position-if #'plusp seq
:key
#'1-
:from-end t
))
159 (eql 1 (position-if #'evenp seq
))
160 (eql 3 (position-if #'evenp seq
:from-end t
))
161 (eql 2 (position-if #'plusp seq
:from-end nil
:key
'1-
:start
2))
162 (eql 3 (position-if #'plusp seq
:from-end t
:key
'1-
:start
2))
163 (null (position-if #'plusp seq
:from-end t
:key
'1-
:start
2 :end
2))
164 (null (find-if-not #'plusp seq
))
165 (eql 0 (position-if-not #'evenp seq
))))
166 (for-every-seq "string test"
167 '((null (find 0 seq
))
168 (null (find #\D seq
:key
#'char-upcase
))
169 (find #\E seq
:key
#'char-upcase
)
170 (null (find #\e seq
:key
#'char-upcase
))
171 (eql 3 (position #\i seq
))
172 (eql 0 (position #\s seq
:key
#'char-downcase
))
173 (eql 1 (position #\s seq
:key
#'char-downcase
:test
#'char
/=))
174 (eql 9 (position #\s seq
:from-end t
:test
#'char
=))
175 (eql 10 (position #\s seq
:from-end t
:test
#'char
/=))
176 (eql 4 (position #\N seq
:from-end t
:key
'char-upcase
:test
#'char-equal
))
177 (eql 5 (position-if (lambda (c) (equal #\g c
)) seq
))
178 (eql 5 (position-if (lambda (c) (equal #\g c
)) seq
:from-end t
))
179 (find-if #'characterp seq
)
180 (find-if (lambda (c) (typep c
'base-char
)) seq
:from-end t
)
181 (null (find-if 'upper-case-p seq
))))
184 (let ((avec (make-array 10
186 :initial-contents
'(0 1 2 3 iv v vi vii iix ix
))))
187 ;; These first five always worked AFAIK.
188 (assert (equalp (subseq avec
0 3) #(0 1 2)))
189 (assert (equalp (subseq avec
3 3) #()))
190 (assert (equalp (subseq avec
1 3) #(1 2)))
191 (assert (equalp (subseq avec
1) #(1 2 3)))
192 (assert (equalp (subseq avec
1 4) #(1 2 3)))
193 ;; SBCL bug found ca. 2002-05-01 by OpenMCL's correct handling of
194 ;; SUBSEQ, CSR's driving portable cross-compilation far enough to
195 ;; reach the SUBSEQ calls in assem.lisp, and WHN's sleazy
196 ;; translation of old CMU CL new-assem.lisp into sufficiently grotty
197 ;; portable Lisp that it passed suitable illegal values to SUBSEQ to
198 ;; exercise the bug:-|
200 ;; SUBSEQ should check its END value against logical LENGTH, not
201 ;; physical ARRAY-DIMENSION 0.
203 ;; fixed in sbcl-0.7.4.22 by WHN
204 (assert (null (ignore-errors (aref (subseq avec
1 5) 0)))))
207 (defun test-fill-typecheck (x)
208 (declare (optimize (safety 3) (space 2) (speed 1)))
209 (fill (make-string 10) x
))
211 (assert (string= (test-fill-typecheck #\
@) "@@@@@@@@@@"))
212 ;;; BUG 186, fixed in sbcl-0.7.5.5
213 (assert (null (ignore-errors (test-fill-typecheck 4097))))
215 ;;; MAKE-SEQUENCE, COERCE, CONCATENATE, MERGE, MAP and requested
216 ;;; result type (BUGs 46a, 46b, 66)
217 (macrolet ((assert-type-error (form)
218 `(assert (typep (nth-value 1 (ignore-errors ,form
))
220 (dolist (type-stub '((simple-vector)
222 (vector (signed-byte 8))
223 (vector (unsigned-byte 16))
224 (vector (signed-byte 32))
225 (simple-bit-vector)))
226 (declare (optimize safety
))
227 (format t
"~&~S~%" type-stub
)
229 (assert (= (length (make-sequence `(,@type-stub
) 10)) 10))
230 (assert (= (length (make-sequence `(,@type-stub
10) 10)) 10))
231 (assert-type-error (make-sequence `(,@type-stub
10) 11))
233 (assert (= (length (coerce '(0 0 0) `(,@type-stub
))) 3))
234 (assert (= (length (coerce #(0 0 0) `(,@type-stub
3))) 3))
235 (assert-type-error (coerce #*111 `(,@type-stub
4)))
237 (assert (= (length (concatenate `(,@type-stub
) #(0 0 0) #*111)) 6))
238 (assert (equalp (concatenate `(,@type-stub
) #(0 0 0) #*111)
239 (coerce #(0 0 0 1 1 1) `(,@type-stub
))))
240 (assert (= (length (concatenate `(,@type-stub
6) #(0 0 0) #*111)) 6))
241 (assert (equalp (concatenate `(,@type-stub
6) #(0 0 0) #*111)
242 (coerce #(0 0 0 1 1 1) `(,@type-stub
6))))
243 (assert-type-error (concatenate `(,@type-stub
5) #(0 0 0) #*111))
245 (macrolet ((test (type)
246 `(merge ,type
(copy-seq #(0 1 0)) (copy-seq #*111) #'>)))
247 (assert (= (length (test `(,@type-stub
))) 6))
248 (assert (equalp (test `(,@type-stub
))
249 (coerce #(1 1 1 0 1 0) `(,@type-stub
))))
250 (assert (= (length (test `(,@type-stub
6))) 6))
251 (assert (equalp (test `(,@type-stub
6))
252 (coerce #(1 1 1 0 1 0) `(,@type-stub
6))))
253 (assert-type-error (test `(,@type-stub
4))))
255 (assert (= (length (map `(,@type-stub
) #'logxor
#(0 0 1 1) '(0 1 0 1))) 4))
256 (assert (equalp (map `(,@type-stub
) #'logxor
#(0 0 1 1) '(0 1 0 1))
257 (coerce #(0 1 1 0) `(,@type-stub
))))
258 (assert (= (length (map `(,@type-stub
4) #'logxor
#(0 0 1 1) '(0 1 0 1)))
260 (assert (equalp (map `(,@type-stub
4) #'logxor
#(0 0 1 1) '(0 1 0 1))
261 (coerce #(0 1 1 0) `(,@type-stub
4))))
262 (assert-type-error (map `(,@type-stub
5) #'logxor
#(0 0 1 1) '(0 1 0 1))))
263 ;; some more CONCATENATE tests for strings
265 (declare (optimize safety
))
266 (assert (string= (concatenate 'string
"foo" " " "bar") "foo bar"))
267 (assert (string= (concatenate '(string 7) "foo" " " "bar") "foo bar"))
268 (assert-type-error (concatenate '(string 6) "foo" " " "bar"))
269 (assert (string= (concatenate '(string 6) "foo" #(#\b #\a #\r)) "foobar"))
270 (assert-type-error (concatenate '(string 7) "foo" #(#\b #\a #\r))))
271 ;; Non-VECTOR ARRAY types aren't allowed as vector type specifiers.
273 (declare (optimize safety
))
274 (assert-type-error (concatenate 'simple-array
"foo" "bar"))
275 (assert-type-error (map 'simple-array
#'identity
'(1 2 3)))
276 (assert (equalp #(11 13)
277 (map '(simple-array fixnum
(*)) #'+ '(1 2 3) '(10 11))))
278 (assert-type-error (coerce '(1 2 3) 'simple-array
))
279 (assert-type-error (merge 'simple-array
(list 1 3) (list 2 4) '<))
280 (assert (equalp #(3 2 1) (coerce '(3 2 1) '(vector fixnum
))))
281 (assert-type-error (map 'array
#'identity
'(1 2 3)))
282 (assert-type-error (map '(array fixnum
) #'identity
'(1 2 3)))
283 (assert (equalp #(1 2 3) (coerce '(1 2 3) '(vector fixnum
))))
284 ;; but COERCE has an exemption clause:
285 (assert (string= "foo" (coerce "foo" 'simple-array
)))
286 ;; ... though not in all cases.
287 (assert-type-error (coerce '(#\f #\o
#\o
) 'simple-array
))))
289 ;;; As pointed out by Raymond Toy on #lisp IRC, MERGE had some issues
290 ;;; with user-defined types until sbcl-0.7.8.11
291 (deftype list-typeoid
() 'list
)
292 (assert (equal '(1 2 3 4) (merge 'list-typeoid
(list 1 3) (list 2 4) '<)))
293 ;;; and also with types that weren't precicely LIST
294 (assert (equal '(1 2 3 4) (merge 'cons
(list 1 3) (list 2 4) '<)))
296 ;;; but wait, there's more! The NULL and CONS types also have implicit
297 ;;; length requirements:
298 (macrolet ((assert-type-error (form)
299 `(assert (typep (nth-value 1 (ignore-errors ,form
))
302 (declare (optimize safety
))
304 (assert-type-error (make-sequence 'cons
0))
305 (assert-type-error (make-sequence 'null
1))
306 (assert-type-error (make-sequence '(cons t null
) 0))
307 (assert-type-error (make-sequence '(cons t null
) 2))
308 ;; KLUDGE: I'm not certain that this test actually tests for what
309 ;; it should test, in that the type deriver and optimizers might
310 ;; be too smart for the good of an exhaustive test system.
311 ;; However, it makes me feel good. -- CSR, 2002-10-18
312 (assert (null (make-sequence 'null
0)))
313 (assert (= (length (make-sequence 'cons
3)) 3))
314 (assert (= (length (make-sequence '(cons t null
) 1)) 1))
315 ;; and NIL is not a valid type for MAKE-SEQUENCE
316 (assert-type-error (make-sequence 'nil
0))
318 (assert-type-error (coerce #(1) 'null
))
319 (assert-type-error (coerce #() 'cons
))
320 (assert-type-error (coerce #() '(cons t null
)))
321 (assert-type-error (coerce #(1 2) '(cons t null
)))
322 (assert (null (coerce #() 'null
)))
323 (assert (= (length (coerce #(1) 'cons
)) 1))
324 (assert (= (length (coerce #(1) '(cons t null
))) 1))
325 (assert-type-error (coerce #() 'nil
))
327 (assert-type-error (merge 'null
(list 1 3) (list 2 4) '<))
328 (assert-type-error (merge 'cons
() () '<))
329 (assert (null (merge 'null
() () '<)))
330 (assert (= (length (merge 'cons
(list 1 3) (list 2 4) '<)) 4))
331 (assert (= (length (merge '(cons t
(cons t
(cons t
(cons t null
))))
332 (list 1 3) (list 2 4)
335 (assert-type-error (merge 'nil
() () '<))
337 (assert-type-error (concatenate 'null
'(1) "2"))
338 (assert-type-error (concatenate 'cons
#() ()))
339 (assert-type-error (concatenate '(cons t null
) #(1 2 3) #(4 5 6)))
340 (assert (null (concatenate 'null
() #())))
341 (assert (= (length (concatenate 'cons
#() '(1) "2 3")) 4))
342 (assert (= (length (concatenate '(cons t cons
) '(1) "34")) 3))
343 (assert-type-error (concatenate 'nil
'(3)))
344 ;; FIXME: tests for MAP to come when some brave soul implements
345 ;; the analogous type checking for MAP/%MAP.
348 ;;; ELT should signal an error of type TYPE-ERROR if its index
349 ;;; argument isn't a valid sequence index for sequence:
350 (defun test-elt-signal (x)
352 (assert (raises-error?
(test-elt-signal "foo") type-error
))
353 (assert (eql (test-elt-signal "foob") #\b))
355 (declare (optimize (safety 3)))
356 (assert (raises-error?
(elt (list 1 2 3) 3) type-error
)))
358 ;;; confusion in the refactoring led to this signalling an unbound
359 ;;; variable, not a type error.
360 (defun svrefalike (x)
362 (assert (raises-error?
(svrefalike #*0) type-error
))
364 ;;; checks for uniform bounding index handling under SAFETY 3 code.
366 ;;; KLUDGE: not all in one big form because that causes SBCL to spend
367 ;;; an absolute age trying to compile it.
368 (defmacro sequence-bounding-indices-test
(&body body
)
371 ;; See Issues 332 [and 333(!)] in the CLHS
372 (declare (optimize (safety 3)))
373 (let ((string (make-array 10
376 :element-type
'base-char
)))
378 (format t
"... BASE-CHAR")
381 (setf (fill-pointer string
) 10)
383 (setf (fill-pointer string
) 5)))
384 (declare (ignorable #'reset
))
387 ;; See Issues 332 [and 333(!)] in the CLHS
388 (declare (optimize (safety 3)))
389 (let ((string (make-array 10
392 :element-type
'character
)))
394 (format t
"... CHARACTER")
397 (setf (fill-pointer string
) 10)
399 (setf (fill-pointer string
) 5)))
400 (declare (ignorable #'reset
))
403 (declaim (notinline opaque-identity
))
404 (defun opaque-identity (x) x
)
406 (sequence-bounding-indices-test
407 (format t
"~&/Accessor SUBSEQ")
408 (assert (string= (subseq string
0 5) "aaaaa"))
409 (assert (raises-error?
(subseq string
0 6)))
410 (assert (raises-error?
(subseq string
(opaque-identity -
1) 5)))
411 (assert (raises-error?
(subseq string
4 2)))
412 (assert (raises-error?
(subseq string
6)))
413 (assert (string= (setf (subseq string
0 5) "abcde") "abcde"))
414 (assert (string= (subseq string
0 5) "abcde"))
416 (assert (raises-error?
(setf (subseq string
0 6) "abcdef")))
417 (assert (raises-error?
(setf (subseq string
(opaque-identity -
1) 5) "abcdef")))
418 (assert (raises-error?
(setf (subseq string
4 2) "")))
419 (assert (raises-error?
(setf (subseq string
6) "ghij"))))
421 ;;; Function COUNT, COUNT-IF, COUNT-IF-NOT
422 (sequence-bounding-indices-test
423 (format t
"~&/Function COUNT, COUNT-IF, COUNT-IF-NOT")
424 (assert (= (count #\a string
:start
0 :end nil
) 5))
425 (assert (= (count #\a string
:start
0 :end
5) 5))
426 (assert (raises-error?
(count #\a string
:start
0 :end
6)))
427 (assert (raises-error?
(count #\a string
:start
(opaque-identity -
1) :end
5)))
428 (assert (raises-error?
(count #\a string
:start
4 :end
2)))
429 (assert (raises-error?
(count #\a string
:start
6 :end
9)))
430 (assert (= (count-if #'alpha-char-p string
:start
0 :end nil
) 5))
431 (assert (= (count-if #'alpha-char-p string
:start
0 :end
5) 5))
432 (assert (raises-error?
433 (count-if #'alpha-char-p string
:start
0 :end
6)))
434 (assert (raises-error?
435 (count-if #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
436 (assert (raises-error?
437 (count-if #'alpha-char-p string
:start
4 :end
2)))
438 (assert (raises-error?
439 (count-if #'alpha-char-p string
:start
6 :end
9)))
440 (assert (= (count-if-not #'alpha-char-p string
:start
0 :end nil
) 0))
441 (assert (= (count-if-not #'alpha-char-p string
:start
0 :end
5) 0))
442 (assert (raises-error?
443 (count-if-not #'alpha-char-p string
:start
0 :end
6)))
444 (assert (raises-error?
445 (count-if-not #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
446 (assert (raises-error?
447 (count-if-not #'alpha-char-p string
:start
4 :end
2)))
448 (assert (raises-error?
449 (count-if-not #'alpha-char-p string
:start
6 :end
9))))
452 (sequence-bounding-indices-test
453 (format t
"~&/Function FILL")
454 (assert (string= (fill string
#\b :start
0 :end
5) "bbbbb"))
455 (assert (string= (fill string
#\c
:start
0 :end nil
) "ccccc"))
456 (assert (raises-error?
(fill string
#\d
:start
0 :end
6)))
457 (assert (raises-error?
(fill string
#\d
:start
(opaque-identity -
1) :end
5)))
458 (assert (raises-error?
(fill string
#\d
:start
4 :end
2)))
459 (assert (raises-error?
(fill string
#\d
:start
6 :end
9))))
461 ;;; Function FIND, FIND-IF, FIND-IF-NOT
462 (sequence-bounding-indices-test
463 (format t
"~&/Function FIND, FIND-IF, FIND-IF-NOT")
464 (assert (char= (find #\a string
:start
0 :end nil
) #\a))
465 (assert (char= (find #\a string
:start
0 :end
5) #\a))
466 (assert (raises-error?
(find #\a string
:start
0 :end
6)))
467 (assert (raises-error?
(find #\a string
:start
(opaque-identity -
1) :end
5)))
468 (assert (raises-error?
(find #\a string
:start
4 :end
2)))
469 (assert (raises-error?
(find #\a string
:start
6 :end
9)))
470 (assert (char= (find-if #'alpha-char-p string
:start
0 :end nil
) #\a))
471 (assert (char= (find-if #'alpha-char-p string
:start
0 :end
5) #\a))
472 (assert (raises-error?
473 (find-if #'alpha-char-p string
:start
0 :end
6)))
474 (assert (raises-error?
475 (find-if #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
476 (assert (raises-error?
477 (find-if #'alpha-char-p string
:start
4 :end
2)))
478 (assert (raises-error?
479 (find-if #'alpha-char-p string
:start
6 :end
9)))
480 (assert (eq (find-if-not #'alpha-char-p string
:start
0 :end nil
) nil
))
481 (assert (eq (find-if-not #'alpha-char-p string
:start
0 :end
5) nil
))
482 (assert (raises-error?
483 (find-if-not #'alpha-char-p string
:start
0 :end
6)))
484 (assert (raises-error?
485 (find-if-not #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
486 (assert (raises-error?
487 (find-if-not #'alpha-char-p string
:start
4 :end
2)))
488 (assert (raises-error?
489 (find-if-not #'alpha-char-p string
:start
6 :end
9))))
491 ;;; Function MISMATCH
492 (sequence-bounding-indices-test
493 (format t
"~&/Function MISMATCH")
494 (assert (null (mismatch string
"aaaaa" :start1
0 :end1 nil
)))
495 (assert (= (mismatch "aaab" string
:start2
0 :end2
4) 3))
496 (assert (raises-error?
(mismatch "aaaaaa" string
:start2
0 :end2
6)))
497 (assert (raises-error?
(mismatch string
"aaaaaa" :start1
(opaque-identity -
1) :end1
5)))
498 (assert (raises-error?
(mismatch string
"" :start1
4 :end1
2)))
499 (assert (raises-error?
(mismatch "aaaa" string
:start2
6 :end2
9))))
501 ;;; Function PARSE-INTEGER
502 (sequence-bounding-indices-test
503 (format t
"~&/Function PARSE-INTEGER")
504 (setf (fill-pointer string
) 10)
505 (setf (subseq string
0 10) "1234567890")
506 (setf (fill-pointer string
) 5)
507 (assert (= (parse-integer string
:start
0 :end
5) 12345))
508 (assert (= (parse-integer string
:start
0 :end nil
) 12345))
509 (assert (raises-error?
(parse-integer string
:start
0 :end
6)))
510 (assert (raises-error?
(parse-integer string
:start
(opaque-identity -
1) :end
5)))
511 (assert (raises-error?
(parse-integer string
:start
4 :end
2)))
512 (assert (raises-error?
(parse-integer string
:start
6 :end
9))))
514 ;;; Function PARSE-NAMESTRING
515 (sequence-bounding-indices-test
516 (format t
"~&/Function PARSE-NAMESTRING")
517 (setf (fill-pointer string
) 10)
518 (setf (subseq string
0 10)
521 (setf (fill-pointer string
) 5)
522 (assert (truename (parse-namestring string nil
*default-pathname-defaults
*
524 (assert (truename (parse-namestring string nil
*default-pathname-defaults
*
526 (assert (raises-error?
(parse-namestring string nil
527 *default-pathname-defaults
*
529 (assert (raises-error?
(parse-namestring string nil
530 *default-pathname-defaults
*
531 :start
(opaque-identity -
1) :end
5)))
532 (assert (raises-error?
(parse-namestring string nil
533 *default-pathname-defaults
*
535 (assert (raises-error?
(parse-namestring string nil
536 *default-pathname-defaults
*
539 ;;; Function POSITION, POSITION-IF, POSITION-IF-NOT
540 (sequence-bounding-indices-test
541 (format t
"~&/Function POSITION, POSITION-IF, POSITION-IF-NOT")
543 (assert (= (position #\a string
:start
0 :end nil
) 0))
544 (assert (= (position #\a string
:start
0 :end
5) 0))
545 (assert (raises-error?
(position #\a string
:start
0 :end
6)))
546 (assert (raises-error?
(position #\a string
:start
(opaque-identity -
1) :end
5)))
547 (assert (raises-error?
(position #\a string
:start
4 :end
2)))
548 (assert (raises-error?
(position #\a string
:start
6 :end
9)))
549 (assert (= (position-if #'alpha-char-p string
:start
0 :end nil
) 0))
550 (assert (= (position-if #'alpha-char-p string
:start
0 :end
5) 0))
551 (assert (raises-error?
552 (position-if #'alpha-char-p string
:start
0 :end
6)))
553 (assert (raises-error?
554 (position-if #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
555 (assert (raises-error?
556 (position-if #'alpha-char-p string
:start
4 :end
2)))
557 (assert (raises-error?
558 (position-if #'alpha-char-p string
:start
6 :end
9)))
559 (assert (eq (position-if-not #'alpha-char-p string
:start
0 :end nil
) nil
))
560 (assert (eq (position-if-not #'alpha-char-p string
:start
0 :end
5) nil
))
561 (assert (raises-error?
562 (position-if-not #'alpha-char-p string
:start
0 :end
6)))
563 (assert (raises-error?
564 (position-if-not #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
565 (assert (raises-error?
566 (position-if-not #'alpha-char-p string
:start
4 :end
2)))
567 (assert (raises-error?
568 (position-if-not #'alpha-char-p string
:start
6 :end
9))))
570 ;;; Function READ-FROM-STRING
571 (sequence-bounding-indices-test
572 (format t
"~&/Function READ-FROM-STRING")
573 (setf (subseq string
0 5) "(a b)")
574 (assert (equal (read-from-string string nil nil
:start
0 :end
5) '(a b
)))
575 (assert (equal (read-from-string string nil nil
:start
0 :end nil
) '(a b
)))
576 (assert (raises-error?
(read-from-string string nil nil
:start
0 :end
6)))
577 (assert (raises-error?
(read-from-string string nil nil
:start
(opaque-identity -
1) :end
5)))
578 (assert (raises-error?
(read-from-string string nil nil
:start
4 :end
2)))
579 (assert (raises-error?
(read-from-string string nil nil
:start
6 :end
9))))
582 (sequence-bounding-indices-test
583 (format t
"~&/Function REDUCE")
584 (setf (subseq string
0 5) "abcde")
585 (assert (equal (reduce #'list
* string
:from-end t
:start
0 :end nil
)
586 '(#\a #\b #\c
#\d .
#\e
)))
587 (assert (equal (reduce #'list
* string
:from-end t
:start
0 :end
5)
588 '(#\a #\b #\c
#\d .
#\e
)))
589 (assert (raises-error?
(reduce #'list
* string
:start
0 :end
6)))
590 (assert (raises-error?
(reduce #'list
* string
:start
(opaque-identity -
1) :end
5)))
591 (assert (raises-error?
(reduce #'list
* string
:start
4 :end
2)))
592 (assert (raises-error?
(reduce #'list
* string
:start
6 :end
9))))
594 ;;; Function REMOVE, REMOVE-IF, REMOVE-IF-NOT, DELETE, DELETE-IF,
596 (sequence-bounding-indices-test
597 (format t
"~&/Function REMOVE, REMOVE-IF, REMOVE-IF-NOT, ...")
598 (assert (equal (remove #\a string
:start
0 :end nil
) ""))
599 (assert (equal (remove #\a string
:start
0 :end
5) ""))
600 (assert (raises-error?
(remove #\a string
:start
0 :end
6)))
601 (assert (raises-error?
(remove #\a string
:start
(opaque-identity -
1) :end
5)))
602 (assert (raises-error?
(remove #\a string
:start
4 :end
2)))
603 (assert (raises-error?
(remove #\a string
:start
6 :end
9)))
604 (assert (equal (remove-if #'alpha-char-p string
:start
0 :end nil
) ""))
605 (assert (equal (remove-if #'alpha-char-p string
:start
0 :end
5) ""))
606 (assert (raises-error?
607 (remove-if #'alpha-char-p string
:start
0 :end
6)))
608 (assert (raises-error?
609 (remove-if #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
610 (assert (raises-error?
611 (remove-if #'alpha-char-p string
:start
4 :end
2)))
612 (assert (raises-error?
613 (remove-if #'alpha-char-p string
:start
6 :end
9)))
614 (assert (equal (remove-if-not #'alpha-char-p string
:start
0 :end nil
)
616 (assert (equal (remove-if-not #'alpha-char-p string
:start
0 :end
5)
618 (assert (raises-error?
619 (remove-if-not #'alpha-char-p string
:start
0 :end
6)))
620 (assert (raises-error?
621 (remove-if-not #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
622 (assert (raises-error?
623 (remove-if-not #'alpha-char-p string
:start
4 :end
2)))
624 (assert (raises-error?
625 (remove-if-not #'alpha-char-p string
:start
6 :end
9))))
626 (sequence-bounding-indices-test
627 (format t
"~&/... DELETE, DELETE-IF, DELETE-IF-NOT")
628 (assert (equal (delete #\a string
:start
0 :end nil
) ""))
630 (assert (equal (delete #\a string
:start
0 :end
5) ""))
632 (assert (raises-error?
(delete #\a string
:start
0 :end
6)))
634 (assert (raises-error?
(delete #\a string
:start
(opaque-identity -
1) :end
5)))
636 (assert (raises-error?
(delete #\a string
:start
4 :end
2)))
638 (assert (raises-error?
(delete #\a string
:start
6 :end
9)))
640 (assert (equal (delete-if #'alpha-char-p string
:start
0 :end nil
) ""))
642 (assert (equal (delete-if #'alpha-char-p string
:start
0 :end
5) ""))
644 (assert (raises-error?
645 (delete-if #'alpha-char-p string
:start
0 :end
6)))
647 (assert (raises-error?
648 (delete-if #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
650 (assert (raises-error?
651 (delete-if #'alpha-char-p string
:start
4 :end
2)))
653 (assert (raises-error?
654 (delete-if #'alpha-char-p string
:start
6 :end
9)))
656 (assert (equal (delete-if-not #'alpha-char-p string
:start
0 :end nil
)
659 (assert (equal (delete-if-not #'alpha-char-p string
:start
0 :end
5)
662 (assert (raises-error?
663 (delete-if-not #'alpha-char-p string
:start
0 :end
6)))
665 (assert (raises-error?
666 (delete-if-not #'alpha-char-p string
:start
(opaque-identity -
1) :end
5)))
668 (assert (raises-error?
669 (delete-if-not #'alpha-char-p string
:start
4 :end
2)))
671 (assert (raises-error?
672 (delete-if-not #'alpha-char-p string
:start
6 :end
9))))
674 ;;; Function REMOVE-DUPLICATES, DELETE-DUPLICATES
675 (sequence-bounding-indices-test
676 (format t
"~&/Function REMOVE-DUPLICATES, DELETE-DUPLICATES")
677 (assert (string= (remove-duplicates string
:start
0 :end
5) "a"))
678 (assert (string= (remove-duplicates string
:start
0 :end nil
) "a"))
679 (assert (raises-error?
(remove-duplicates string
:start
0 :end
6)))
680 (assert (raises-error?
(remove-duplicates string
:start
(opaque-identity -
1) :end
5)))
681 (assert (raises-error?
(remove-duplicates string
:start
4 :end
2)))
682 (assert (raises-error?
(remove-duplicates string
:start
6 :end
9)))
683 (assert (string= (delete-duplicates string
:start
0 :end
5) "a"))
685 (assert (string= (delete-duplicates string
:start
0 :end nil
) "a"))
687 (assert (raises-error?
(delete-duplicates string
:start
0 :end
6)))
689 (assert (raises-error?
(delete-duplicates string
:start
(opaque-identity -
1) :end
5)))
691 (assert (raises-error?
(delete-duplicates string
:start
4 :end
2)))
693 (assert (raises-error?
(delete-duplicates string
:start
6 :end
9))))
696 (sequence-bounding-indices-test
697 (format t
"~&/Function REPLACE")
698 (assert (string= (replace string
"bbbbb" :start1
0 :end1
5) "bbbbb"))
699 (assert (string= (replace (copy-seq "ccccc")
701 :start2
0 :end2 nil
) "bbbbb"))
702 (assert (raises-error?
(replace string
"ccccc" :start1
0 :end1
6)))
703 (assert (raises-error?
(replace string
"ccccc" :start2
(opaque-identity -
1) :end2
5)))
704 (assert (raises-error?
(replace string
"ccccc" :start1
4 :end1
2)))
705 (assert (raises-error?
(replace string
"ccccc" :start1
6 :end1
9))))
708 (sequence-bounding-indices-test
709 (format t
"~&/Function SEARCH")
710 (assert (= (search "aa" string
:start2
0 :end2
5) 0))
711 (assert (null (search string
"aa" :start1
0 :end2 nil
)))
712 (assert (raises-error?
(search "aa" string
:start2
0 :end2
6)))
713 (assert (raises-error?
(search "aa" string
:start2
(opaque-identity -
1) :end2
5)))
714 (assert (raises-error?
(search "aa" string
:start2
4 :end2
2)))
715 (assert (raises-error?
(search "aa" string
:start2
6 :end2
9))))
717 ;;; Function STRING-UPCASE, STRING-DOWNCASE, STRING-CAPITALIZE,
718 ;;; NSTRING-UPCASE, NSTRING-DOWNCASE, NSTRING-CAPITALIZE
719 (defmacro string-case-frob
(fn)
721 (assert (raises-error?
(,fn string
:start
0 :end
6)))
722 (assert (raises-error?
(,fn string
:start
(opaque-identity -
1) :end
5)))
723 (assert (raises-error?
(,fn string
:start
4 :end
2)))
724 (assert (raises-error?
(,fn string
:start
6 :end
9)))))
726 (sequence-bounding-indices-test
727 (format t
"~&/Function STRING-UPCASE, STRING-DOWNCASE, STRING-CAPITALIZE, ...")
728 (string-case-frob string-upcase
)
729 (string-case-frob string-downcase
)
730 (string-case-frob string-capitalize
)
731 (format t
"~&/... NSTRING-UPCASE, NSTRING-DOWNCASE, NSTRING-CAPITALIZE")
732 (string-case-frob nstring-upcase
)
733 (string-case-frob nstring-downcase
)
734 (string-case-frob nstring-capitalize
))
736 ;;; Function STRING=, STRING/=, STRING<, STRING>, STRING<=, STRING>=,
737 ;;; STRING-EQUAL, STRING-NOT-EQUAL, STRING-LESSP, STRING-GREATERP,
738 ;;; STRING-NOT-GREATERP, STRING-NOT-LESSP
739 (defmacro string-predicate-frob
(fn)
741 (,fn string
"abcde" :start1
0 :end1
5)
742 (,fn
"fghij" string
:start2
0 :end2 nil
)
743 (assert (raises-error?
(,fn string
"klmno"
745 (assert (raises-error?
(,fn
"pqrst" string
746 :start2
(opaque-identity -
1) :end2
5)))
747 (assert (raises-error?
(,fn
"uvwxy" string
749 (assert (raises-error?
(,fn string
"z" :start2
6 :end2
9)))))
750 (sequence-bounding-indices-test
751 (format t
"~&/Function STRING=, STRING/=, STRING<, STRING>, STRING<=, STRING>=, ...")
752 (string-predicate-frob string
=)
753 (string-predicate-frob string
/=)
754 (string-predicate-frob string
<)
755 (string-predicate-frob string
>)
756 (string-predicate-frob string
<=)
757 (string-predicate-frob string
>=))
758 (sequence-bounding-indices-test
759 (format t
"~&/... STRING-EQUAL, STRING-NOT-EQUAL, STRING-LESSP, ...")
760 (string-predicate-frob string-equal
)
761 (string-predicate-frob string-not-equal
)
762 (string-predicate-frob string-lessp
))
763 (sequence-bounding-indices-test
764 (format t
"~&/... STRING-GREATERP, STRING-NOT-GREATERP, STRING-NOT-LESSP")
765 (string-predicate-frob string-greaterp
)
766 (string-predicate-frob string-not-greaterp
)
767 (string-predicate-frob string-not-lessp
))
769 ;;; Function SUBSTITUTE, SUBSTITUTE-IF, SUBSTITUTE-IF-NOT,
770 ;;; NSUBSTITUTE, NSUBSTITUTE-IF, NSUBSTITUTE-IF-NOT
771 (sequence-bounding-indices-test
772 (format t
"~&/Function SUBSTITUTE, SUBSTITUTE-IF, SUBSTITUTE-IF-NOT, ...")
773 (assert (string= (substitute #\b #\a string
:start
0 :end
5) "bbbbb"))
774 (assert (string= (substitute #\c
#\a string
:start
0 :end nil
)
776 (assert (raises-error?
(substitute #\b #\a string
:start
0 :end
6)))
777 (assert (raises-error?
(substitute #\b #\a string
:start
(opaque-identity -
1) :end
5)))
778 (assert (raises-error?
(substitute #\b #\a string
:start
4 :end
2)))
779 (assert (raises-error?
(substitute #\b #\a string
:start
6 :end
9)))
780 (assert (string= (substitute-if #\b #'alpha-char-p string
783 (assert (string= (substitute-if #\c
#'alpha-char-p string
786 (assert (raises-error?
(substitute-if #\b #'alpha-char-p string
788 (assert (raises-error?
(substitute-if #\b #'alpha-char-p string
789 :start
(opaque-identity -
1) :end
5)))
790 (assert (raises-error?
(substitute-if #\b #'alpha-char-p string
792 (assert (raises-error?
(substitute-if #\b #'alpha-char-p string
794 (assert (string= (substitute-if-not #\b #'alpha-char-p string
797 (assert (string= (substitute-if-not #\c
#'alpha-char-p string
800 (assert (raises-error?
(substitute-if-not #\b #'alpha-char-p string
802 (assert (raises-error?
(substitute-if-not #\b #'alpha-char-p string
803 :start
(opaque-identity -
1) :end
5)))
804 (assert (raises-error?
(substitute-if-not #\b #'alpha-char-p string
806 (assert (raises-error?
(substitute-if-not #\b #'alpha-char-p string
808 (sequence-bounding-indices-test
809 (format t
"~&/... NSUBSTITUTE, NSUBSTITUTE-IF, NSUBSTITUTE-IF-NOT")
810 (assert (string= (nsubstitute #\b #\a string
:start
0 :end
5) "bbbbb"))
812 (assert (string= (nsubstitute #\c
#\a string
:start
0 :end nil
)
815 (assert (raises-error?
(nsubstitute #\b #\a string
:start
0 :end
6)))
817 (assert (raises-error?
(nsubstitute #\b #\a string
:start
(opaque-identity -
1) :end
5)))
819 (assert (raises-error?
(nsubstitute #\b #\a string
:start
4 :end
2)))
821 (assert (raises-error?
(nsubstitute #\b #\a string
:start
6 :end
9)))
823 (assert (string= (nsubstitute-if #\b #'alpha-char-p string
827 (assert (string= (nsubstitute-if #\c
#'alpha-char-p string
831 (assert (raises-error?
(nsubstitute-if #\b #'alpha-char-p string
834 (assert (raises-error?
(nsubstitute-if #\b #'alpha-char-p string
835 :start
(opaque-identity -
1) :end
5)))
837 (assert (raises-error?
(nsubstitute-if #\b #'alpha-char-p string
840 (assert (raises-error?
(nsubstitute-if #\b #'alpha-char-p string
843 (assert (string= (nsubstitute-if-not #\b #'alpha-char-p string
847 (assert (string= (nsubstitute-if-not #\c
#'alpha-char-p string
851 (assert (raises-error?
(nsubstitute-if-not #\b #'alpha-char-p string
854 (assert (raises-error?
(nsubstitute-if-not #\b #'alpha-char-p string
855 :start
(opaque-identity -
1) :end
5)))
857 (assert (raises-error?
(nsubstitute-if-not #\b #'alpha-char-p string
860 (assert (raises-error?
(nsubstitute-if-not #\b #'alpha-char-p string
862 ;;; Function WRITE-STRING, WRITE-LINE
863 (sequence-bounding-indices-test
864 (format t
"~&/Function WRITE-STRING, WRITE-LINE")
865 (write-string string
*standard-output
* :start
0 :end
5)
866 (write-string string
*standard-output
* :start
0 :end nil
)
867 (assert (raises-error?
(write-string string
*standard-output
*
869 (assert (raises-error?
(write-string string
*standard-output
*
870 :start
(opaque-identity -
1) :end
5)))
871 (assert (raises-error?
(write-string string
*standard-output
*
873 (assert (raises-error?
(write-string string
*standard-output
*
875 (write-line string
*standard-output
* :start
0 :end
5)
876 (write-line string
*standard-output
* :start
0 :end nil
)
877 (assert (raises-error?
(write-line string
*standard-output
*
879 (assert (raises-error?
(write-line string
*standard-output
*
880 :start
(opaque-identity -
1) :end
5)))
881 (assert (raises-error?
(write-line string
*standard-output
*
883 (assert (raises-error?
(write-line string
*standard-output
*
886 ;;; Macro WITH-INPUT-FROM-STRING
887 (sequence-bounding-indices-test
888 (format t
"~&/Macro WITH-INPUT-FROM-STRING")
889 (with-input-from-string (s string
:start
0 :end
5)
890 (assert (char= (read-char s
) #\a)))
891 (with-input-from-string (s string
:start
0 :end nil
)
892 (assert (char= (read-char s
) #\a)))
893 (assert (raises-error?
894 (with-input-from-string (s string
:start
0 :end
6)
896 (assert (raises-error?
897 (with-input-from-string (s string
:start
(opaque-identity -
1) :end
5)
899 (assert (raises-error?
900 (with-input-from-string (s string
:start
4 :end
2)
902 (assert (raises-error?
903 (with-input-from-string (s string
:start
6 :end
9)
906 ;;; testing bit-bashing according to _The Practice of Programming_
907 (defun fill-bytes-for-testing (bitsize)
908 "Return a list of 'bytes' of type (MOD BITSIZE)."
909 (remove-duplicates (list 0
910 (1- (ash 1 (1- bitsize
)))
912 (1- (ash 1 bitsize
)))))
914 (defun fill-with-known-value (value size
&rest vectors
)
915 (dolist (vec vectors
)
917 (setf (aref vec i
) value
))))
919 (defun collect-fill-amounts (n-power)
921 (loop for i from
0 upto n-power
922 collect
(1- (expt 2 i
))
924 collect
(1+ (expt 2 i
)))))
926 (defun test-fill-bashing (bitsize padding-amount n-power
)
927 (let* ((size (+ (* padding-amount
2) (expt 2 n-power
) (* padding-amount
2)))
928 (standard (make-array size
:element-type
`(unsigned-byte ,bitsize
)))
929 (bashed (make-array size
:element-type
`(unsigned-byte ,bitsize
)))
930 (fill-amounts (collect-fill-amounts n-power
))
931 (bash-function (intern (format nil
"UB~A-BASH-FILL" bitsize
)
932 (find-package "SB-KERNEL"))))
933 (format t
"~&/Function ~A..." bash-function
)
934 (loop for offset from padding-amount below
(* 2 padding-amount
) do
935 (dolist (c (fill-bytes-for-testing bitsize
))
936 (dolist (n fill-amounts
)
937 (fill-with-known-value (mod (lognot c
) (ash 1 bitsize
)) n
940 ;; a) the standard slow way
941 (fill standard c
:start offset
:end
(+ offset n
))
942 ;; b) the blazingly fast way
943 (let ((value (loop for i from
0 by bitsize
944 until
(= i sb-vm
:n-word-bits
)
946 (funcall bash-function value bashed offset n
))
948 (when (mismatch standard bashed
)
949 (format t
"Test with offset ~A, fill ~A and length ~A failed.~%"
951 (format t
"Mismatch: ~A ~A~%"
952 (subseq standard
0 (+ offset n
1))
953 (subseq bashed
0 (+ offset n
1)))
954 (return-from test-fill-bashing nil
))))
955 finally
(return t
))))
957 (defun test-copy-bashing (bitsize padding-amount n-power
)
958 (let* ((size (+ (* padding-amount
2) (expt 2 n-power
) (* padding-amount
2)))
959 (standard-dst (make-array size
:element-type
`(unsigned-byte ,bitsize
)))
960 (bashed-dst (make-array size
:element-type
`(unsigned-byte ,bitsize
)))
961 (source (make-array size
:element-type
`(unsigned-byte ,bitsize
)))
962 (fill-amounts (collect-fill-amounts n-power
))
963 (bash-function (intern (format nil
"UB~A-BASH-COPY" bitsize
)
964 (find-package "SB-KERNEL"))))
965 (format t
"~&/Function ~A..." bash-function
)
966 (do ((source-offset padding-amount
(1+ source-offset
)))
967 ((>= source-offset
(* padding-amount
2))
970 (do ((target-offset padding-amount
(1+ target-offset
)))
971 ((>= target-offset
(* padding-amount
2)))
972 (dolist (c (fill-bytes-for-testing bitsize
))
973 (dolist (n fill-amounts
)
974 (fill-with-known-value (mod (lognot c
) (ash 1 bitsize
)) size
975 source standard-dst bashed-dst
)
976 ;; fill with test data
977 (fill source c
:start source-offset
:end
(+ source-offset n
))
978 ;; copy filled test data to test vectors
980 (replace standard-dst source
981 :start1 target-offset
:end1
(+ target-offset n
)
982 :start2 source-offset
:end2
(+ source-offset n
))
983 ;; b) the blazingly fast way
984 (funcall bash-function source source-offset
985 bashed-dst target-offset n
)
987 (when (mismatch standard-dst bashed-dst
)
988 (format t
"Test with target-offset ~A, source-offset ~A, fill ~A, and length ~A failed.~%"
989 target-offset source-offset c n
)
990 (format t
"Mismatch:~% correct ~A~% actual ~A~%"
993 (return-from test-copy-bashing nil
))))))))
995 ;; Too slow for the interpreter
996 #+#.
(cl:if
(cl:eq sb-ext
:*evaluator-mode
* :compile
) '(and) '(or))
997 (loop for i
= 1 then
(* i
2) do
998 ;; the bare '32' here is fairly arbitrary; '8' provides a good
999 ;; range of lengths over which to fill and copy, which should tease
1000 ;; out most errors in the code (if any exist). (It also makes this
1001 ;; part of the test suite finish reasonably quickly.)
1002 (assert (test-fill-bashing i
32 8))
1003 (assert (test-copy-bashing i
32 8))
1004 until
(= i sb-vm
:n-word-bits
))