361 |
8 |
8 |
362 |
#*11111100) |
#*11111100) |
363 |
|
|
364 |
|
;;; Other specialized vectors |
365 |
|
|
366 |
|
(deftest map-into.specialized-vector.1 |
367 |
|
(do-special-integer-vectors |
368 |
|
(v #(1 2 3 4) nil) |
369 |
|
(let ((result (list nil nil nil nil))) |
370 |
|
(assert (eq (map-into result #'identity v) result)) |
371 |
|
(assert (equal result '(1 2 3 4))))) |
372 |
|
nil) |
373 |
|
|
374 |
|
(deftest map-into.specialized-vector.2 |
375 |
|
(do-special-integer-vectors |
376 |
|
(v #(1 2 3) nil) |
377 |
|
(let ((result (list nil nil nil nil))) |
378 |
|
(assert (eq (map-into result #'identity v) result)) |
379 |
|
(assert (equal result '(1 2 3 nil))))) |
380 |
|
nil) |
381 |
|
|
382 |
|
(deftest map-into.specialized-vector.3 |
383 |
|
(do-special-integer-vectors |
384 |
|
(v #(1 1 0 1 1) nil) |
385 |
|
(let ((result (list nil nil nil nil))) |
386 |
|
(assert (eq (map-into result #'identity v) result)) |
387 |
|
(assert (equal result '(1 1 0 1))))) |
388 |
|
nil) |
389 |
|
|
390 |
|
(deftest map-into.specialized-vector.4 |
391 |
|
(do-special-integer-vectors |
392 |
|
(v #(1 2 1 2 2) nil) |
393 |
|
(let ((v2 #(2 1 2 2 1))) |
394 |
|
(assert (eq (map-into v #'identity v2) v)) |
395 |
|
(assert (equalp v #(2 1 2 2 1))))) |
396 |
|
nil) |
397 |
|
|
398 |
|
(deftest map-into.specialized-vector.5 |
399 |
|
(let ((len 10)) |
400 |
|
(loop for etype in '(short-float single-float double-float long-float) |
401 |
|
for vals = (loop for i below len collect (coerce i etype)) |
402 |
|
for vec = (make-array len :initial-contents vals :element-type etype) |
403 |
|
for target = (loop repeat len collect nil) |
404 |
|
for result = (map-into target #'identity vec) |
405 |
|
unless (and (eq target result) |
406 |
|
(= (length result) len) |
407 |
|
(= (length vec) len) |
408 |
|
(equal vals result)) |
409 |
|
collect (list etype vals vec result))) |
410 |
|
nil) |
411 |
|
|
412 |
|
(deftest map-into.specialized-vector.6 |
413 |
|
(let ((len 10)) |
414 |
|
(loop for cetype in '(short-float single-float double-float long-float) |
415 |
|
for etype = `(complex ,cetype) |
416 |
|
for vals = (loop for i from 1 to len collect (complex (coerce i cetype) |
417 |
|
(coerce (- i) cetype))) |
418 |
|
for vec = (make-array len :initial-contents vals :element-type etype) |
419 |
|
for target = (loop repeat len collect nil) |
420 |
|
for result = (map-into target #'identity vec) |
421 |
|
unless (and (eq target result) |
422 |
|
(= (length result) len) |
423 |
|
(= (length vec) len) |
424 |
|
(equal vals result)) |
425 |
|
collect (list etype vals vec result))) |
426 |
|
nil) |
427 |
|
|
428 |
|
(deftest map-into.specialized-vector.7 |
429 |
|
(let ((len 10)) |
430 |
|
(loop for etype in '(short-float single-float double-float long-float) |
431 |
|
for vals = (loop for i below len collect (coerce i etype)) |
432 |
|
for target = (make-array len :initial-contents vals :element-type etype) |
433 |
|
for result = (map-into target #'identity vals) |
434 |
|
unless (and (eq target result) |
435 |
|
(= (length result) len) |
436 |
|
(every #'= result vals)) |
437 |
|
collect (list etype vals result))) |
438 |
|
nil) |
439 |
|
|
440 |
|
(deftest map-into.specialized-vector.8 |
441 |
|
(let ((len 10)) |
442 |
|
(loop for cetype in '(short-float single-float double-float long-float) |
443 |
|
for etype = `(complex ,cetype) |
444 |
|
for vals = (loop for i from 1 to len collect (complex (coerce i cetype) |
445 |
|
(coerce (- i) cetype))) |
446 |
|
for target = (make-array len :initial-contents vals :element-type etype) |
447 |
|
for result = (map-into target #'identity vals) |
448 |
|
unless (and (eq target result) |
449 |
|
(= (length result) len) |
450 |
|
(every #'= result vals)) |
451 |
|
collect (list etype vals result))) |
452 |
|
nil) |
453 |
|
|
454 |
;;; Error cases |
;;; Error cases |
455 |
|
|