Skip to content

Commit 5cde582

Browse files
committed
format
1 parent 775ecbe commit 5cde582

3 files changed

Lines changed: 150 additions & 136 deletions

File tree

src/GraphsDFG/services/GraphsDFGSerialization.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ end
4949
function getPackedGraphsDFGSubtype(s)
5050
subs = subtypes(AbstractDFGParams)
5151
idx = findfirst(x -> nameof(x) == Symbol(s.solverParams_type[]), subs)
52-
isnothing(idx) && throw(DFG.SerializationError("Unknown solver parameters type `$(s.solverParams_type[])`"))
52+
isnothing(idx) && throw(
53+
DFG.SerializationError("Unknown solver parameters type `$(s.solverParams_type[])`"),
54+
)
5355
return PackedGraphsDFG{subs[idx]}
5456
end
5557
function getOldPackedGraphsDFGSubtype(s)
5658
subs = subtypes(AbstractDFGParams)
5759
idx = findfirst(x -> nameof(x) == Symbol(s.solverParams_type[]), subs)
58-
isnothing(idx) && throw(DFG.SerializationError("Unknown solver parameters type `$(s.solverParams_type[])`"))
60+
isnothing(idx) && throw(
61+
DFG.SerializationError("Unknown solver parameters type `$(s.solverParams_type[])`"),
62+
)
5963
return _OldPackedGraphsDFG{subs[idx]}
6064
end
6165
JSON.@choosetype PackedGraphsDFG getPackedGraphsDFGSubtype

src/entities/DFGVariable.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ Base.@kwdef struct MeanMaxPPE <: AbstractPointParametricEst
169169
lastUpdatedTimestamp::Union{ZonedDateTime, Nothing} = nothing
170170
end
171171

172-
173-
174172
##------------------------------------------------------------------------------
175173
## Constructors
176174

@@ -392,7 +390,7 @@ $(TYPEDFIELDS)
392390
ppeDict::Dict{Symbol, <:AbstractPointParametricEst}
393391
"""Symbol for the variableType for the underlying variable.
394392
Accessor: [`getVariableType`](@ref)"""
395-
variableTypeName::Symbol &(json=(name="variableType",)) # TODO check from StructTypes.names(::Type{VariableSummary}) = ((:variableTypeName, :variableType),)
393+
variableTypeName::Symbol & (json = (name = "variableType",)) # TODO check from StructTypes.names(::Type{VariableSummary}) = ((:variableTypeName, :variableType),)
396394
"""Dictionary of large data associated with this variable.
397395
Accessors: [`addBlobentry!`](@ref), [`getBlobentry`](@ref), [`mergeBlobentry!`](@ref), and [`deleteBlobentry!`](@ref)"""
398396
dataDict::Dict{Symbol, Blobentry}

test/runtests.jl

Lines changed: 143 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -17,166 +17,178 @@ DFG.@usingDFG true
1717
# logger = SimpleLogger(stdout, Logging.Debug)
1818
# global_logger(logger)
1919
@testset "DFG Tests" begin
20+
include("test_defVariable.jl")
2021

21-
include("test_defVariable.jl")
22+
include("testBlocks.jl")
2223

23-
include("testBlocks.jl")
24-
25-
@testset "Test generated ==" begin
26-
include("compareTests.jl")
27-
end
24+
@testset "Test generated ==" begin
25+
include("compareTests.jl")
26+
end
2827

29-
@testset "Testing GraphsDFG.FactorGraphs functions" begin
30-
include("FactorGraphsTests.jl")
31-
end
28+
@testset "Testing GraphsDFG.FactorGraphs functions" begin
29+
include("FactorGraphsTests.jl")
30+
end
3231

33-
apis = [GraphsDFG]
32+
apis = [GraphsDFG]
3433

35-
for api in apis
36-
@testset "Testing Driver: $(api)" begin
37-
@info "Testing Driver: $(api)"
38-
global testDFGAPI = api
39-
include("interfaceTests.jl")
34+
for api in apis
35+
@testset "Testing Driver: $(api)" begin
36+
@info "Testing Driver: $(api)"
37+
global testDFGAPI = api
38+
include("interfaceTests.jl")
39+
end
4040
end
41-
end
4241

