Mercurial > repos > public > sbplib_julia
comparison test/LazyTensors/lazy_array_test.jl @ 1129:2d231546c091 feature/grids
Merge with default
| author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
|---|---|
| date | Wed, 05 Oct 2022 22:00:44 +0200 |
| parents | 6104db60b7a3 |
| children | 805fa2ba837f |
comparison
equal
deleted
inserted
replaced
| 1128:dfbd62c7eb09 | 1129:2d231546c091 |
|---|---|
| 65 v1 = DummyArray([1, 2.3, 4]) | 65 v1 = DummyArray([1, 2.3, 4]) |
| 66 v2 = [1., 2, 3] | 66 v2 = [1., 2, 3] |
| 67 @test isa(v1 + v2, LazyArray) | 67 @test isa(v1 + v2, LazyArray) |
| 68 @test isa(v2 + v1, LazyArray) | 68 @test isa(v2 + v1, LazyArray) |
| 69 @test isa(v1 - v2, LazyArray) | 69 @test isa(v1 - v2, LazyArray) |
| 70 @test isa(v2 - v1, LazyArray) | 70 @test isa(v2 - v1, LazyArray) |
| 71 @test isa(v1 + s, LazyArray) | |
| 72 @test isa(s + v1, LazyArray) | |
| 73 @test isa(v1 - s, LazyArray) | |
| 74 @test isa(s - v1, LazyArray) | |
| 71 for i ∈ eachindex(v2) | 75 for i ∈ eachindex(v2) |
| 72 @test (v1 + v2)[i] == (v2 + v1)[i] == r_add_v[i] | 76 @test (v1 + v2)[i] == (v2 + v1)[i] == r_add_v[i] |
| 73 @test (v1 - v2)[i] == -(v2 - v1)[i] == r_sub_v[i] | 77 @test (v1 - v2)[i] == -(v2 - v1)[i] == r_sub_v[i] |
| 78 @test (v1 + s)[i] == (s + v1)[i] == r_add_s[i] | |
| 79 @test (v1 - s)[i] == -(s - v1)[i] == r_sub_s[i] | |
| 74 end | 80 end |
| 81 | |
| 75 @test_throws BoundsError (v1 + v2)[4] | 82 @test_throws BoundsError (v1 + v2)[4] |
| 76 v2 = [1., 2, 3, 4] | 83 v2 = [1., 2, 3, 4] |
| 77 @test_throws DimensionMismatch v1 + v2 | 84 @test_throws DimensionMismatch v1 + v2 |
| 78 end | 85 end |
| 79 | 86 |
