comparison LazyTensors/test/runtests.jl @ 206:7b0650021b36 boundary_conditions

Remove implementations of elementwise operation for * and /
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 24 Jun 2019 14:57:17 +0200
parents 70e1f3401d82
children f85a0b38f3ff
comparison
equal deleted inserted replaced
205:70e1f3401d82 206:7b0650021b36
94 v2 = [1., 2, 3] 94 v2 = [1., 2, 3]
95 @test isa(v1 + v2, LazyArray) 95 @test isa(v1 + v2, LazyArray)
96 @test isa(v2 + v1, LazyArray) 96 @test isa(v2 + v1, LazyArray)
97 @test isa(v1 - v2, LazyArray) 97 @test isa(v1 - v2, LazyArray)
98 @test isa(v2 - v1, LazyArray) 98 @test isa(v2 - v1, LazyArray)
99 @test isa(v1 * v2, LazyArray)
100 @test isa(v2 * v1, LazyArray)
101 @test isa(v1 / v2, LazyArray)
102 @test isa(v2 / v1, LazyArray)
103 for i ∈ eachindex(v2) 99 for i ∈ eachindex(v2)
104 @test (v1 + v2)[i] == (v2 + v1)[i] == r_add[i] 100 @test (v1 + v2)[i] == (v2 + v1)[i] == r_add[i]
105 @test (v1 - v2)[i] == -(v2 - v1)[i] == r_sub[i] 101 @test (v1 - v2)[i] == -(v2 - v1)[i] == r_sub[i]
106 @test (v1 * v2)[i] == (v2 * v1)[i] == r_times[i]
107 @test (v1 / v2)[i] == 1/((v2 / v1)[i]) == r_div[i]
108 end 102 end
109 @test_throws BoundsError (v1 + v2)[4] 103 @test_throws BoundsError (v1 + v2)[4]
110 v2 = [1., 2, 3, 4] 104 v2 = [1., 2, 3, 4]
111 # Test that size of arrays is asserted when not specified inbounds 105 # Test that size of arrays is asserted when not specified inbounds
112 @test_throws AssertionError v1 + v2 106 @test_throws AssertionError v1 + v2