Skip to content

Commit

Permalink
Add tests for map!
Browse files Browse the repository at this point in the history
  • Loading branch information
simonster committed Jun 15, 2014
1 parent eddd594 commit 661e219
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ rt = Base.return_types(broadcast!, (Function, DataArray{Float64, 3}, Array{Float
@test isequal(broadcast(isequal, @pdata([NA, 1]), @pdata([NA 1])), @pdata([true false; false true]))
@test isequal(broadcast(&, @data([NA, false]), @data([NA true false])), @data([NA NA false; false false false]))
@test isequal(broadcast(|, @data([NA, false]), @data([NA true false])), @data([NA true NA; NA true false]))

# Test map!
@test_throws ErrorException map!(+, DataArray(Float64, 2, 2), @data([1, 2]), @data([1 2]))
@test map!(+, DataArray(Float64, 2), @data([1, 2]), @data([1, 2])) == @data([2, 4])
@test isequal(map!(+, DataArray(Float64, 3), @data([1, NA, 3]), @data([NA, 2, 3])), @data([NA, NA, 6]))
@test map!(isequal, DataArray(Float64, 3), @data([1, NA, NA]), @data([1, NA, 3])) == @data([true, true, false])
end

0 comments on commit 661e219

Please sign in to comment.