|
13 | 13 | @testset "Binary IO" begin
|
14 | 14 | @testset "read!" begin
|
15 | 15 | # Read static arrays from a stream which was serialized elementwise
|
16 |
| - @test read!(write_buf(UInt8, 1,2,3), SVector{3,UInt8}) === SVector{3,UInt8}(1,2,3) |
17 |
| - @test read!(write_buf(Int32, -1,2,3), SVector{3,Int32}) === SVector{3,Int32}(-1,2,3) |
18 |
| - @test read!(write_buf(Float64, 1,2,3), SVector{3,Float64}) === SVector{3,Float64}(1,2,3) |
19 |
| - @test read!(write_buf(Float64, 1,2,3,4), SMatrix{2,2,Float64}) === @SMatrix [1.0 3.0; 2.0 4.0] |
| 16 | + @test read(write_buf(UInt8, 1,2,3), SVector{3,UInt8}) === SVector{3,UInt8}(1,2,3) |
| 17 | + @test read(write_buf(Int32, -1,2,3), SVector{3,Int32}) === SVector{3,Int32}(-1,2,3) |
| 18 | + @test read(write_buf(Float64, 1,2,3), SVector{3,Float64}) === SVector{3,Float64}(1,2,3) |
| 19 | + @test read(write_buf(Float64, 1,2,3,4), SMatrix{2,2,Float64}) === @SMatrix [1.0 3.0; 2.0 4.0] |
20 | 20 | end
|
21 | 21 |
|
22 | 22 | @testset "write" begin
|
|
33 | 33 | @test read!(write_buf(Int32, -1,2,3), zeros(MVector{3,Int32})) == MVector{3,Int32}(-1,2,3)
|
34 | 34 | @test read!(write_buf(Float64, 1,2,3), zeros(MVector{3,Float64})) == MVector{3,Float64}(1,2,3)
|
35 | 35 | @test read!(write_buf(Float64, 1,2,3,4), zeros(MMatrix{2,2,Float64})) == @MMatrix [1.0 3.0; 2.0 4.0]
|
| 36 | + # Test that read! does, in fact, modify an MVector rather than return a copy. |
| 37 | + m = zeros(MVector{3,UInt8}) |
| 38 | + read!(write_buf(UInt8, 1,2,3), m) |
| 39 | + @test m == MVector{3,UInt8}(1,2,3) |
36 | 40 | end
|
37 | 41 | end
|
38 | 42 |
|
0 commit comments