@@ -2,31 +2,31 @@ using RecursiveArrayTools, StaticArrays
22using Test
33
44t = collect (range (0 , stop= 10 , length= 200 ))
5- randomized = VectorOfArray ([.01 randn (2 ) for i in 1 : 10 ])
6- data = convert (Array,randomized)
5+ randomized = VectorOfArray ([0 .01randn (2 ) for i in 1 : 10 ])
6+ data = convert (Array, randomized)
77@test typeof (data) <: Matrix{Float64}
88
99# # Test means
10- A = [[1 2 ; 3 4 ],[1 3 ;4 6 ],[5 6 ;7 8 ]]
10+ A = [[1 2 ; 3 4 ], [1 3 ; 4 6 ], [5 6 ; 7 8 ]]
1111@test recursive_mean (A) ≈ [2.33333333 3.666666666
12- 4.6666666666 6.0 ]
12+ 4.6666666666 6.0 ]
1313
14- A = zeros (5 ,5 )
14+ A = zeros (5 , 5 )
1515@test recursive_unitless_eltype (A) == Float64
1616
1717using Unitful
18- A = zeros (5 ,5 ) * 1 u " kg"
18+ A = zeros (5 , 5 ) * 1 u " kg"
1919@test recursive_unitless_eltype (A) == Float64
20- AA = [zeros (5 ,5 ) for i in 1 : 5 ]
20+ AA = [zeros (5 , 5 ) for i in 1 : 5 ]
2121@test recursive_unitless_eltype (AA) == Array{Float64,2 }
2222AofA = [copy (A) for i in 1 : 5 ]
2323@test recursive_unitless_eltype (AofA) == Array{Float64,2 }
24- AofSA = [@SVector [2.0 ,3.0 ] for i in 1 : 5 ]
24+ AofSA = [@SVector [2.0 , 3.0 ] for i in 1 : 5 ]
2525@test recursive_unitless_eltype (AofSA) == SVector{2 ,Float64}
26- AofuSA = [@SVector [2.0 u " kg" ,3.0 u " kg" ] for i in 1 : 5 ]
26+ AofuSA = [@SVector [2.0 u " kg" , 3.0 u " kg" ] for i in 1 : 5 ]
2727@test recursive_unitless_eltype (AofuSA) == SVector{2 ,Float64}
2828
29- A = [ArrayPartition (ones (1 ),ones (1 )),]
29+ A = [ArrayPartition (ones (1 ), ones (1 )),]
3030
3131function test_recursive_bottom_eltype ()
3232 function test_value (val:: Any , expected_type:: Type )
@@ -70,3 +70,22 @@ test_recursive_bottom_eltype()
7070using RecursiveArrayTools: issymbollike
7171@test ! issymbollike (1 )
7272@test issymbollike (:a )
73+
74+ x = zeros (10 )
75+ recursivefill! (x, 1.0 )
76+ @test x == ones (10 )
77+
78+ x = [zeros (10 ), zeros (10 )]
79+ recursivefill! (x, 1.0 )
80+ @test x[1 ] == ones (10 )
81+ @test x[2 ] == ones (10 )
82+
83+ x = [SVector {10} (zeros (10 )), SVector {10} (zeros (10 ))]
84+ recursivefill! (x, SVector {10} (ones (10 )))
85+ @test x[1 ] == SVector {10} (ones (10 ))
86+ @test x[2 ] == SVector {10} (ones (10 ))
87+
88+ x = [MVector {10} (zeros (10 )), MVector {10} (zeros (10 ))]
89+ recursivefill! (x, 1.0 )
90+ @test x[1 ] == MVector {10} (ones (10 ))
91+ @test x[2 ] == MVector {10} (ones (10 ))
0 commit comments