changeset 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 0aa8ce9f30e2
children 6fd97b5ed3e5
files test/LazyTensors/lazy_array_test.jl
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/LazyTensors/lazy_array_test.jl	Wed Oct 12 10:44:44 2022 +0200
+++ b/test/LazyTensors/lazy_array_test.jl	Wed Oct 19 23:10:58 2022 +0200
@@ -102,4 +102,7 @@
     @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[4,2]
     @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[2,3]
 
+    # Test that the constructor works with a restrictive function
+    f(x::Vararg{Int}) = sum(x)
+    @test LazyFunctionArray(f,(3,4)) isa LazyFunctionArray
 end