@@ -909,6 +909,26 @@ generic_map_tests(map, map!)
909
909
# @test_throws BoundsError map!(+, ones(3), ones(2, 2), ones(2, 2))
910
910
end
911
911
912
+ @testset " #30624" begin
913
+ # ## unstructured
914
+ @test map! (+ , ones (3 ), ones (3 ), ones (3 ), [1 ]) == [3 , 1 , 1 ]
915
+ @test map! (+ , ones (3 ), [1 ], ones (3 ), ones (3 )) == [3 , 1 , 1 ]
916
+ @test map! (+ , [1 ], [1 ], [], []) == [1 ]
917
+ @test map! (+ , [[1 ]], [1 ], [], []) == [[1 ]]
918
+
919
+ # TODO : decide if input axes & lengths should be validated
920
+ # @test_throws BoundsError map!(+, ones(1), ones(2))
921
+ # @test_throws BoundsError map!(+, ones(1), ones(2, 2))
922
+
923
+ @test map! (+ , ones (3 ), view (ones (2 , 3 ), 1 : 2 , 2 : 3 ), ones (3 )) == [2 , 2 , 2 ]
924
+ @test map! (+ , ones (3 ), ones (2 , 2 ), ones (3 )) == [2 , 2 , 2 ]
925
+
926
+ # ## structured (all mapped arguments are <:AbstractArray equal ndims > 1)
927
+ @test map! (+ , ones (4 ), ones (2 , 2 ), ones (2 , 2 )) == [2 , 2 , 2 , 2 ]
928
+ @test map! (+ , ones (4 ), ones (2 , 2 ), ones (1 , 2 )) == [2 , 2 , 1 , 1 ]
929
+ # @test_throws BoundsError map!(+, ones(3), ones(2, 2), ones(2, 2))
930
+ end
931
+
912
932
test_UInt_indexing (TestAbstractArray)
913
933
test_13315 (TestAbstractArray)
914
934
test_checksquare ()
0 commit comments