Skip to content

Commit 2aa3c40

Browse files
committed
Lets try that again with the tests included
1 parent b7b8b27 commit 2aa3c40

File tree

6 files changed

+103
-104
lines changed

6 files changed

+103
-104
lines changed

Project.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ JSON2 = "2535ab7d-5cd8-5a07-80ac-9b1792aadce3"
1313
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
1414
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1515
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
16+
Neo4j = "d2adbeaf-5838-5367-8a2f-e46d570981db"
1617
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1718
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1819
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
@@ -22,15 +23,15 @@ Distributions = "≥ 0.18"
2223
DocStringExtensions = "≥ 0.7"
2324
Graphs = "≥ 0.10.3"
2425
MetaGraphs = "≥ 0.6.4"
26+
Neo4j = "≥ 2.0.0"
2527
Reexport = "≥ 0.2"
2628
Requires = "≥ 0.5"
2729
julia = "0.7, 1"
2830

2931
[extras]
3032
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3133
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
32-
Neo4j = "d2adbeaf-5838-5367-8a2f-e46d570981db"
3334
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
3435

3536
[targets]
36-
test = ["Test", "GraphPlot", "Neo4j", "Pkg"]
37+
test = ["Test", "GraphPlot", "Pkg"]

src/CloudGraphsDFG/CloudGraphsDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export getAddHistory, getDescription, getLabelDict
1818
export addVariable!, addFactor!
1919
export ls, lsf, getVariables, getFactors, getVariableIds, getFactorIds
2020
export getVariable, getFactor
21-
export updateVariable!, updateFactor!, mergeUpdateVariableSolverData!
21+
export updateVariable!, updateFactor!, updateVariableSolverData!
2222
export deleteVariable!, deleteFactor!
2323
export getAdjacencyMatrix
2424
export getNeighbors

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ end
318318
$(SIGNATURES)
319319
Update solver and estimate data for a variable (variable can be from another graph).
320320
"""
321-
function mergeUpdateVariableSolverData!(dfg::CloudGraphsDFG, sourceVariable::DFGVariable)::DFGVariable
321+
function updateVariableSolverData!(dfg::CloudGraphsDFG, sourceVariable::DFGVariable)::DFGVariable
322322
if !exists(dfg, sourceVariable)
323323
error("Source variable '$(sourceVariable.label)' doesn't exist in the graph.")
324324
end

src/DistributedFactorGraphs.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,9 @@ using .SymbolDFGs
6666
include("LightDFG/LightDFG.jl")
6767
@reexport using .LightDFGs
6868

69-
function __init__()
70-
@require Neo4j="d2adbeaf-5838-5367-8a2f-e46d570981db" begin
71-
# Include the Cloudgraphs API
72-
include("CloudGraphsDFG/CloudGraphsDFG.jl")
73-
end
69+
include("CloudGraphsDFG/CloudGraphsDFG.jl")
7470

71+
function __init__()
7572
@require GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231" begin
7673
include("DFGPlots/DFGPlots.jl")
7774
@reexport using .DFGPlots

test/iifInterfaceTests.jl

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -169,65 +169,66 @@ end
169169

170170
# Session, robot, and user small data tests
171171
# NOTE: CloudGraphDFG isnt supporting this yet.
172-
if !(typeof(dfg) <: CloudGraphsDFG)
173-
smallUserData = Dict{Symbol, String}(:a => "42", :b => "Hello")
174-
smallRobotData = Dict{Symbol, String}(:a => "43", :b => "Hello")
175-
smallSessionData = Dict{Symbol, String}(:a => "44", :b => "Hello")
176-
setUserData(dfg, deepcopy(smallUserData))
177-
setRobotData(dfg, deepcopy(smallRobotData))
178-
setSessionData(dfg, deepcopy(smallSessionData))
179-
@test getUserData(dfg) == smallUserData
180-
@test getRobotData(dfg) == smallRobotData
181-
@test getSessionData(dfg) == smallSessionData
182-
end
172+
# NOTE: Only available in v0.5
173+
# if !(typeof(dfg) <: CloudGraphsDFG)
174+
# smallUserData = Dict{Symbol, String}(:a => "42", :b => "Hello")
175+
# smallRobotData = Dict{Symbol, String}(:a => "43", :b => "Hello")
176+
# smallSessionData = Dict{Symbol, String}(:a => "44", :b => "Hello")
177+
# setUserData(dfg, deepcopy(smallUserData))
178+
# setRobotData(dfg, deepcopy(smallRobotData))
179+
# setSessionData(dfg, deepcopy(smallSessionData))
180+
# @test getUserData(dfg) == smallUserData
181+
# @test getRobotData(dfg) == smallRobotData
182+
# @test getSessionData(dfg) == smallSessionData
183+
# end
183184
end
184185

185-
@testset "BigData" begin
186-
# NOTE: CloudGraphDFG isnt supporting this yet.
187-
if !(typeof(dfg) <: CloudGraphsDFG)
188-
oid = zeros(UInt8,12); oid[12] = 0x01
189-
de1 = MongodbBigDataEntry(:key1, NTuple{12,UInt8}(oid))
190-
191-
oid = zeros(UInt8,12); oid[12] = 0x02
192-
de2 = MongodbBigDataEntry(:key2, NTuple{12,UInt8}(oid))
193-
194-
oid = zeros(UInt8,12); oid[12] = 0x03
195-
de2_update = MongodbBigDataEntry(:key2, NTuple{12,UInt8}(oid))
196-
197-
#add
198-
v1 = getVariable(dfg, :a)
199-
@test addBigDataEntry!(v1, de1)
200-
@test addBigDataEntry!(dfg, :a, de2)
201-
@test addBigDataEntry!(v1, de1)
202-
203-
#get
204-
@test deepcopy(de1) == getBigDataEntry(v1, :key1)
205-
@test deepcopy(de2) == getBigDataEntry(dfg, :a, :key2)
206-
@test_throws Any getBigDataEntry(v2, :key1)
207-
@test_throws Any getBigDataEntry(dfg, :b, :key1)
208-
209-
#update
210-
@test updateBigDataEntry!(dfg, :a, de2_update)
211-
@test deepcopy(de2_update) == getBigDataEntry(dfg, :a, :key2)
212-
@test !updateBigDataEntry!(dfg, :b, de2_update)
213-
214-
#list
215-
entries = getBigDataEntries(dfg, :a)
216-
@test length(entries) == 2
217-
@test symdiff(map(e->e.key, entries), [:key1, :key2]) == Symbol[]
218-
@test length(getBigDataEntries(dfg, :b)) == 0
219-
220-
@test symdiff(getBigDataKeys(dfg, :a), [:key1, :key2]) == Symbol[]
221-
@test getBigDataKeys(dfg, :b) == Symbol[]
222-
223-
#delete
224-
@test deepcopy(de1) == deleteBigDataEntry!(v1, :key1)
225-
@test getBigDataKeys(v1) == Symbol[:key2]
226-
#delete from dfg
227-
@test deepcopy(de2_update) == deleteBigDataEntry!(dfg, :a, :key2)
228-
@test getBigDataKeys(v1) == Symbol[]
229-
end
230-
end
186+
# @testset "BigData" begin
187+
# # NOTE: CloudGraphDFG isnt supporting this yet.
188+
# if !(typeof(dfg) <: CloudGraphsDFG)
189+
# oid = zeros(UInt8,12); oid[12] = 0x01
190+
# de1 = MongodbBigDataEntry(:key1, NTuple{12,UInt8}(oid))
191+
#
192+
# oid = zeros(UInt8,12); oid[12] = 0x02
193+
# de2 = MongodbBigDataEntry(:key2, NTuple{12,UInt8}(oid))
194+
#
195+
# oid = zeros(UInt8,12); oid[12] = 0x03
196+
# de2_update = MongodbBigDataEntry(:key2, NTuple{12,UInt8}(oid))
197+
#
198+
# #add
199+
# v1 = getVariable(dfg, :a)
200+
# @test addBigDataEntry!(v1, de1)
201+
# @test addBigDataEntry!(dfg, :a, de2)
202+
# @test addBigDataEntry!(v1, de1)
203+
#
204+
# #get
205+
# @test deepcopy(de1) == getBigDataEntry(v1, :key1)
206+
# @test deepcopy(de2) == getBigDataEntry(dfg, :a, :key2)
207+
# @test_throws Any getBigDataEntry(v2, :key1)
208+
# @test_throws Any getBigDataEntry(dfg, :b, :key1)
209+
#
210+
# #update
211+
# @test updateBigDataEntry!(dfg, :a, de2_update)
212+
# @test deepcopy(de2_update) == getBigDataEntry(dfg, :a, :key2)
213+
# @test !updateBigDataEntry!(dfg, :b, de2_update)
214+
#
215+
# #list
216+
# entries = getBigDataEntries(dfg, :a)
217+
# @test length(entries) == 2
218+
# @test symdiff(map(e->e.key, entries), [:key1, :key2]) == Symbol[]
219+
# @test length(getBigDataEntries(dfg, :b)) == 0
220+
#
221+
# @test symdiff(getBigDataKeys(dfg, :a), [:key1, :key2]) == Symbol[]
222+
# @test getBigDataKeys(dfg, :b) == Symbol[]
223+
#
224+
# #delete
225+
# @test deepcopy(de1) == deleteBigDataEntry!(v1, :key1)
226+
# @test getBigDataKeys(v1) == Symbol[:key2]
227+
# #delete from dfg
228+
# @test deepcopy(de2_update) == deleteBigDataEntry!(dfg, :a, :key2)
229+
# @test getBigDataKeys(v1) == Symbol[]
230+
# end
231+
# end
231232

232233
@testset "Updating Nodes and Estimates" begin
233234
global dfg
@@ -240,7 +241,7 @@ end
240241
:mean => VariableEstimate(:default, :mean, [50.0]),
241242
:modefit => VariableEstimate(:default, :modefit, [75.0]))
242243
#update
243-
mergeUpdateVariableSolverData!(dfg, newvar)
244+
updateVariableSolverData!(dfg, newvar)
244245

245246
#Check if variable is updated
246247
var = getVariable(dfg, :a)
@@ -255,7 +256,7 @@ end
255256
# Confirm they're different
256257
@test estimates(newvar) != estimates(var)
257258
# Persist it.
258-
mergeUpdateVariableSolverData!(dfg, newvar)
259+
updateVariableSolverData!(dfg, newvar)
259260
# Get the latest
260261
var = getVariable(dfg, :a)
261262
@test symdiff(collect(keys(estimates(var))), [:default, :second]) == Symbol[]
@@ -269,7 +270,7 @@ end
269270
#confirm delete
270271
@test symdiff(collect(keys(estimates(newvar))), [:second]) == Symbol[]
271272
# Persist it.
272-
mergeUpdateVariableSolverData!(dfg, newvar)
273+
updateVariableSolverData!(dfg, newvar)
273274

274275
# Get the latest and confirm they're the same, :second
275276
var = getVariable(dfg, :a)

test/runtests.jl

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,38 @@ using Pkg
1212

1313
# Test each interface
1414
# Still test LightDFG and MetaGraphsDFG for the moment until we remove in 0.4.2
15-
# apis = [
16-
# GraphsDFG,
17-
# DistributedFactorGraphs.MetaGraphsDFG,
18-
# DistributedFactorGraphs.SymbolDFG,
19-
# LightDFG]
20-
# for api in apis
21-
# @testset "Testing Driver: $(api)" begin
22-
# @info "Testing Driver: $(api)"
23-
# global testDFGAPI = api
24-
# include("interfaceTests.jl")
25-
# end
26-
# end
27-
#
28-
# # Test that we don't export LightDFG and MetaGraphsDFG
29-
# @testset "Deprecated Drivers Test" begin
30-
# @test_throws UndefVarError SymbolDFG{NoSolverParams}()
31-
# @test_throws UndefVarError MetaGraphsDFG{NoSolverParams}()
32-
# end
33-
#
34-
# # Test special cases
35-
#
36-
# @testset "Plotting Tests" begin
37-
# include("plottingTest.jl")
38-
# end
39-
#
40-
# @testset "SummaryDFG test" begin
41-
# @info "Testing LightDFG Variable and Factor Subtypes"
42-
# include("LightDFGSummaryTypes.jl")
43-
# end
15+
apis = [
16+
GraphsDFG,
17+
DistributedFactorGraphs.MetaGraphsDFG,
18+
DistributedFactorGraphs.SymbolDFG,
19+
LightDFG]
20+
for api in apis
21+
@testset "Testing Driver: $(api)" begin
22+
@info "Testing Driver: $(api)"
23+
global testDFGAPI = api
24+
include("interfaceTests.jl")
25+
end
26+
end
27+
28+
# Test that we don't export LightDFG and MetaGraphsDFG
29+
@testset "Deprecated Drivers Test" begin
30+
@test_throws UndefVarError SymbolDFG{NoSolverParams}()
31+
@test_throws UndefVarError MetaGraphsDFG{NoSolverParams}()
32+
end
33+
34+
# Test special cases
35+
36+
@testset "Plotting Tests" begin
37+
include("plottingTest.jl")
38+
end
39+
40+
@testset "SummaryDFG test" begin
41+
@info "Testing LightDFG Variable and Factor Subtypes"
42+
include("LightDFGSummaryTypes.jl")
43+
end
4444

4545

46-
# if get(ENV, "IIF_TEST", "") == "true"
46+
if get(ENV, "IIF_TEST", "") == "true"
4747

4848
Pkg.add("IncrementalInference")
4949
@info "------------------------------------------------------------------------"
@@ -53,8 +53,8 @@ using Pkg
5353
using IncrementalInference
5454

5555
apis = [
56-
# GraphsDFG{NoSolverParams}(),
57-
# LightDFG{NoSolverParams}(),
56+
GraphsDFG{NoSolverParams}(),
57+
LightDFG{NoSolverParams}(),
5858
# DistributedFactorGraphs.MetaGraphsDFG{NoSolverParams}(),
5959
# DistributedFactorGraphs.SymbolDFG{NoSolverParams}(),
6060
CloudGraphsDFG{SolverParams}("localhost", 7474, "neo4j", "test",
@@ -72,6 +72,6 @@ using Pkg
7272
include("iifInterfaceTests.jl")
7373
end
7474
end
75-
# else
76-
# @warn "Skipping IncrementalInference driver tests"
77-
# end
75+
else
76+
@warn "Skipping IncrementalInference driver tests"
77+
end

0 commit comments

Comments
 (0)