Skip to content

Commit f2f6fac

Browse files
kshyattandyferris
authored andcommitted
Add tests for zero-dimensional linalg (#216)
1 parent 2cd5133 commit f2f6fac

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/linalg.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
@testset "cross()" begin
7373
@test @inferred(cross(SVector(1,2,3), SVector(4,5,6))) === SVector(-3, 6, -3)
7474
@test @inferred(cross(SVector(1,2), SVector(4,5))) === -3
75+
@test @inferred(cross(SVector(UInt(1),UInt(2)), SVector(UInt(4),UInt(5)))) === -3
7576

7677
end
7778

@@ -131,4 +132,11 @@
131132
@test trace(@SMatrix [1.0 2.0; 3.0 4.0]) === 5.0
132133
@test_throws DimensionMismatch trace(@SMatrix rand(5,4))
133134
end
135+
136+
@testset "size zero" begin
137+
@test vecdot(SVector{0, Float64}(()), SVector{0, Float64}(())) === 0.
138+
@test vecnorm(SVector{0, Float64}(())) === 0.
139+
@test vecnorm(SVector{0, Float64}(()), 1) === 0.
140+
@test trace(SMatrix{0,0,Float64}(())) === 0.
141+
end
134142
end

0 commit comments

Comments
 (0)