Skip to content

Commit

Permalink
Add simple test for SearchStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolaru committed Jul 12, 2018
1 parent 4c076eb commit 5fccaac
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/roots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ end
@test length(state.working) != length(state_copy.working)

# cover optional iterator methods
@test eltype(search) != Any
@test eltype(search) == typeof(state)
@test_nowarn iteratorsize(search)
end

@testset "Search strategy" begin
X = -5..5
rts = roots(sin, cos, X, Newton, DepthFirstSearch)
@test Set(rts) == Set(roots(sin, cos, X, Newton, BreadthFirstSearch))

strat = SearchStrategy{Vector}(unshift!, shift!)
@test roots(sin, cos, X, Newton, strat) == rts
end

0 comments on commit 5fccaac

Please sign in to comment.