comparison test/LazyTensors/lazy_array_test.jl @ 1141:805fa2ba837f bugfix/lazy_tensors/lazyfunctionarray

Add test for a bug in the constructor of LazyFunctionArray The constructor throws an error if the function provided is restricted to only work for Ints
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 19 Oct 2022 23:10:58 +0200
parents 6104db60b7a3
children 471a948cd2b2
comparison
equal deleted inserted replaced
1140:0aa8ce9f30e2 1141:805fa2ba837f
100 100
101 @test_throws BoundsError LazyFunctionArray(i->i^2, (3,))[4] 101 @test_throws BoundsError LazyFunctionArray(i->i^2, (3,))[4]
102 @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[4,2] 102 @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[4,2]
103 @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[2,3] 103 @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[2,3]
104 104
105 # Test that the constructor works with a restrictive function
106 f(x::Vararg{Int}) = sum(x)
107 @test LazyFunctionArray(f,(3,4)) isa LazyFunctionArray
105 end 108 end