Skip to content

Commit 423e9ff

Browse files
authored
Merge pull request #172 from kshyatt/ksh/test6
setindex tests
2 parents 5a76562 + 6201bae commit 423e9ff

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/MMatrix.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
@test ((@MMatrix eye(Float32, 2, 2))::MMatrix{2, 2, Float32}).data === (1.0f0, 0.0f0, 0.0f0, 1.0f0)
5555
@test isa(@MMatrix(rand(Float32, 2, 2)), MMatrix{2, 2, Float32})
5656
@test isa(@MMatrix(randn(Float32, 2, 2)), MMatrix{2, 2, Float32})
57+
58+
@test MMatrix(SMatrix{1,1,Int,1}((1,))).data == (1,)
5759
end
5860

5961
@testset "Methods" begin
@@ -87,5 +89,12 @@
8789
m[3] = 13
8890
m[4] = 14
8991
@test m.data === (11, 12, 13, 14)
92+
93+
m = @MMatrix [0 0; 0 0]
94+
m[1] = Int8(11)
95+
m[2] = Int8(12)
96+
m[3] = Int8(13)
97+
m[4] = Int8(14)
98+
@test m.data === (11, 12, 13, 14)
9099
end
91100
end

test/MVector.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,12 @@
6262
v[2] = 12
6363
v[3] = 13
6464
@test v.data === (11, 12, 13)
65+
66+
v = @MVector [1.,2.,3.]
67+
v[1] = Float16(11)
68+
@test v.data === (11., 2., 3.)
69+
70+
@test_throws BoundsError setindex!(v, 4., -1)
71+
@test_throws BoundsError setindex!(v, 4., 4)
6572
end
6673
end

0 commit comments

Comments
 (0)