Skip to content

Commit f083192

Browse files
committed
relax compare types for NamedTuple case
1 parent 1659d71 commit f083192

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
4646
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
4747
Manifolds = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
4848
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
49+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
4950
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5051

5152
[targets]
52-
test = ["Test", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg"]
53+
test = ["Test", "GraphPlot", "LinearAlgebra", "Manifolds", "Pkg", "Statistics"]

src/services/CompareUtils.jl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,15 @@ function compareAll(Al::T,
130130
return true
131131
end
132132

133-
function compareAll(Al::T, Bl::T; show::Bool=true, skip::Vector{Symbol}=Symbol[]) where T
134-
@debug "Comparing types $T:"
133+
function compareAll(Al::T1, Bl::T2; show::Bool=true, skip::Vector{Symbol}=Symbol[]) where {T1,T2}
134+
@debug "Comparing types $T1, $T2"
135+
if T1 != T2
136+
@warn "Types are different" T1 T2
137+
end
135138
# @debug " Al = $Al"
136139
# @debug " Bl = $Bl"
137140
!compareFields(Al, Bl, show=show, skip=skip) && return false
138-
for field in fieldnames(T)
141+
for field in fieldnames(T1)
139142
field in skip && continue
140143
@debug(" Checking field: $field")
141144
(!isdefined(Al, field) && !isdefined(Al, field)) && return true
@@ -236,8 +239,14 @@ function compareFactor(A::DFGFactor,
236239
skipsamples::Bool=true,
237240
skipcompute::Bool=true )
238241
#
239-
skip_ =
240-
TP = compareAll(A, B, skip=union([:attributes;:solverData;:_variableOrderSymbols;:_gradients],skip), show=show)
242+
skip_ = union([:attributes;:solverData;:_variableOrderSymbols;:_gradients],skip)
243+
TP = compareAll(A, B, skip=skip_, show=show)
244+
# TP = compareAll(A.label, B.label, skip=skip_, show=show)
245+
# TP = compareAll(A.timestamp, B.timestamp, skip=skip_, show=show)
246+
# TP = compareAll(A.nstime, B.nstime, skip=skip_, show=show)
247+
# TP = compareAll(A.tags, B.tags, skip=skip_, show=show)
248+
# TP = compareAll(A.solvable, B.solvable, skip=skip_, show=show)
249+
# TP = compareAll(A._variableOrderSymbols, B._variableOrderSymbols, skip=skip_, show=show)
241250
# TP = TP & compareAll(A.attributes, B.attributes, skip=[:data;], show=show)
242251
TP = TP & compareAllSpecial(getSolverData(A), getSolverData(B), skip=union([:fnc;:_gradients], skip), show=show)
243252
if :fnc in skip

0 commit comments

Comments
 (0)