Skip to content

Commit ddd2fb6

Browse files
committed
Fix and consolidate tests for MVector / MMatrix into MArray
There's not a lot of point testing MVector/MMatrix separately, as they're now the same struct (since Julia 0.6 or so)
1 parent 4614a00 commit ddd2fb6

File tree

3 files changed

+12
-39
lines changed

3 files changed

+12
-39
lines changed

test/MArray.jl

+12
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@
137137
m[4] = 14
138138
@test m.data === (11, 12, 13, 14)
139139

140+
m = @MMatrix [0 0; 0 0]
141+
m[1] = Int8(11)
142+
m[2] = Int8(12)
143+
m[3] = Int8(13)
144+
m[4] = Int8(14)
145+
@test m.data === (11, 12, 13, 14)
146+
147+
v = @MVector [1.,2.,3.]
148+
v[1] = Float16(11)
149+
@test v.data === (11., 2., 3.)
150+
151+
v = @MArray [1,2,3]
140152
@test_throws BoundsError setindex!(v, 4, -1)
141153
mm = @MArray zeros(3,3,3,3)
142154
@test_throws BoundsError setindex!(mm, 4, -1)

test/MMatrix.jl

-20
Original file line numberDiff line numberDiff line change
@@ -89,24 +89,4 @@
8989

9090
@test length(m) === 4
9191
end
92-
93-
@testset "setindex!" begin
94-
m = @MMatrix [0 0; 0 0]
95-
m[1] = 11
96-
m[2] = 12
97-
m[3] = 13
98-
m[4] = 14
99-
@test m.data === (11, 12, 13, 14)
100-
101-
m = @MMatrix [0 0; 0 0]
102-
m[1] = Int8(11)
103-
m[2] = Int8(12)
104-
m[3] = Int8(13)
105-
m[4] = Int8(14)
106-
@test m.data === (11, 12, 13, 14)
107-
108-
# setindex with non-elbits type
109-
m = MMatrix{2,2,String}(undef)
110-
@test_throws ErrorException setindex!(m, "a", 1, 1)
111-
end
11292
end

test/MVector.jl

-19
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,4 @@
6969

7070
@test length(v) === 3
7171
end
72-
73-
@testset "setindex!" begin
74-
v = @MVector [1,2,3]
75-
v[1] = 11
76-
v[2] = 12
77-
v[3] = 13
78-
@test v.data === (11, 12, 13)
79-
80-
v = @MVector [1.,2.,3.]
81-
v[1] = Float16(11)
82-
@test v.data === (11., 2., 3.)
83-
84-
@test_throws BoundsError setindex!(v, 4., -1)
85-
@test_throws BoundsError setindex!(v, 4., 4)
86-
87-
# setindex with non-elbits type
88-
v = MVector{2,String}(undef)
89-
@test_throws ErrorException setindex!(v, "a", 1)
90-
end
9172
end

0 commit comments

Comments
 (0)