10
10
@testset " Building a simple Graph" begin
11
11
global dfg,v1,v2,f1
12
12
# 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 )
15
15
f1 = addFactor! (dfg, [:a ; :b ], LinearRelative (Normal (50.0 ,2.0 )), solvable= 0 )
16
-
17
- @show dfg
18
- @show f1
19
- @show v1
20
16
end
21
17
22
18
println ()
@@ -25,15 +21,15 @@ println()
25
21
# test before anything changes
26
22
@testset " Producing Dot Files" begin
27
23
global dfg
28
- @show todotstr = toDot (dfg)
24
+ todotstr = toDot (dfg)
29
25
# TODO consider using a regex, but for now test all orders
30
26
todota = cmp (todotstr, " graph graphname {\n 2 [\" label\" =\" a\" ,\" shape\" =\" ellipse\" ,\" fillcolor\" =\" red\" ,\" color\" =\" red\" ]\n 2 -- 3\n 3 [\" label\" =\" abf1\" ,\" shape\" =\" box\" ,\" fillcolor\" =\" blue\" ,\" color\" =\" blue\" ]\n 1 [\" label\" =\" b\" ,\" shape\" =\" ellipse\" ,\" fillcolor\" =\" red\" ,\" color\" =\" red\" ]\n 1 -- 3\n }\n " ) |> abs
31
27
todotb = cmp (todotstr, " graph graphname {\n 2 [\" label\" =\" b\" ,\" shape\" =\" ellipse\" ,\" fillcolor\" =\" red\" ,\" color\" =\" red\" ]\n 2 -- 3\n 3 [\" label\" =\" abf1\" ,\" shape\" =\" box\" ,\" fillcolor\" =\" blue\" ,\" color\" =\" blue\" ]\n 1 [\" label\" =\" a\" ,\" shape\" =\" ellipse\" ,\" fillcolor\" =\" red\" ,\" color\" =\" red\" ]\n 1 -- 3\n }\n " ) |> abs
32
28
todotc = cmp (todotstr, " graph G {\n a [color=red, shape=ellipse];\n b [color=red, shape=ellipse];\n abf1 [color=blue, shape=box];\n a -- abf1\n b -- abf1\n }\n " ) |> abs
33
29
todotd = cmp (todotstr, " graph G {\n a [color=red, shape=ellipse];\n b [color=red, shape=ellipse];\n abf1 [color=blue, shape=box];\n b -- abf1\n a -- abf1\n }\n " ) |> abs
34
30
todote = cmp (todotstr, " graph G {\n a [color=red, shape=ellipse];\n b [color=red, shape=ellipse];\n abf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\n a -- abf1\n b -- abf1\n }\n " ) |> abs
35
31
todotf = cmp (todotstr, " graph G {\n a [color=red, shape=ellipse];\n b [color=red, shape=ellipse];\n abf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\n b -- abf1\n a -- abf1\n }\n " ) |> abs
36
- @show todota, todotb, todotc, todotd, todote, todotf
32
+ # @show todota, todotb, todotc, todotd, todote, todotf
37
33
@test (todota < 1 || todotb < 1 || todotc < 1 || todotd < 1 || todote < 1 || todotf < 1 )
38
34
@test toDotFile (dfg, " something.dot" ) === nothing
39
35
Base. rm (" something.dot" )
53
49
54
50
# Build a new in-memory IIF graph to transfer into the new graph.
55
51
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 } ))
59
55
f1 = deepcopy (addFactor! (iiffg, [:a ; :b ], LinearRelative (Normal (50.0 ,2.0 )) ))
60
56
f2 = deepcopy (addFactor! (iiffg, [:b ; :c ], LinearRelative (Normal (10.0 ,1.0 )) ))
61
57
116
112
117
113
# Accessors
118
114
@test getAddHistory (dfg) == [:a , :b ] # , :abf1
119
- @test getDescription (dfg) != nothing
115
+ @test getDescription (dfg) != = nothing
120
116
# TODO Deprecate
121
117
# @test_throws ErrorException getLabelDict(dfg)
122
118
# Existence
@@ -151,15 +147,14 @@ end
151
147
@test lsf (dfg, LinearRelative) == [:abf1 ]
152
148
@test lsfWho (dfg, :LinearRelative ) == [:abf1 ]
153
149
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 }
156
152
157
153
# TODO what is lsTypes supposed to return?
158
154
@test_broken lsTypes (dfg)
159
155
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 ])
163
158
164
159
varNearTs = findVariableNearTimestamp (dfg, now ())
165
160
@test_skip varNearTs[1 ][1 ] == [:b ]
@@ -198,15 +193,15 @@ end
198
193
@test getVariablePPEDict (v1) == v1. ppeDict # changed to .ppeDict -- delete by DFG v0.7
199
194
200
195
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 }
204
199
205
200
@test getLabel (f1) == f1. label
206
201
@test getTags (f1) == f1. tags
207
202
@test getSolverData (f1) == f1. solverData
208
203
209
- @test getSolverParams (dfg) != nothing
204
+ @test getSolverParams (dfg) != = nothing
210
205
@test setSolverParams! (dfg, getSolverParams (dfg)) == getSolverParams (dfg)
211
206
212
207
# solver data is initialized
@@ -329,10 +324,10 @@ end
329
324
@test isConnected (dfg) == true
330
325
# @test @test_deprecated isFullyConnected(dfg) == true
331
326
# @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 )
333
328
@test isConnected (dfg) == false
334
329
else
335
- addVariable! (dfg, :orphan , ContinuousScalar , tags = [:POSE ], solvable= 0 )
330
+ addVariable! (dfg, :orphan , Position{ 1 } , tags = [:POSE ], solvable= 0 )
336
331
@warn " Neo4jDFG is currently failing with the connectivity test."
337
332
end
338
333
end
@@ -393,7 +388,7 @@ numNodes = 10
393
388
# end
394
389
395
390
# 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)
397
392
# TODO fix this to use accessors
398
393
setSolvable! (verts[7 ], 1 )
399
394
setSolvable! (verts[8 ], 0 )
0 commit comments