Skip to content

Commit b123fb8

Browse files
authored
Merge pull request #789 from JuliaRobotics/21Q3/test/getpointidentity
test getPointIdentity
2 parents 54c1289 + 8659383 commit b123fb8

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/services/Serialization.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,12 @@ function packFactor(dfg::G, f::DFGFactor)::Dict{String, Any} where G <: Abstract
315315
end
316316

317317
function decodePackedType(::Type{T}, packeddata::GenericFunctionNodeData{PT}) where {T<:FactorOperationalMemory, PT}
318-
# usrtyp = convert(FunctorInferenceType, packeddata.fnc)
319-
# Also look at parentmodule
320-
usrtyp = convertStructType(PT)
321-
fulltype = DFG.FunctionNodeData{T{usrtyp}}
322-
factordata = convert(fulltype, packeddata)
323-
return factordata
318+
# usrtyp = convert(FunctorInferenceType, packeddata.fnc)
319+
# Also look at parentmodule
320+
usrtyp = convertStructType(PT)
321+
fulltype = DFG.FunctionNodeData{T{usrtyp}}
322+
factordata = convert(fulltype, packeddata)
323+
return factordata
324324
end
325325

326326

test/test_defVariable.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ struct NotAManifold end
2525

2626
@test getPointType(TestVarType1) == Vector{Float64}
2727
@test getPointType(TestVarType2) == ProductRepr{Tuple{Vector{Float64}, Matrix{Float64}}}
28+
29+
@test getPointIdentity(TestVarType1) == zeros(3)
30+
@test getPointIdentity(TestVarType2).parts[1] == ProductRepr(zeros(3), diagm(ones(3))).parts[1]
31+
@test getPointIdentity(TestVarType2).parts[2] == ProductRepr(zeros(3), diagm(ones(3))).parts[2]
32+
2833
##
2934

3035

@@ -37,4 +42,8 @@ struct NotAManifold end
3742
@test getPointType(TestVarType1()) == Vector{Float64}
3843
@test getPointType(TestVarType2()) == ProductRepr{Tuple{Vector{Float64}, Matrix{Float64}}}
3944

45+
@test getPointIdentity(TestVarType1()) == zeros(3)
46+
@test getPointIdentity(TestVarType2()).parts[1] == ProductRepr(zeros(3), diagm(ones(3))).parts[1]
47+
@test getPointIdentity(TestVarType2()).parts[2] == ProductRepr(zeros(3), diagm(ones(3))).parts[2]
48+
4049
end

0 commit comments

Comments
 (0)