Skip to content

Commit

Permalink
Merge pull request #18 from invenia/npr/more-tests
Browse files Browse the repository at this point in the history
Add some more tests
  • Loading branch information
nickrobinson251 authored Jul 29, 2019
2 parents a1887ef + 7b98b12 commit cd84d72
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
julia = "1"

[extras]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Random", "Test"]
test = ["Documenter", "Random", "Test"]
7 changes: 7 additions & 0 deletions test/base_maths.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ using Test
@test_throws DimensionMismatch b3 * b1
end

@testset "BlockDiagonal * Number" begin
@test b1 * 2 Matrix(b1) * 2 2 * b1
@test b1 / 2 Matrix(b1) / 2
@test b1 * complex(2, 1) Matrix(b1) * complex(2, 1) complex(2, 1) * b1
@test b1 / complex(2, 1) Matrix(b1) / complex(2, 1)
end

@testset "BlockDiagonal * Vector" begin
@test b1 * a isa Vector
@test b1 * a Matrix(b1) * a
Expand Down
2 changes: 1 addition & 1 deletion test/blockdiagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ using Test
B = BlockDiagonal([rand(3, 3), rand(4, 4)])
@test nblocks(B) == 2
@test blocksizes(B) == [(3, 3), (4, 4)]
@test blocksize(B, 2) == blocksizes(B)[2]
@test blocksize(B, 2) == blocksizes(B)[2] == blocksize(B, 2, 2)
end

@testset "Equality" begin
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using BlockDiagonals
using Documenter
using Test

@testset "BlockDiagonals" begin
doctest(BlockDiagonals)
include("blockdiagonal.jl")
include("base_maths.jl")
include("linalg.jl")
Expand Down

0 comments on commit cd84d72

Please sign in to comment.