Skip to content

Commit ed277f1

Browse files
committed
more FileDFG tests
1 parent b5cf8a6 commit ed277f1

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export setSerializationModule!, getSerializationModule
212212
export packVariable, unpackVariable, packFactor, unpackFactor
213213

214214
# File import and export
215-
export saveDFG, loadDFG
215+
export saveDFG, loadDFG!
216216
export toDot, toDotFile
217217

218218
# Comparisons

test/consolInterfaceDev.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,29 @@ end
207207
CopyFunctionsTest(testDFGAPI)
208208

209209
end
210+
211+
@testset "Copy Functions" begin
212+
213+
filename = "/tmp/fileDFG"
214+
215+
dfg, vars, facs = connectivityTestGraph(testDFGAPI)
216+
217+
saveDFG(dfg, filename)
218+
219+
copyDfg = DistributedFactorGraphs._getDuplicatedEmptyDFG(dfg)
220+
221+
@info "Going to load $filename"
222+
223+
loadDFG!(copyDfg, filename)
224+
225+
for var in vars
226+
@test getVariable(dfg, var.label) == getVariable(copyDfg, var.label)
227+
end
228+
for fac in facs
229+
@test getFactor(dfg, fac.label) == getFactor(copyDfg, fac.label)
230+
# @test getFactor(dfg, fac.label) == fac
231+
end
232+
end
210233
#
211234
#=
212235
fg = fg1

test/fileDFGTests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ using Test
3535

3636
facts = map(n -> addFactor!(dfg, [verts[n], verts[n+1]], LinearConditional(Normal(50.0,2.0))), 1:(numNodes-1))
3737

38+
#FIXME a lot of these makes test fail
39+
# facts[4].solverData.solveInProgress = 1
40+
# facts[4].solverData.multihypo = [1, 0.1, 0.9]
41+
# facts[4].solverData.eliminated = true
42+
# facts[4].solverData.potentialused = true
43+
# updateFactor!(dfg, facts[4])
3844
# Save and load the graph to test.
3945
saveDFG(dfg, filename)
4046

4147
copyDfg = DistributedFactorGraphs._getDuplicatedEmptyDFG(dfg)
4248
@info "Going to load $filename"
49+
50+
#FIXME loadDFG!(copyDfg, filename), but use this to test deprecation
4351
retDFG = loadDFG(filename, Main, copyDfg) #, loaddir="/tmp")
4452

4553
@test issetequal(ls(dfg), ls(retDFG))

test/testBlocks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ function connectivityTestGraph(::Type{T}; VARTYPE=DFGVariable, FACTYPE=DFGFactor
10041004
setSolvable!(dfg, :x8, 0)
10051005
setSolvable!(dfg, :x9, 0)
10061006

1007-
gfnd = GenericFunctionNodeData(false, false, Int[], TestCCW(TestFunctorInferenceType1()))
1007+
gfnd = GenericFunctionNodeData(true, true, Int[], TestCCW(TestFunctorInferenceType1()), Float64[], Int[], 1)
10081008
f_tags = Set([:FACTOR])
10091009
# f1 = DFGFactor(f1_lbl, [:a,:b], gfnd, tags = f_tags)
10101010

0 commit comments

Comments
 (0)