43-
# Test special cases
44-
@testset "Plotting Tests" begin
45-
include("plottingTest.jl")
46-
end
42+
# Test special cases
43+
@testset "Plotting Tests" begin
44+
include("plottingTest.jl")
45+
end
4746

48-
@testset "Data Store Tests" begin
49-
include("consol_DataEntryBlobTests.jl")
50-
end
47+
@testset "Data Store Tests" begin
48+
include("consol_DataEntryBlobTests.jl")
49+
end
5150

52-
@testset "GraphsDFG subtype tests" begin
53-
for type in [
54-
(var = VariableSummary, fac = FactorSummary),
55-
(var = VariableSkeleton, fac = FactorSkeleton),
56-
]
57-
@testset "$(type.var) and $(type.fac) tests" begin
58-
@info "Testing $(type.var) and $(type.fac)"
59-
global VARTYPE = type.var
60-
global FACTYPE = type.fac
61-
include("GraphsDFGSummaryTypes.jl")
51+
@testset "GraphsDFG subtype tests" begin
52+
for type in [
53+
(var = VariableSummary, fac = FactorSummary),
54+
(var = VariableSkeleton, fac = FactorSkeleton),
55+
]
56+
@testset "$(type.var) and $(type.fac) tests" begin
57+
@info "Testing $(type.var) and $(type.fac)"
58+
global VARTYPE = type.var
59+
global FACTYPE = type.fac
60+
include("GraphsDFGSummaryTypes.jl")
61+
end
6262
end
6363
end
64-
end
6564

66-
if get(ENV, "IIF_TEST", "false") == "true"
67-
68-
# Switch to our upstream test branch.
69-
#FIXME This is a temporary fix to use the develop branch of AMP.
70-
Pkg.add(PackageSpec(; name = "ApproxManifoldProducts", rev = "develop"))
71-
#FIXME This is a temporary fix to use the develop branch of IIF.
72-
# Pkg.add(PackageSpec(; name = "IncrementalInference", rev = "upstream/dfg_integration_test"))
73-
# Pkg.add(PackageSpec(; name = "IncrementalInference", rev = "develop"))
74-
if get(ENV, "IIF_TEST_DEV", "true") == "true"
75-
Pkg.add(
76-
PackageSpec(;
77-
url = "https://github.com/JuliaRobotics/IncrementalInference.jl.git",
78-
subdir = "IncrementalInferenceTypes",
79-
rev = "develop",
80-
),
81-
)
82-
Pkg.add(
83-
PackageSpec(;
84-
url = "https://github.com/JuliaRobotics/IncrementalInference.jl.git",
85-
subdir = "IncrementalInference",
86-
rev = "develop",
87-
),
88-
)
89-
else
90-
Pkg.develop(path=joinpath(DEPOT_PATH[1],"dev","IncrementalInference","IncrementalInferenceTypes"))
91-
Pkg.develop(path=joinpath(DEPOT_PATH[1],"dev","IncrementalInference","IncrementalInference"))
92-
end
65+
if get(ENV, "IIF_TEST", "false") == "true"
66+
67+
# Switch to our upstream test branch.
68+
#FIXME This is a temporary fix to use the develop branch of AMP.
69+
Pkg.add(PackageSpec(; name = "ApproxManifoldProducts", rev = "develop"))
70+
#FIXME This is a temporary fix to use the develop branch of IIF.
71+
# Pkg.add(PackageSpec(; name = "IncrementalInference", rev = "upstream/dfg_integration_test"))
72+
# Pkg.add(PackageSpec(; name = "IncrementalInference", rev = "develop"))
73+
if get(ENV, "IIF_TEST_DEV", "true") == "true"
74+
Pkg.add(
75+
PackageSpec(;
76+
url = "https://github.com/JuliaRobotics/IncrementalInference.jl.git",
77+
subdir = "IncrementalInferenceTypes",
78+
rev = "develop",
79+
),
80+
)
81+
Pkg.add(
82+
PackageSpec(;
83+
url = "https://github.com/JuliaRobotics/IncrementalInference.jl.git",
84+
subdir = "IncrementalInference",
85+
rev = "develop",
86+
),
87+
)
88+
else
89+
Pkg.develop(;
90+
path = joinpath(
91+
DEPOT_PATH[1],
92+
"dev",
93+
"IncrementalInference",
94+
"IncrementalInferenceTypes",
95+
),
96+
)
97+
Pkg.develop(;
98+
path = joinpath(
99+
DEPOT_PATH[1],
100+
"dev",
101+
"IncrementalInference",
102+
"IncrementalInference",
103+
),
104+
)
105+
end
93106

