diff 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
line wrap: on
line diff
--- a/test/LazyTensors/lazy_array_test.jl	Wed Oct 05 22:00:30 2022 +0200
+++ b/test/LazyTensors/lazy_array_test.jl	Wed Oct 05 22:00:44 2022 +0200
@@ -67,11 +67,18 @@
     @test isa(v1 + v2, LazyArray)
     @test isa(v2 + v1, LazyArray)
     @test isa(v1 - v2, LazyArray)
-    @test isa(v2 - v1, LazyArray)
+    @test isa(v2 - v1, LazyArray)    
+    @test isa(v1 + s, LazyArray)
+    @test isa(s + v1, LazyArray)
+    @test isa(v1 - s, LazyArray)
+    @test isa(s - v1, LazyArray)
     for i ∈ eachindex(v2)
         @test (v1 + v2)[i] == (v2 + v1)[i] == r_add_v[i]
         @test (v1 - v2)[i] == -(v2 - v1)[i] == r_sub_v[i]
+        @test (v1 + s)[i] == (s + v1)[i] == r_add_s[i]
+        @test (v1 - s)[i] == -(s - v1)[i] == r_sub_s[i]
     end
+    
     @test_throws BoundsError (v1 + v2)[4]
     v2 = [1., 2, 3, 4]
     @test_throws DimensionMismatch v1 + v2