Skip to content

Commit 91efbe2

Browse files
committed
Small refactor to unblock 0.5.2
1 parent 481ee5e commit 91efbe2

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

test/CGStructureTests.jl

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
dfg = CloudGraphsDFG{NoSolverParams}("localhost", 7474, "neo4j", "test",
1+
dfg = CloudGraphsDFG{SolverParams}("localhost", 7474, "neo4j", "test",
22
"testUser", "testRobot", "testSession",
33
nothing,
44
nothing,
55
IncrementalInference.decodePackedType,
66
IncrementalInference.rebuildFactorMetadata!,
7-
solverParams=NoSolverParams())
7+
solverParams=SolverParams())
88

99
# Nuke the user
1010
clearUser!!(dfg)
@@ -61,37 +61,15 @@ setSessionData(dfg, session.data)
6161
v1 = addVariable!(dfg, :a, ContinuousScalar, labels = [:POSE])
6262
v2 = addVariable!(dfg, :b, ContinuousScalar, labels = [:POSE])
6363
v3 = addVariable!(dfg, :c, ContinuousScalar, labels = [:LANDMARK])
64+
addFactor!(dfg, [:a], Prior(Normal(0,1)))
6465
f1 = addFactor!(dfg, [:a; :b], LinearConditional(Normal(50.0,2.0)) )
6566
f2 = addFactor!(dfg, [:b; :c], LinearConditional(Normal(50.0,2.0)) )
6667

6768
sessions = lsSessions(dfg)
6869
@test map(s -> s.id, sessions) == [session.id]
6970

70-
# Pull and solve this graph
7171
dfgLocal = GraphsDFG{SolverParams}(params=SolverParams())
7272
DistributedFactorGraphs.getSubgraph(dfg, union(ls(dfg), lsf(dfg)), true, dfgLocal)
73-
7473
# Confirm that with sentinels we still have the same graph (doesn't pull in the sentinels)
7574
@test symdiff(ls(dfgLocal), ls(dfg)) == []
7675
@test symdiff(lsf(dfgLocal), lsf(dfg)) == []
77-
78-
# Solve it
79-
tree, smtasks = solveTree!(dfgLocal)
80-
81-
82-
# Make sure we can copy and solve normal orphaned sessions.
83-
dfgOrphaned = deepcopy(dfg)
84-
dfgOrphaned.sessionId = "doesntexist"
85-
# Don't create a session
86-
# Add some nodes.
87-
v1 = addVariable!(dfgOrphaned, :a, ContinuousScalar, labels = [:POSE])
88-
v2 = addVariable!(dfgOrphaned, :b, ContinuousScalar, labels = [:POSE])
89-
v3 = addVariable!(dfgOrphaned, :c, ContinuousScalar, labels = [:LANDMARK])
90-
f1 = addFactor!(dfgOrphaned, [:a; :b], LinearConditional(Normal(50.0,2.0)) )
91-
f2 = addFactor!(dfgOrphaned, [:b; :c], LinearConditional(Normal(50.0,2.0)) )
92-
# Solve it
93-
dfgLocal = GraphsDFG{SolverParams}(params=SolverParams())
94-
DistributedFactorGraphs.getSubgraph(dfgOrphaned, union(ls(dfgOrphaned), lsf(dfgOrphaned)), true, dfgLocal)
95-
tree, smtasks = solveTree!(dfgLocal)
96-
97-
# If this passes without errors and we solve the graph, then all good.

test/runtests.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ end
5858

5959
if get(ENV, "IIF_TEST", "") == "true"
6060

61-
Pkg.add("IncrementalInference")
6261
# Switch to our upstream test branch.
6362
Pkg.add(PackageSpec(name="IncrementalInference", rev="upstream/dfg_integration_test"))
6463
@info "------------------------------------------------------------------------"
@@ -97,6 +96,19 @@ if get(ENV, "IIF_TEST", "") == "true"
9796
# Run the CGStructure tests
9897
include("CGStructureTests.jl")
9998
end
99+
100+
# Simple graph solving test
101+
@testset "Simple graph solving test" begin
102+
# This is just to validate we're not going to blow up downstream.
103+
apis = [
104+
GraphsDFG{SolverParams}(params=SolverParams()),
105+
LightDFG{SolverParams}(params=SolverParams())]
106+
for api in apis
107+
@info "Running simple solver test: $(typeof(api))"
108+
global dfg = deepcopy(api)
109+
include("solveTest.jl")
110+
end
111+
end
100112
else
101113
@warn "Skipping IncrementalInference driver tests"
102114
end

test/solveTest.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Add some nodes.
2+
v1 = addVariable!(dfg, :a, ContinuousScalar, labels = [:POSE])
3+
addFactor!(dfg, [:a], Prior(Normal(0,1)))
4+
v2 = addVariable!(dfg, :b, ContinuousScalar, labels = [:POSE])
5+
v3 = addVariable!(dfg, :c, ContinuousScalar, labels = [:LANDMARK])
6+
f1 = addFactor!(dfg, [:a; :b], LinearConditional(Normal(50.0,2.0)) )
7+
f2 = addFactor!(dfg, [:b; :c], LinearConditional(Normal(50.0,2.0)) )
8+
9+
# Solve it
10+
tree, smtasks = solveTree!(dfg)

0 commit comments

Comments
 (0)