Skip to content

Commit

Permalink
add tests for Diagonal constructor (#23016)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored Jul 31, 2017
1 parent 1a43098 commit 80667ea
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/linalg/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ srand(1)
end
D = Diagonal(d)
DM = diagm(d)

@testset "constructor" begin
for x in (d, GenericArray(d))
@test Diagonal(x)::Diagonal{elty,typeof(x)} == DM
@test Diagonal(x).diag === x
@test Diagonal{elty}(x)::Diagonal{elty,typeof(x)} == DM
@test Diagonal{elty}(x).diag === x
end
end

@testset "Basic properties" begin
@test eye(Diagonal{elty},n) == Diagonal(ones(elty,n))
@test_throws ArgumentError size(D,0)
Expand Down

0 comments on commit 80667ea

Please sign in to comment.