File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -426,8 +426,11 @@ function all(f::Function, IM::Eye{T}) where T
426
426
end
427
427
428
428
# In particular, these make iszero(Eye(n)) efficient.
429
- any (f:: Function , x:: AbstractFill ) = f (getindex_value (x))
430
- all (f:: Function , x:: AbstractFill ) = f (getindex_value (x))
429
+ # use any/all on scalar to get Boolean error message
430
+ any (f:: Function , x:: AbstractFill ) = any (f, getindex_value (x))
431
+ all (f:: Function , x:: AbstractFill ) = all (f, getindex_value (x))
432
+ any (x:: AbstractFill ) = any (getindex_value (x))
433
+ all (x:: AbstractFill ) = all (getindex_value (x))
431
434
432
435
include (" fillalgebra.jl" )
433
436
include (" fillbroadcast.jl" )
Original file line number Diff line number Diff line change 650
650
@test ! iszero (m4)
651
651
end
652
652
end
653
+
654
+ @testset " all/any" begin
655
+ @test any (Ones {Bool} (10 )) === all (Ones {Bool} (10 )) === any (Fill (true ,10 )) === all (Fill (true ,10 )) === true
656
+ @test any (Zeros {Bool} (10 )) === all (Zeros {Bool} (10 )) === any (Fill (false ,10 )) === all (Fill (false ,10 )) === false
657
+ end
658
+
659
+ @testset " Error" begin
660
+ @test_throws TypeError any (exp, Fill (1 ,5 ))
661
+ @test_throws TypeError all (exp, Fill (1 ,5 ))
662
+ @test_throws TypeError any (Fill (1 ,5 ))
663
+ @test_throws TypeError all (Fill (1 ,5 ))
664
+ @test_throws TypeError any (Zeros (5 ))
665
+ @test_throws TypeError all (Zeros (5 ))
666
+ @test_throws TypeError any (Ones (5 ))
667
+ @test_throws TypeError all (Ones (5 ))
668
+ end
653
669
end
654
670
655
671
@testset " Eye identity ops" begin
You can’t perform that action at this time.
0 commit comments