Skip to content

Commit

Permalink
Merge pull request #18969 from fcard/fix-non-boolean-indent
Browse files Browse the repository at this point in the history
Add tests for more permissive any/all with non-boolean collections
  • Loading branch information
kshyatt authored Dec 18, 2016
2 parents ded2259 + be4cedb commit 08fcc0f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,23 @@ let c = Int[], d = Int[], A = 1:9
@test d == collect(1:5)
end

# any/all with non-boolean collections

let f(x) = x == 1 ? true : x == 2 ? false : 1
@test any(Any[false,true,false])
@test any(map(f, [2,1,2]))
@test any([f(x) for x in [2,1,2]])

@test all(Any[true,true,true])
@test all(map(f, [1,1,1]))
@test all([f(x) for x in [1,1,1]])

@test_throws TypeError any([1,true])
@test_throws TypeError all([true,1])
@test_throws TypeError any(map(f,[3,1]))
@test_throws TypeError all(map(f,[1,3]))
end

# any and all with functors

immutable SomeFunctor end
Expand Down

2 comments on commit 08fcc0f

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.