Skip to content

Commit 5f6514e

Browse files
committed
Fixing tests
1 parent bf60510 commit 5f6514e

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

src/services/CustomPrinting.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ function Base.show(io::IO, dfg::AbstractDFG)
191191
println(io, " Description: ", dfg.description)
192192
println(io, " Nr variables: ", length(ls(dfg)))
193193
println(io, " Nr factors: ",length(lsf(dfg)))
194-
println(io, " User Data: ", keys(dfg.userData))
195-
println(io, " Robot Data: ", keys(dfg.robotData))
196-
println(io, " Session Data: ", keys(dfg.sessionData))
194+
println(io, " User Data: ", keys(getUserData(dfg)))
195+
println(io, " Robot Data: ", keys(getRobotData(dfg)))
196+
println(io, " Session Data: ", keys(getSessionData(dfg)))
197197
end
198198

199199
Base.show(io::IO, ::MIME"text/plain", dfg::AbstractDFG) = show(io, dfg)

test/CGStructureTests.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,21 @@ createDfgSessionIfNotExist(dfg)
1515
@test Symbol(dfg.userId) in map(u -> u.id, lsUsers(dfg))
1616
# Test that we can call it again.
1717
createDfgSessionIfNotExist(dfg)
18-
# And nuke it so we can try the longer functions.
19-
clearUser!!(dfg)
2018

2119
# User, robot, and session
2220
# TODO: Make easier ways to initialize these.
2321
user = User(Symbol(dfg.userId), "Bob Zack", "Description", Dict{Symbol, String}())
2422
robot = Robot(Symbol(dfg.robotId), user.id, "Test robot", "Description", Dict{Symbol, String}())
2523
session = Session(Symbol(dfg.sessionId), robot.id, user.id, "Test Session", "Description", Dict{Symbol, String}())
2624

27-
# Test errors
28-
dfgError = deepcopy(dfg)
29-
# User/robot/session ID's can't start with numbers and can't have spaces.
30-
dfgError.userId = "1testNope"
31-
@test_throws Exception createDfgSessionIfNotExist(dfg)
32-
3325
@test getUserData(dfg) == Dict{Symbol, String}()
3426
@test getRobotData(dfg) == Dict{Symbol, String}()
3527
@test getSessionData(dfg) == Dict{Symbol, String}()
3628

3729
# User/robot/session data
3830
user.data = Dict{Symbol, String}(:a => "Hello", :b => "Goodbye")
39-
robot.data = Dict{Symbol, String}(:c => "Hello", :d => "Goodbye")
40-
session.data = Dict{Symbol, String}(:e => "Hello", :f => "Goodbye")
31+
robot.data = Dict{Symbol, String}(:c => "ABC", :d => "Goodbye")
32+
session.data = Dict{Symbol, String}(:e => "ADG", :f => "Goodbye")
4133

4234
setUserData!(dfg, user.data)
4335
setRobotData!(dfg, robot.data)
@@ -46,6 +38,9 @@ setSessionData!(dfg, session.data)
4638
@test getRobotData(dfg) == robot.data
4739
@test getSessionData(dfg) == session.data
4840

41+
# And nuke it so we can try the addVariable etc. functions to make sure they create the nodes.
42+
clearUser!!(dfg)
43+
createDfgSessionIfNotExist(dfg)
4944
# Add some nodes.
5045
v1 = addVariable!(dfg, :a, ContinuousScalar, tags = [:POSE])
5146
v2 = addVariable!(dfg, :b, ContinuousScalar, tags = [:POSE])
@@ -61,3 +56,9 @@ dfgLocal = buildSubgraph(LightDFG, dfg, union(ls(dfg), lsf(dfg)))
6156
# Confirm that with sentinels we still have the same graph (doesn't pull in the sentinels)
6257
@test symdiff(ls(dfgLocal), ls(dfg)) == []
6358
@test symdiff(lsf(dfgLocal), lsf(dfg)) == []
59+
60+
# Test errors
61+
dfgError = deepcopy(dfg)
62+
# User/robot/session ID's can't start with numbers and can't have spaces.
63+
dfgError.userId = "I want to fail"
64+
@test_throws Exception createDfgSessionIfNotExist(dfgError)

test/iifInterfaceTests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ end
116116

117117
# Accessors
118118
@test getAddHistory(dfg) == [:a, :b] #, :abf1
119-
@test getDescription(dfg) != nothing
119+
@test getDescription(dfg) !== nothing
120120
#TODO Deprecate
121121
# @test_throws ErrorException getLabelDict(dfg)
122122
# Existence
@@ -206,7 +206,7 @@ end
206206
@test getTags(f1) == f1.tags
207207
@test getSolverData(f1) == f1.solverData
208208

209-
@test getSolverParams(dfg) != nothing
209+
@test getSolverParams(dfg) !== nothing
210210
@test setSolverParams!(dfg, getSolverParams(dfg)) == getSolverParams(dfg)
211211

212212
#solver data is initialized

test/testBlocks.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ function DFGStructureAndAccessors(::Type{T}, solparams::AbstractParams=NoSolverP
172172
@test getSessionId(fg) == sId
173173
@test getAddHistory(fg) === fg.addHistory
174174

175+
# Need to set this for Neo4jDFG
176+
@test setUserData!(fg, Dict(ud)) == Dict(ud)
177+
@test setRobotData!(fg, Dict(rd)) == Dict(rd)
178+
@test setSessionData!(fg, Dict(sd)) == Dict(sd)
175179
@test getUserData(fg) == Dict(ud)
176180
@test getRobotData(fg) == Dict(rd)
177181
@test getSessionData(fg) == Dict(sd)

0 commit comments

Comments
 (0)