diff --git a/src/StaticArrays.jl b/src/StaticArrays.jl index 07c47438..25a50bc0 100644 --- a/src/StaticArrays.jl +++ b/src/StaticArrays.jl @@ -105,6 +105,7 @@ include("FieldArray.jl") include("SArray.jl") include("SMatrix.jl") include("SVector.jl") +include("vectorModules.jl") include("Scalar.jl") include("MArray.jl") include("MVector.jl") diff --git a/src/vectorModules.jl b/src/vectorModules.jl new file mode 100644 index 00000000..757f79e1 --- /dev/null +++ b/src/vectorModules.jl @@ -0,0 +1,10 @@ +module Float64Vectors + +using StaticArrays + +export Vector2D, Vector3D + +const Vector3D = SVector{3, Float64} +const Vector2D = SVector{2, Float64} + +end \ No newline at end of file diff --git a/test/SVector.jl b/test/SVector.jl index ee231142..0132c194 100644 --- a/test/SVector.jl +++ b/test/SVector.jl @@ -79,4 +79,5 @@ @test @inferred(convert(SVector, c)) == SVector{2,Int}([1, 2]) @test @inferred(convert(SVector{2}, c)) == SVector{2,Int}([1, 2]) end + end diff --git a/test/runtests.jl b/test/runtests.jl index 279cb7ad..be6af806 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -52,3 +52,5 @@ include("flatten.jl") include("io.jl") include("svd.jl") include("deprecated.jl") + +include("vectorModules.jl") \ No newline at end of file diff --git a/test/vectorModules.jl b/test/vectorModules.jl new file mode 100644 index 00000000..f546730b --- /dev/null +++ b/test/vectorModules.jl @@ -0,0 +1,20 @@ +using StaticArrays.Float64Vectors + +@testset "Float64Vectors" begin + @test Vector3D == SArray{Tuple{3},Float64,1,3} + @test Vector2D == SArray{Tuple{2},Float64,1,2} + + v3 = Vector3D(1, 2, 3) + @test typeof(v3) == SArray{Tuple{3},Float64,1,3} + @test v3[1] == 1.0 + @test v3[2] == 2.0 + @test v3[3] == 3.0 + + v2 = Vector2D(10, 20) + @test typeof(v2) == SArray{Tuple{2},Float64,1,2} + @test v2[1] == 10.0 + @test v2[2] == 20.0 + + @test Vector3D(1,2,3) == Vector3D(1.0, 2.0, 3.0) + @test Vector2D(10,20) == Vector2D(10.0, 20.0) +end \ No newline at end of file