Skip to content

Commit d96eabc

Browse files
committed
Refactoring tests
1 parent 5f6514e commit d96eabc

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

test/iifInterfaceTests.jl

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ end
1010
@testset "Building a simple Graph" begin
1111
global dfg,v1,v2,f1
1212
# Use IIF to add the variables and factors
13-
v1 = addVariable!(dfg, :a, ContinuousScalar, tags = [:POSE], solvable=0)
14-
v2 = addVariable!(dfg, :b, ContinuousScalar, tags = [:LANDMARK], solvable=1)
13+
v1 = addVariable!(dfg, :a, Position{1}, tags = [:POSE], solvable=0)
14+
v2 = addVariable!(dfg, :b, Position{1}, tags = [:LANDMARK], solvable=1)
1515
f1 = addFactor!(dfg, [:a; :b], LinearRelative(Normal(50.0,2.0)), solvable=0)
16-
17-
@show dfg
18-
@show f1
19-
@show v1
2016
end
2117

2218
println()
@@ -25,15 +21,15 @@ println()
2521
#test before anything changes
2622
@testset "Producing Dot Files" begin
2723
global dfg
28-
@show todotstr = toDot(dfg)
24+
todotstr = toDot(dfg)
2925
#TODO consider using a regex, but for now test all orders
3026
todota = cmp(todotstr, "graph graphname {\n2 [\"label\"=\"a\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n2 -- 3\n3 [\"label\"=\"abf1\",\"shape\"=\"box\",\"fillcolor\"=\"blue\",\"color\"=\"blue\"]\n1 [\"label\"=\"b\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n1 -- 3\n}\n") |> abs
3127
todotb = cmp(todotstr, "graph graphname {\n2 [\"label\"=\"b\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n2 -- 3\n3 [\"label\"=\"abf1\",\"shape\"=\"box\",\"fillcolor\"=\"blue\",\"color\"=\"blue\"]\n1 [\"label\"=\"a\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n1 -- 3\n}\n") |> abs
3228
todotc = cmp(todotstr, "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\na -- abf1\nb -- abf1\n}\n") |> abs
3329
todotd = cmp(todotstr, "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\nb -- abf1\na -- abf1\n}\n") |> abs
3430
todote = cmp(todotstr, "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\na -- abf1\nb -- abf1\n}\n") |> abs
3531
todotf = cmp(todotstr, "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\nb -- abf1\na -- abf1\n}\n") |> abs
36-
@show todota, todotb, todotc, todotd, todote, todotf
32+
# @show todota, todotb, todotc, todotd, todote, todotf
3733
@test (todota < 1 || todotb < 1 || todotc < 1 || todotd < 1 || todote < 1 || todotf < 1)
3834
@test toDotFile(dfg, "something.dot") === nothing
3935
Base.rm("something.dot")
@@ -53,9 +49,9 @@ end
5349

5450
# Build a new in-memory IIF graph to transfer into the new graph.
5551
iiffg = initfg()
56-
v1 = deepcopy(addVariable!(iiffg, :a, ContinuousScalar))
57-
v2 = deepcopy(addVariable!(iiffg, :b, ContinuousScalar))
58-
v3 = deepcopy(addVariable!(iiffg, :c, ContinuousScalar))
52+
v1 = deepcopy(addVariable!(iiffg, :a, Position{1}))
53+
v2 = deepcopy(addVariable!(iiffg, :b, Position{1}))
54+
v3 = deepcopy(addVariable!(iiffg, :c, Position{1}))
5955
f1 = deepcopy(addFactor!(iiffg, [:a; :b], LinearRelative(Normal(50.0,2.0)) ))
6056
f2 = deepcopy(addFactor!(iiffg, [:b; :c], LinearRelative(Normal(10.0,1.0)) ))
6157

@@ -151,15 +147,14 @@ end
151147
@test lsf(dfg, LinearRelative) == [:abf1]
152148
@test lsfWho(dfg, :LinearRelative) == [:abf1]
153149

154-
@test getVariableType(v1) isa ContinuousScalar
155-
@test getVariableType(dfg,:a) isa ContinuousScalar
150+
@test getVariableType(v1) isa Position{1}
151+
@test getVariableType(dfg,:a) isa Position{1}
156152

157153
#TODO what is lsTypes supposed to return?
158154
@test_broken lsTypes(dfg)
159155

160-
@test issetequal(ls(dfg, ContinuousScalar), [:a, :b])
161-
162-
@test issetequal(lsWho(dfg, :ContinuousScalar),[:a, :b])
156+
@test issetequal(ls(dfg, Position{1}), [:a, :b])
157+
@test issetequal(lsWho(dfg, :Position),[:a, :b])
163158

164159
varNearTs = findVariableNearTimestamp(dfg, now())
165160
@test_skip varNearTs[1][1] == [:b]
@@ -198,9 +193,9 @@ end
198193
@test getVariablePPEDict(v1) == v1.ppeDict # changed to .ppeDict -- delete by DFG v0.7
199194

200195

201-
@test typeof(getVariableType(v1)) == ContinuousScalar
202-
@test typeof(getVariableType(v2)) == ContinuousScalar
203-
@test typeof(getVariableType(v1)) == ContinuousScalar
196+
@test typeof(getVariableType(v1)) == Position{1}
197+
@test typeof(getVariableType(v2)) == Position{1}
198+
@test typeof(getVariableType(v1)) == Position{1}
204199

205200
@test getLabel(f1) == f1.label
206201
@test getTags(f1) == f1.tags
@@ -329,10 +324,10 @@ end
329324
@test isConnected(dfg) == true
330325
# @test @test_deprecated isFullyConnected(dfg) == true
331326
# @test @test_deprecated hasOrphans(dfg) == false
332-
addVariable!(dfg, :orphan, ContinuousScalar, tags = [:POSE], solvable=0)
327+
addVariable!(dfg, :orphan, Position{1}, tags = [:POSE], solvable=0)
333328
@test isConnected(dfg) == false
334329
else
335-
addVariable!(dfg, :orphan, ContinuousScalar, tags = [:POSE], solvable=0)
330+
addVariable!(dfg, :orphan, Position{1}, tags = [:POSE], solvable=0)
336331
@warn "Neo4jDFG is currently failing with the connectivity test."
337332
end
338333
end
@@ -393,7 +388,7 @@ numNodes = 10
393388
# end
394389

395390
#change solvable and solveInProgress for x7,x8 for improved tests on x7x8f1
396-
verts = map(n -> addVariable!(dfg, Symbol("x$n"), ContinuousScalar, tags = [:POSE]), 1:numNodes)
391+
verts = map(n -> addVariable!(dfg, Symbol("x$n"), Position{1}, tags = [:POSE]), 1:numNodes)
397392
#TODO fix this to use accessors
398393
setSolvable!(verts[7], 1)
399394
setSolvable!(verts[8], 0)

0 commit comments

Comments
 (0)