Skip to content

TST: improve coverage of array.jl #10261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1059,3 +1059,38 @@ end
# PR #10164
@test eltype(Array{Int}) == Int
@test eltype(Array{Int,1}) == Int


# fill some coverage gaps in array.jl
# function complex{T<:Real}(A::Real, B::Array{T})
@test complex(0, [0, 0, 0]) == [0+0im, 0+0im, 0+0im]
@test complex(0, [0.0, 0.0, 0.0]) == [0.0+0.0im, 0.0+0.0im, 0.0+0.0im]

# function complex{T<:Real}(A::Array{T<:Real,N},B::Real)
@test complex([0, 0, 0], 0) == [0+0im, 0+0im, 0+0im]
@test complex([0.0, 0.0, 0.0], 0) == [0.0+0.0im, 0.0+0.0im, 0.0+0.0im]

@test find(1) == [1]
@test find(1.0) == [1.0]
@test find(0) == []

@test find(isfinite,1) == [1]
@test find(isfinite,Inf) == []

#findn() retrieves the inputs used to create the sparse matrix.
@test findn([]) == []
@test findn([1,0,1,0]) == [1,3]

@test findn([0 0; 0 0]) == ([],[])
@test findn([0 1; 0 0]) == ([1],[2])
@test findn([0 0 1; 1 0 0]) == ([2,1],[1,3])
@test findn([0 1.0; 0 0]) == ([1],[2])
@test findn([1 1 0 1]) == ( [1,1,1], [1,2,4] )

@test transpose!([0,0,0], [1 0 1]) == [1,0,1]
@test transpose!([0 0 0], [1,0,1]) == [1 0 1]