diff test/testLazyTensors.jl @ 489:1a7d6da3cc45

Merge feature/compose_identity_mappings
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 05 Nov 2020 11:32:49 +0100
parents 8082d43103c1
children cd509e57f898 df566372bb4f
line wrap: on
line diff
--- a/test/testLazyTensors.jl	Mon Nov 02 21:33:35 2020 +0100
+++ b/test/testLazyTensors.jl	Thu Nov 05 11:32:49 2020 +0100
@@ -177,6 +177,7 @@
     @test_throws BoundsError (v1 +̃  v2)[4]
     v2 = [1., 2, 3, 4]
     # Test that size of arrays is asserted when not specified inbounds
+    # TODO: Replace these errors with SizeMismatch
     @test_throws DimensionMismatch v1 +̃ v2
 
     # Test operations on LazyArray
@@ -193,6 +194,7 @@
     @test_throws BoundsError (v1 + v2)[4]
     v2 = [1., 2, 3, 4]
     # Test that size of arrays is asserted when not specified inbounds
+    # TODO: Replace these errors with SizeMismatch
     @test_throws DimensionMismatch v1 + v2
 end
 
@@ -226,7 +228,7 @@
     @test Ã∘B̃ isa TensorMappingComposition
     @test range_size(Ã∘B̃) == (2,)
     @test domain_size(Ã∘B̃) == (4,)
-    @test_throws DimensionMismatch B̃∘Ã
+    @test_throws SizeMismatch B̃∘Ã
 
     # @test @inbounds B̃∘Ã # Should not error even though dimensions don't match. (Since ]test runs with forced boundschecking this is currently not testable 2020-10-16)
 
@@ -312,6 +314,17 @@
 
     @inferred range_dim(I)
     @inferred domain_dim(I)
+
+    Ã = rand(4,2)
+    A = LazyLinearMap(Ã,(1,),(2,))
+    I1 = IdentityMapping{Float64}(2)
+    I2 = IdentityMapping{Float64}(4)
+    @test A∘I1 == A
+    @test I2∘A == A
+    @test I1∘I1 == I1
+    @test_throws SizeMismatch I1∘A
+    @test_throws SizeMismatch A∘I2
+    @test_throws SizeMismatch I1∘I2
 end
 
 @testset "InflatedTensorMapping" begin