Skip to content

Commit cb69b73

Browse files
committed
WIP, just need to fix comparator
1 parent f1cd474 commit cb69b73

File tree

5 files changed

+58
-54
lines changed

5 files changed

+58
-54
lines changed

src/CommonAccessors.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
export getLabel, label
66
export getTags, setTags!, tags
77
export getTimestamp, setTimestamp!, timestamp
8-
export getInternalId, interalId
8+
export getInternalId, internalId
99

1010

1111
const DataLevel0 = Union{VariableDataLevel0, FactorDataLevel0}
@@ -50,15 +50,18 @@ DEPRECATED, tags -> getTags
5050
"""
5151
function tags(v::DataLevel0)
5252
@warn "tags deprecated, use getTags instead"
53-
getTags
53+
getTags(v)
5454
end
5555

5656
"""
5757
$SIGNATURES
5858
5959
Set the tags for a factor.
6060
"""
61-
setTags!(f::DataLevel0, tags::Vector{Symbol}) = f.tags = tags
61+
function setTags!(f::DataLevel0, tags::Vector{Symbol})
62+
resize!(f.tags, length(tags))
63+
f.tags .= tags
64+
end
6265

6366

6467
"""

src/entities/DFGVariable.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,21 @@ end
248248
"""
249249
$SIGNATURES
250250
251-
Retrieve the soft type name symbol for a DFGVariable or DFGVariableSummary. ie :Point2, Pose2, etc.
252-
251+
Retrieve the soft type name symbol for a DFGVariableSummary. ie :Point2, Pose2, etc.
253252
TODO, DO NOT USE v.softtypename in DFGVariableSummary
254253
"""
255-
getSofttype(v::DFGVariableSummary) = v.softtypename
254+
getSofttype(v::DFGVariableSummary)::Symbol = v.softtypename
256255

257256

258257

259258
"""
260259
$SIGNATURES
261260
262-
Return the softtype name for a variable.
261+
Return the softtype for a variable.
263262
264263
DEPRECATED, softtype -> getSofttype
265264
"""
266-
function softtype(v::VariableDataLevel1)::Symbol
265+
function softtype(v::VariableDataLevel1)
267266
@warn "Deprecated softtype, use getSofttype instead."
268267
getSofttype(v)
269268
end

test/iifInterfaceTests.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ end
160160
@test solverDataDict(v1) == v1.solverDataDict
161161
@test internalId(v1) == v1._internalId
162162

163-
@test softtype(v1) == :ContinuousScalar#Symbol(typeof(st1))
164-
@test softtype(v2) == :ContinuousScalar#Symbol(typeof(st2))
165-
@test typeof(getSofttype(v1)) == typeof(ContinuousScalar())
163+
@test typeof(softtype(v1)) == ContinuousScalar
164+
@test typeof(softtype(v2)) == ContinuousScalar
165+
@test typeof(getSofttype(v1)) == ContinuousScalar
166166

167167
@test label(f1) == f1.label
168168
@test tags(f1) == f1.tags
@@ -441,9 +441,10 @@ end
441441
for v in ls(summaryGraph)
442442
for field in variableFields
443443
if field != :softtypename
444-
@test getfield(getVariable(dfg, v), field) == getfield(getVariable(summaryGraph, v), field)
444+
@test getfield(getVariable(dfg, v), field) == getfield(getVariable(summaryGraph, v), field)
445445
else
446-
@test softtype(getVariable(dfg, v)) == softtype(getVariable(summaryGraph, v))
446+
# Special case to check the symbol softtype is equal to the full softtype.
447+
@test Symbol(typeof(softtype(getVariable(dfg, v)))) == softtype(getVariable(summaryGraph, v))
447448
end
448449
end
449450
end

test/interfaceTests.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ end
161161
@test solverDataDict(v1) == v1.solverDataDict
162162
@test internalId(v1) == v1._internalId
163163

164-
@test softtype(v1) == Symbol(typeof(st1))
165-
@test softtype(v2) == Symbol(typeof(st2))
164+
@test softtype(v1) == st1
165+
@test softtype(v2) == st2
166166
@test getSofttype(v1) == st1
167167

168168
@test label(f1) == f1.label
@@ -446,7 +446,8 @@ end
446446
if field != :softtypename
447447
@test getfield(getVariable(dfg, v), field) == getfield(getVariable(summaryGraph, v), field)
448448
else
449-
@test softtype(getVariable(dfg, v)) == softtype(getVariable(summaryGraph, v))
449+
# Special case to check the symbol softtype is equal to the full softtype.
450+
@test Symbol(typeof(softtype(getVariable(dfg, v)))) == softtype(getVariable(summaryGraph, v))
450451
end
451452
end
452453
end

test/runtests.jl

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,44 @@ using Dates
1717
# global_logger(logger)
1818

1919
# Test each interface
20-
apis = [
21-
GraphsDFG,
22-
DistributedFactorGraphs.SymbolDFG,
23-
LightDFG
24-
]
25-
for api in apis
26-
@testset "Testing Driver: $(api)" begin
27-
@info "Testing Driver: $(api)"
28-
global testDFGAPI = api
29-
include("interfaceTests.jl")
30-
end
31-
end
32-
33-
@testset "Deprecated Drivers Test" begin
34-
@test_throws UndefVarError SymbolDFG{NoSolverParams}()
35-
end
36-
37-
# Test special cases
38-
39-
@testset "Plotting Tests" begin
40-
include("plottingTest.jl")
41-
end
42-
43-
@testset "Data Store Tests" begin
44-
include("DataStoreTests.jl")
45-
end
46-
47-
48-
@testset "LightDFG subtype tests" begin
49-
for type in [(var=DFGVariableSummary, fac=DFGFactorSummary), (var=SkeletonDFGVariable,fac=SkeletonDFGFactor)]
50-
@testset "$(type.var) and $(type.fac) tests" begin
51-
@info "Testing $(type.var) and $(type.fac)"
52-
global VARTYPE = type.var
53-
global FACTYPE = type.fac
54-
include("LightDFGSummaryTypes.jl")
55-
end
56-
end
57-
end
20+
# apis = [
21+
# GraphsDFG,
22+
# DistributedFactorGraphs.SymbolDFG,
23+
# LightDFG
24+
# ]
25+
# for api in apis
26+
# @testset "Testing Driver: $(api)" begin
27+
# @info "Testing Driver: $(api)"
28+
# global testDFGAPI = api
29+
# include("interfaceTests.jl")
30+
# end
31+
# end
32+
#
33+
# @testset "Deprecated Drivers Test" begin
34+
# @test_throws UndefVarError SymbolDFG{NoSolverParams}()
35+
# end
36+
#
37+
# # Test special cases
38+
#
39+
# @testset "Plotting Tests" begin
40+
# include("plottingTest.jl")
41+
# end
42+
#
43+
# @testset "Data Store Tests" begin
44+
# include("DataStoreTests.jl")
45+
# end
46+
#
47+
#
48+
# @testset "LightDFG subtype tests" begin
49+
# for type in [(var=DFGVariableSummary, fac=DFGFactorSummary), (var=SkeletonDFGVariable,fac=SkeletonDFGFactor)]
50+
# @testset "$(type.var) and $(type.fac) tests" begin
51+
# @info "Testing $(type.var) and $(type.fac)"
52+
# global VARTYPE = type.var
53+
# global FACTYPE = type.fac
54+
# include("LightDFGSummaryTypes.jl")
55+
# end
56+
# end
57+
# end
5858

5959
if get(ENV, "IIF_TEST", "") == "true"
6060

0 commit comments

Comments
 (0)