@@ -2,31 +2,31 @@ using RecursiveArrayTools, StaticArrays
2
2
using Test
3
3
4
4
t = 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)
7
7
@test typeof (data) <: Matrix{Float64}
8
8
9
9
# # 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 ]]
11
11
@test recursive_mean (A) ≈ [2.33333333 3.666666666
12
- 4.6666666666 6.0 ]
12
+ 4.6666666666 6.0 ]
13
13
14
- A = zeros (5 ,5 )
14
+ A = zeros (5 , 5 )
15
15
@test recursive_unitless_eltype (A) == Float64
16
16
17
17
using Unitful
18
- A = zeros (5 ,5 ) * 1 u " kg"
18
+ A = zeros (5 , 5 ) * 1 u " kg"
19
19
@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 ]
21
21
@test recursive_unitless_eltype (AA) == Array{Float64,2 }
22
22
AofA = [copy (A) for i in 1 : 5 ]
23
23
@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 ]
25
25
@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 ]
27
27
@test recursive_unitless_eltype (AofuSA) == SVector{2 ,Float64}
28
28
29
- A = [ArrayPartition (ones (1 ),ones (1 )),]
29
+ A = [ArrayPartition (ones (1 ), ones (1 )),]
30
30
31
31
function test_recursive_bottom_eltype ()
32
32
function test_value (val:: Any , expected_type:: Type )
@@ -70,3 +70,22 @@ test_recursive_bottom_eltype()
70
70
using RecursiveArrayTools: issymbollike
71
71
@test ! issymbollike (1 )
72
72
@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