Skip to content

Commit

Permalink
Add tests for zero-dimensional linalg
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Jun 3, 2017
1 parent 6c45051 commit 10b872c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
@testset "cross()" begin
@test @inferred(cross(SVector(1,2,3), SVector(4,5,6))) === SVector(-3, 6, -3)
@test @inferred(cross(SVector(1,2), SVector(4,5))) === -3
@test @inferred(cross(SVector(UInt(1),UInt(2)), SVector(UInt(4),UInt(5)))) === -3

end

Expand Down Expand Up @@ -131,4 +132,11 @@
@test trace(@SMatrix [1.0 2.0; 3.0 4.0]) === 5.0
@test_throws DimensionMismatch trace(@SMatrix rand(5,4))
end

@testset "size zero" begin
@test vecdot(SVector{0, Float64}(()), SVector{0, Float64}(())) === 0.
@test vecnorm(SVector{0, Float64}(())) === 0.
@test vecnorm(SVector{0, Float64}(()), 1) === 0.
@test trace(SMatrix{0,0,Float64}(())) === 0.
end
end

0 comments on commit 10b872c

Please sign in to comment.