+(test-util:with-test (:name :map)
+ (assertoid (map 'vector #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22))
+ (assertoid (map 'list #'+ #(1 2) '(100) #(0) #(100 100))
+ :expected-equal '(201)))
+
+;;; tests of MAP-INTO
+
+(test-util:with-test (:name :map-into)
+ (assertoid (map-into (vector) #'+ '(1 2 3) '(30 20))
+ :expected-equalp #())
+ (assertoid (map-into (vector 99) #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31))
+ (assertoid (map-into (vector 99 88) #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22))
+ (assertoid (map-into (vector 99 88 77) #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22 77))
+
+ (assertoid (map-into (list) #'+ '(1 2 3) '(30 20))
+ :expected-equalp '())
+ (assertoid (map-into (list 99) #'+ '(1 2 3) '(30 20))
+ :expected-equalp '(31))
+ (assertoid (map-into (list 99 88) #'+ '(1 2 3) '(30 20))
+ :expected-equalp '(31 22))
+ (assertoid (map-into (list 99 88 77) #'+ '(1 2 3) '(30 20))
+ :expected-equalp '(31 22 77))
+
+ (assertoid (map-into (vector 99 99 99) (constantly 5))
+ :expected-equalp #(5 5 5))
+ (assertoid (map-into (vector 99 99 99) (let ((x 0)) (lambda () (incf x))))
+ :expected-equalp #(1 2 3))
+
+ (assertoid (map-into (list 99 99 99) (constantly 5))
+ :expected-equalp '(5 5 5))
+ (assertoid (map-into (list 99 99 99) (let ((x 0)) (lambda () (incf x))))
+ :expected-equalp '(1 2 3))
+
+ (assertoid (map-into (make-array 0 :element-type 'fixnum)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #())
+ (assertoid (map-into (make-array 1 :element-type 'fixnum :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31))
+ (assertoid (map-into (make-array 2 :element-type 'fixnum :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22))
+ (assertoid (map-into (make-array 3 :element-type 'fixnum :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22 99))
+
+ (assertoid (map-into (make-array 0 :fill-pointer 0 :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #())
+ (assertoid (map-into (make-array 1 :fill-pointer 0 :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31))
+ (assertoid (map-into (make-array 2 :fill-pointer 0 :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22))
+ (assertoid (map-into (make-array 3 :fill-pointer 0 :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22))
+
+ (assertoid (map-into (make-array 9 :fill-pointer 9 :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22))
+ (assertoid (map-into (make-array 9 :fill-pointer 5 :initial-element 99)
+ #'+ '(1 2 3) '(30 20))
+ :expected-equalp #(31 22)))