Skip to content

Commit 03d3b38

Browse files
committed
bug fixes and testing
1 parent 92bb6bc commit 03d3b38

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

src/DFGPlots/DFGPlots.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module DFGPlots
22

33
using Colors
44
using LightGraphs
5-
using GraphPlot
5+
using ..GraphPlot
66
using DocStringExtensions
7-
import GraphPlot: gplot
7+
import ..GraphPlot: gplot
88

99
using ...DistributedFactorGraphs
1010

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ function __init__()
317317
@warn("BREAKING CHANGE coming to DistributedFactorGraphs v0.12: deprecating AbstractRelativeFactorMinimize, use AbstractRelativeMinimize instead")
318318

319319
@require GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231" begin
320-
@info "Including Plots"
320+
@info "DistributedFactorGraphs.jl is adding tools using GraphPlot.jl"
321321
include("DFGPlots/DFGPlots.jl")
322322
@reexport using .DFGPlots
323323
end

test/interfaceTests.jl

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,27 @@ end
5959

6060
iobuf = IOBuffer()
6161
# for now just test the interface and a bit of output
62-
@test printVariable(var1) == nothing
63-
@test printFactor(fac1) == nothing
62+
@test printVariable(var1) === nothing
63+
@test printFactor(fac1) === nothing
6464

65-
@test printVariable(iobuf, var1, skipfields=[:timestamp, :solver, :ppe, :nstime]) == nothing
65+
@test printVariable(iobuf, var1, skipfields=[:timestamp, :solver, :ppe, :nstime]) === nothing
6666
@test String(take!(iobuf)) == "DFGVariable{TestSofttype1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol,Union{Bool, Float64, Int64, Array{Bool,1}, Array{Float64,1}, Array{Int64,1}, Array{String,1}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol,AbstractDataEntry}()\nsolvable:\n0\n"
6767

68-
@test printVariable(iobuf, var1, short=true) == nothing
69-
@test String(take!(iobuf)) == "DFGVariable{TestSofttype1}\nlabel: a\ntags: Set([:VARIABLE, :POSE])\nsize marginal samples: (1, 1)\nkde bandwidths: [0.0]\nNo PPEs\n"
68+
@test printVariable(iobuf, var1, short=true) === nothing
69+
varstr = String(take!(iobuf))
70+
@test occursin(r"DFGVariable", varstr)
71+
@test occursin(r"timestamp", varstr)
72+
@test occursin(r"label", varstr)
73+
@test occursin(r"bandwidths", varstr)
74+
# == "DFGVariable{TestSofttype1}\nlabel: a\ntags: Set([:VARIABLE, :POSE])\nsize marginal samples: (1, 1)\nkde bandwidths: [0.0]\nNo PPEs\n"
7075

7176

72-
@test printFactor(iobuf, fac1, skipfields=[:timestamp, :solver, :nstime]) == nothing
77+
@test printFactor(iobuf, fac1, skipfields=[:timestamp, :solver, :nstime]) === nothing
7378
@test occursin(r"DFGFactor.*\nlabel:\n:abf1", String(take!(iobuf)))
7479

7580
String(take!(iobuf)) == "DFGFactor{TestCCW{TestFunctorInferenceType1}}\nlabel:\n:abf1\ntags:\nSet([:tag1, :tag2])\nsolvable:\n0\nsolvable:\n1\n_variableOrderSymbols:\n[:a, :b]\n"
7681

77-
@test printFactor(iobuf, fac1, short=true) == nothing
82+
@test printFactor(iobuf, fac1, short=true) === nothing
7883
@show teststr = String(take!(iobuf))
7984
@test occursin(r"DFGFactor", teststr)
8085
@test occursin(r"label", teststr)
@@ -84,19 +89,19 @@ end
8489

8590
# s = String(take!(iobuf))
8691

87-
@test show(var1) == nothing
88-
@test show(fac1) == nothing
92+
@test show(var1) === nothing
93+
@test show(fac1) === nothing
8994

90-
@test show(iobuf, MIME("text/plain"), var1) == nothing
95+
@test show(iobuf, MIME("text/plain"), var1) === nothing
9196
isapprox(length(take!(iobuf)), 452, atol=10)
92-
@test show(iobuf, MIME("text/plain"), fac1) == nothing
97+
@test show(iobuf, MIME("text/plain"), fac1) === nothing
9398
isapprox(length(take!(iobuf)), 301, atol=10)
9499

95-
@test printVariable(fg1, :a) == nothing
96-
@test printFactor(fg1, :abf1) == nothing
100+
@test printVariable(fg1, :a) === nothing
101+
@test printFactor(fg1, :abf1) === nothing
97102

98-
@test printNode(fg1, :a) == nothing
99-
@test printNode(fg1, :abf1) == nothing
103+
@test printNode(fg1, :a) === nothing
104+
@test printNode(fg1, :abf1) === nothing
100105

101106
show(stdout, MIME("application/prs.juno.inline"), var1) == var1
102107
show(stdout, MIME("application/prs.juno.inline"), fac1) == fac1

test/testBlocks.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,18 @@ function VariablesandFactorsCRUD_SET!(fg, v1, v2, v3, f0, f1, f2)
397397
@test addVariable!(fg, v1) == v1
398398
@test addVariable!(fg, v2) == v2
399399

400+
# test getindex
401+
@test getLabel(fg[getLabel(v1)]) == getLabel(v1)
402+
400403
#TODO standardize this error and res also for that matter
401404
@test_throws Exception addFactor!(fg, [:a, :nope], f1)
402405
@test_throws Exception addFactor!(fg, [v1, v2, v3], f1)
403406

404407
@test addFactor!(fg, [v1, v2], f1) == f1
405408
@test_throws ErrorException addFactor!(fg, [v1, v2], f1)
406409

410+
@test getLabel(fg[getLabel(f1)]) == getLabel(f1)
411+
407412
@test @test_logs (:warn, Regex("'$(v3.label)' does not exist")) match_mode=:any updateVariable!(fg, v3) == v3
408413
@test updateVariable!(fg, v3) == v3
409414
@test_throws ErrorException addVariable!(fg, v3)

0 commit comments

Comments
 (0)