94-
@info "------------------------------------------------------------------------"
95-
@info "These tests are using IncrementalInference to do additional driver tests"
96-
@info "------------------------------------------------------------------------"
107+
@info "------------------------------------------------------------------------"
108+
@info "These tests are using IncrementalInference to do additional driver tests"
109+
@info "------------------------------------------------------------------------"
97110

98-
using IncrementalInference
111+
using IncrementalInference
99112

100-
apis = Vector{AbstractDFG}()
101-
push!(apis, GraphsDFG(; solverParams = SolverParams()))
113+
apis = Vector{AbstractDFG}()
114+
push!(apis, GraphsDFG(; solverParams = SolverParams()))
102115

103-
for api in apis
104-
@testset "Testing Driver: $(typeof(api))" begin
105-
@info "Testing Driver: $(api)"
106-
global dfg = deepcopy(api)
107-
include("iifInterfaceTests.jl")
116+
for api in apis
117+
@testset "Testing Driver: $(typeof(api))" begin
118+
@info "Testing Driver: $(api)"
119+
global dfg = deepcopy(api)
120+
include("iifInterfaceTests.jl")
121+
end
122+
123+
@testset "FileDFG Testing Driver: $(typeof(api))" begin
124+
@info "FileDFG Testing Driver: $(typeof(api))"
125+
global dfg = deepcopy(api)
126+
include("fileDFGTests.jl")
127+
end
108128
end
109129

110-
@testset "FileDFG Testing Driver: $(typeof(api))" begin
111-
@info "FileDFG Testing Driver: $(typeof(api))"
112-
global dfg = deepcopy(api)
113-
include("fileDFGTests.jl")
130+
@testset "IIF Compare Tests" begin
131+
#run a copy of compare tests from IIF
132+
include("iifCompareTests.jl")
114133
end
115-
end
116-
117-
@testset "IIF Compare Tests" begin
118-
#run a copy of compare tests from IIF
119-
include("iifCompareTests.jl")
120-
end
121134

122-
# Simple graph solving test
123-
@testset "Simple graph solving test" begin
124-
# This is just to validate we're not going to blow up downstream.
125-
apis = [
126-
# GraphsDFG{SolverParams}(),
127-
GraphsDFG(; solverParams = SolverParams()),
128-
]
129-
for api in apis
130-
@info "Running simple solver test: $(typeof(api))"
131-
global dfg = deepcopy(api)
132-
include("solveTest.jl")
135+
# Simple graph solving test
136+
@testset "Simple graph solving test" begin
137+
# This is just to validate we're not going to blow up downstream.
138+
apis = [
139+
# GraphsDFG{SolverParams}(),
140+
GraphsDFG(; solverParams = SolverParams()),
141+
]
142+
for api in apis
143+
@info "Running simple solver test: $(typeof(api))"
144+
global dfg = deepcopy(api)
145+
include("solveTest.jl")
146+
end
133147
end
148+
else
149+
@warn "Skipping IncrementalInference driver tests"
134150
end
135-
else
136-
@warn "Skipping IncrementalInference driver tests"
137-
end
138151

139-
struct NotImplementedDFG{V, T} <: AbstractDFG{V, T} end
152+
struct NotImplementedDFG{V, T} <: AbstractDFG{V, T} end
140153

141-
@testset "No Interface tests" begin
142-
dfg = NotImplementedDFG{VariableDFG, FactorDFG}()
143-
v1 = VariableSkeleton(:v1)
144-
f1 = FactorSkeleton(:f1, [:v1])
154+
@testset "No Interface tests" begin
155+
dfg = NotImplementedDFG{VariableDFG, FactorDFG}()
156+
v1 = VariableSkeleton(:v1)
157+
f1 = FactorSkeleton(:f1, [:v1])
145158

