271 |
))) |
))) |
272 |
3 3 1 1) |
3 3 1 1) |
273 |
|
|
274 |
|
;;; Other special vectors |
275 |
|
|
276 |
|
`(deftest count-if-not.special-vector.1 |
277 |
|
(do-special-integer-vectors |
278 |
|
(v #(1 0 1 1 1 0 1 1 1 0 1) nil) |
279 |
|
(assert (eql (count-if-not #'plusp v) 3)) |
280 |
|
(assert (eql (count-if-not #'zerop v) 8)) |
281 |
|
(assert (eql (count-if-not #'plusp v :start 2) 2)) |
282 |
|
(assert (eql (count-if-not #'zerop v :end 9) 7))) |
283 |
|
nil) |
284 |
|
|
285 |
|
(deftest count-if-not.special-vector.2 |
286 |
|
(do-special-integer-vectors |
287 |
|
(v #(1 3 2 4 7 5 6 1 0 2 4) nil) |
288 |
|
(assert (eql (count-if-not #'evenp v) 5)) |
289 |
|
(assert (eql (count-if-not #'oddp v) 6)) |
290 |
|
(assert (eql (count-if-not #'plusp v :start 2) 1)) |
291 |
|
(assert (eql (count-if-not #'zerop v :end 8) 8))) |
292 |
|
nil) |
293 |
|
|
294 |
|
(deftest count-if-not.special-vector.3 |
295 |
|
(loop for etype in '(short-float single-float double-float long-float) |
296 |
|
for vals = (loop for e in '(0 1 2 1 3 0 4 5 6 0) |
297 |
|
collect (coerce e etype)) |
298 |
|
for vec = (make-array (length vals) :element-type etype :initial-contents vals) |
299 |
|
for result = (count-if-not #'zerop vec) |
300 |
|
unless (= result 7) |
301 |
|
collect (list etype vals vec result)) |
302 |
|
nil) |
303 |
|
|
304 |
|
(deftest count-if-not.special-vector.4 |
305 |
|
(loop for cetype in '(short-float single-float double-float long-float integer rational) |
306 |
|
for etype = `(complex ,cetype) |
307 |
|
for vals = (loop for e in '(6 1 2 1 3 -4 4 5 6 100) |
308 |
|
collect (complex 0 (coerce e cetype))) |
309 |
|
for vec = (make-array (length vals) :element-type etype :initial-contents vals) |
310 |
|
for result = (count-if-not #'(lambda (x) (< (abs x) 5/2)) vec) |
311 |
|
unless (= result 7) |
312 |
|
collect (list etype vals vec result)) |
313 |
|
nil) |
314 |
|
|
315 |
|
|
316 |
;;; tests on bit-vectors |
;;; tests on bit-vectors |
317 |
|
|
318 |
(deftest count-if-not-bit-vector.1 |
(deftest count-if-not-bit-vector.1 |