Skip to content

Commit ebb93df

Browse files
committed
Add tests for algorithms
1 parent d59c588 commit ebb93df

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

GeometryOpsCore/src/types/algorithm.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function (Alg::Type{<: SingleManifoldAlgorithm{M}})(m::M; kwargs...) where {M}
7171
return Alg(; kwargs...)
7272
end
7373

74-
function (Alg::Type{<: ManifoldIndependentAlgorithm{M}})(m::Manifold; kwargs...) where {M}
74+
function (Alg::Type{<: SingleManifoldAlgorithm{M}})(m::Manifold; kwargs...) where {M}
7575
# this catches the case where the algorithm doesn't match the manifold
7676
# throw a WrongManifoldException and be done with it
7777
throw(WrongManifoldException{typeof(m), M, Alg}())

test/core/algorithm.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using GeometryOpsCore
2+
3+
@testset "Constructing NoAlgorithm" begin
4+
@test NoAlgorithm() isa NoAlgorithm
5+
end
6+
7+
@testset "Constructing AutoAlgorithm" begin
8+
@test AutoAlgorithm() isa AutoAlgorithm
9+
@test AutoAlgorithm(; x = 1) == AutoAlgorithm(AutoManifold(), pairs((; x = 1)))
10+
end
11+
12+
@testset "SingleManifoldAlgorithm" begin
13+
struct TestSMAlgorithm <: SingleManifoldAlgorithm{Planar}
14+
end
15+
16+
@test TestSMAlgorithm() isa TestSMAlgorithm
17+
18+
@test_throws GeometryOpsCore.WrongManifoldException TestSMAlgorithm(Geodesic())
19+
end
20+
21+
@testset "ManifoldIndependentAlgorithm" begin
22+
struct TestMIDAlgorithm{M} <: ManifoldIndependentAlgorithm{M}
23+
m::M
24+
end
25+
26+
@test TestMIDAlgorithm(Planar()) isa TestMIDAlgorithm
27+
@test TestMIDAlgorithm(Spherical()) isa TestMIDAlgorithm
28+
@test TestMIDAlgorithm(Geodesic()) isa TestMIDAlgorithm
29+
end

test/core/manifold.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO: test manifold conversion from Geodesic to Spherical and vice versa

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ using SafeTestsets
44

55
include("helpers.jl")
66

7+
@testset "Core" begin
8+
@safetestset "Algorithm" begin include("core/algorithm.jl") end
9+
@safetestset "Manifold" begin include("core/manifold.jl") end
10+
end
11+
712
@safetestset "Primitives" begin include("primitives.jl") end
813
# Methods
914
@safetestset "Angles" begin include("methods/angles.jl") end

0 commit comments

Comments
 (0)