146-
@test_throws MethodError exists(dfg, v1)
147-
@test_throws MethodError exists(dfg, f1)
159+
@test_throws MethodError exists(dfg, v1)
160+
@test_throws MethodError exists(dfg, f1)
148161

149-
@test_throws MethodError exists(dfg, :s)
150-
@test_throws MethodError addVariable!(dfg, v1)
162+
@test_throws MethodError exists(dfg, :s)
163+
@test_throws MethodError addVariable!(dfg, v1)
151164

152-
@test_throws MethodError getVariable(dfg, :a)
153-
@test_throws MethodError getFactor(dfg, :a)
154-
@test_throws MethodError mergeVariable!(dfg, v1)
155-
@test_throws MethodError mergeFactor!(dfg, f1)
165+
@test_throws MethodError getVariable(dfg, :a)
166+
@test_throws MethodError getFactor(dfg, :a)
167+
@test_throws MethodError mergeVariable!(dfg, v1)
168+
@test_throws MethodError mergeFactor!(dfg, f1)
156169

157-
@test_throws MethodError deleteVariable!(dfg, :a)
158-
@test_throws MethodError deleteFactor!(dfg, :a)
159-
@test_throws MethodError getVariables(dfg)
160-
@test_throws MethodError getFactors(dfg)
161-
@test_throws MethodError isConnected(dfg)
162-
@test_throws MethodError listNeighbors(dfg, v1)
163-
@test_throws MethodError listNeighbors(dfg, :a)
170+
@test_throws MethodError deleteVariable!(dfg, :a)
171+
@test_throws MethodError deleteFactor!(dfg, :a)
172+
@test_throws MethodError getVariables(dfg)
173+
@test_throws MethodError getFactors(dfg)
174+
@test_throws MethodError isConnected(dfg)
175+
@test_throws MethodError listNeighbors(dfg, v1)
176+
@test_throws MethodError listNeighbors(dfg, :a)
164177

165-
@test_throws MethodError DFG._getDuplicatedEmptyDFG(dfg)
178+
@test_throws MethodError DFG._getDuplicatedEmptyDFG(dfg)
166179

167-
@test_throws MethodError isVariable(dfg, :a)
168-
@test_throws MethodError isFactor(dfg, :a)
169-
end
180+
@test_throws MethodError isVariable(dfg, :a)
181+
@test_throws MethodError isFactor(dfg, :a)
182+
end
170183

171-
@testset "Testing Code Quality with Aqua" begin
172-
Aqua.test_ambiguities([DistributedFactorGraphs])
173-
Aqua.test_unbound_args(DistributedFactorGraphs)
174-
Aqua.test_undefined_exports(DistributedFactorGraphs)
175-
Aqua.test_piracies(DistributedFactorGraphs)
176-
Aqua.test_project_extras(DistributedFactorGraphs)
177-
Aqua.test_stale_deps(DistributedFactorGraphs; ignore = [:Colors])
178-
Aqua.test_deps_compat(DistributedFactorGraphs)
179-
# Aqua.test_project_toml_formatting(DistributedFactorGraphs) # deprecated in Aqua.jl v0.8
184+
@testset "Testing Code Quality with Aqua" begin
185+
Aqua.test_ambiguities([DistributedFactorGraphs])
186+
Aqua.test_unbound_args(DistributedFactorGraphs)
187+
Aqua.test_undefined_exports(DistributedFactorGraphs)
188+
Aqua.test_piracies(DistributedFactorGraphs)
189+
Aqua.test_project_extras(DistributedFactorGraphs)
190+
Aqua.test_stale_deps(DistributedFactorGraphs; ignore = [:Colors])
191+
Aqua.test_deps_compat(DistributedFactorGraphs)
192+
# Aqua.test_project_toml_formatting(DistributedFactorGraphs) # deprecated in Aqua.jl v0.8
193+
end
180194
end
181-
182-
end

0 commit comments

Comments
 (0)