Skip to content

Commit 3259322

Browse files
authored
Merge pull request #502 from JuliaRobotics/maint/20Q2/test_maint
Cleaned up tests a bit and printVariable bugfix
2 parents 4c10671 + 2a042d1 commit 3259322

File tree

7 files changed

+14
-34
lines changed

7 files changed

+14
-34
lines changed

src/services/AbstractDFG.jl

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ emptySessionData!(dfg::AbstractDFG) = empty!(dfg.sessionData)
196196
$(SIGNATURES)
197197
True if the variable or factor exists in the graph.
198198
"""
199-
function exists(dfg::G, node::N) where {G <: AbstractDFG, N <: DFGNode}
199+
function exists(dfg::AbstractDFG, node::DFGNode)
200+
error("exists not implemented for $(typeof(dfg))")
201+
end
202+
203+
function exists(dfg::AbstractDFG, label::Symbol)
200204
error("exists not implemented for $(typeof(dfg))")
201205
end
202206

@@ -348,23 +352,6 @@ end
348352
## CRUD Aliases
349353
##------------------------------------------------------------------------------
350354

351-
# TODO: Confirm we can remove this.
352-
# """
353-
# $(SIGNATURES)
354-
# Get a DFGVariable from a DFG using its underlying integer ID.
355-
# """
356-
# function getVariable(dfg::G, variableId::Int64)::AbstractDFGVariable where G <: AbstractDFG
357-
# error("getVariable not implemented for $(typeof(dfg))")
358-
# end
359-
# TODO: Confirm we can remove this.
360-
# """
361-
# $(SIGNATURES)
362-
# Get a DFGFactor from a DFG using its underlying integer ID.
363-
# """
364-
# function getFactor(dfg::G, factorId::Int64)::AbstractDFGFactor where G <: AbstractDFG
365-
# error("getFactor not implemented for $(typeof(dfg))")
366-
# end
367-
368355
"""
369356
$(SIGNATURES)
370357
Get a DFGVariable with a specific solver key.

src/services/CustomPrinting.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ end
9898
9999
Display and return to console the user factor identified by tag name.
100100
"""
101-
printFactor(dfg::AbstractDFG, sym::Symbol) = print(getFactor(dfg, sym))
101+
printFactor(dfg::AbstractDFG, sym::Symbol; kwargs...) = printFactor(getFactor(dfg, sym); kwargs...)
102102

103103
"""
104104
$SIGNATURES
@@ -108,9 +108,9 @@ Display the content of `VariableNodeData` to console for a given factor graph an
108108
Dev Notes
109109
- TODO split as two show macros between AMP and DFG
110110
"""
111-
printVariable(dfg::AbstractDFG, sym::Symbol) = print(getVariable(dfg, sym))
111+
printVariable(dfg::AbstractDFG, sym::Symbol; kwargs...) = printVariable(getVariable(dfg, sym); kwargs...)
112112

113-
printNode(dfg::AbstractDFG, sym::Symbol) = isVariable(dfg,sym) ? printVariable(dfg, sym) : printFactor(dfg, sym)
113+
printNode(dfg::AbstractDFG, sym::Symbol; kwargs...) = isVariable(dfg,sym) ? printVariable(dfg, sym; kwargs...) : printFactor(dfg, sym; kwargs...)
114114

115115

116116
##==============================================================================
File renamed without changes.
File renamed without changes.

test/runtests.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ end
6060
include("DataStoreTests.jl")
6161
end
6262

63-
#TODO confirm functionality of this test is covered
64-
# @testset "Needs-a-Home Tests" begin
65-
# include("needsahomeTests.jl")
66-
# end
67-
6863
@testset "LightDFG subtype tests" begin
6964
for type in [(var=DFGVariableSummary, fac=DFGFactorSummary), (var=SkeletonDFGVariable,fac=SkeletonDFGFactor)]
7065
@testset "$(type.var) and $(type.fac) tests" begin
@@ -145,12 +140,10 @@ struct NotImplementedDFG{T} <: AbstractDFG{T} end
145140

146141
@test_throws ErrorException exists(dfg, v1)
147142
@test_throws ErrorException exists(dfg, f1)
148-
#TODO FIXME
149-
# @test_throws ErrorException exists(dfg, :s)
143+
144+
@test_throws ErrorException exists(dfg, :s)
150145
@test_throws ErrorException addVariable!(dfg, v1)
151-
@test_throws ErrorException addFactor!(dfg, [v1, v1], f1)
152-
@test_throws ErrorException addFactor!(dfg,[:a, :b], f1)
153-
#TODO only implement addFactor!(dfg, f1)
146+
154147
@test_throws ErrorException getVariable(dfg, :a)
155148
@test_throws ErrorException getFactor(dfg, :a)
156149
@test_throws ErrorException updateVariable!(dfg, v1)

test/solveTest.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#TODO Test with standard generated graphs from IIF
12
# Add some nodes.
23
v1 = addVariable!(dfg, :a, ContinuousScalar, labels = [:POSE])
34
addFactor!(dfg, [:a], Prior(Normal(0,1)))

test/testBlocks.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ using UUIDs
55

66
import Base: convert
77

8-
# TODO, dink meer aan: Trait based softtypes or hard type for VariableNodeData
98
# Test InferenceVariable Types
109
struct TestSofttype1 <: InferenceVariable
1110
dims::Int
@@ -103,7 +102,7 @@ end
103102
# struct TestInferenceVariable2 <: InferenceVariable end
104103
# struct TestFunctorInferenceType1 <: FunctorInferenceType end
105104

106-
# TODO see note in AbstractDFG.jl setSolverParams!
105+
# NOTE see note in AbstractDFG.jl setSolverParams!
107106
struct GeenSolverParams <: AbstractParams
108107
end
109108

@@ -174,7 +173,7 @@ function DFGStructureAndAccessors(::Type{T}, solparams::AbstractParams=NoSolverP
174173
@test getSessionData(fg) == smallSessionData
175174

176175

177-
# TODO see note in AbstractDFG.jl setSolverParams!
176+
# NOTE see note in AbstractDFG.jl setSolverParams!
178177
@test_throws MethodError setSolverParams!(fg, GeenSolverParams()) == GeenSolverParams()
179178

180179

0 commit comments

Comments
 (0)