Mercurial > repos > public > sbplib_julia
diff LazyTensors/test/runtests.jl @ 201:6b7019f2cd41 boundary_conditions
Add/fix test checking that no size assertion is performed when lazy operations and operations on lazy arrays are decorated using @inbounds
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Sun, 23 Jun 2019 21:27:03 +0200 |
parents | c19bfad0e836 |
children | 19e579a5031f |
line wrap: on
line diff
--- a/LazyTensors/test/runtests.jl Sun Jun 23 20:44:09 2019 +0200 +++ b/LazyTensors/test/runtests.jl Sun Jun 23 21:27:03 2019 +0200 @@ -82,9 +82,16 @@ @test (v1 /̃ v2)[i] == r_div[i] end @test_throws BoundsError (v1 +̃ v2)[4] + v2 = [1., 2, 3, 4] + # Test that size of arrays is asserted when not specified inbounds + @test_throws AssertionError v1 +̃ v2 + # Test that no error checking is performed when specified inbounds + res = (v1,v2) -> (@inbounds (v1 +̃ v2)[1] == 2) + @test res(v1,v2) # Test operations on LazyArray v1 = DummyArray([1, 2.3, 4]) + v2 = [1., 2, 3] @test isa(v1 + v2, LazyArray) @test isa(v2 + v1, LazyArray) @test isa(v1 - v2, LazyArray) @@ -104,5 +111,6 @@ # Test that size of arrays is asserted when not specified inbounds @test_throws AssertionError v1 + v2 # Test that no error checking is performed when specified inbounds - @test_broken @inbounds((v1 + v2)[1] == 2) + res = (v1,v2) -> (@inbounds (v1 + v2)[1] == 2) + @test res(v1,v2) end