Skip to content

Commit 6ad4fb8

Browse files
authored
Improve test for FixedSizeMatrix (#9)
The previous tests were flattening the matrix before setting/accessing the elements, thus not really exercising the 2D indexing of the new data type.
1 parent 8177052 commit 6ad4fb8

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

test/runtests.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@ using Test
22
using FixedSizeArrays
33

44
@testset "FixedSizeArrays" begin
5-
v = FixedSizeVector{Float64}(undef, 3)
6-
@test length(v) == 3
7-
v .= 1:3
8-
@test v == 1:3
95

10-
m = FixedSizeMatrix{Float64}(undef, 3, 3)
11-
@test length(m) == 9
12-
m[:] .= 1:9
13-
@test m[:] == 1:9
6+
@testset "FixedSizeVector" begin
7+
v = FixedSizeVector{Float64}(undef, 3)
8+
@test length(v) == 3
9+
v .= 1:3
10+
@test v == 1:3
11+
end
12+
13+
@testset "FixedSizeMatrix" begin
14+
m = FixedSizeMatrix{Float64}(undef, 3, 3)
15+
m_ref = reshape(1:9, size(m))
16+
@test length(m) == 9
17+
m .= m_ref
18+
@test m == m_ref
19+
end
1420
end

0 commit comments

Comments
 (0)