Skip to content

Commit c45ba31

Browse files
committed
Fix tests
1 parent 3d6c96d commit c45ba31

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

src/services/CompareUtils.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ const GeneratedCompareUnion = Union{
3030
FactorDFG,
3131
FactorSummary,
3232
FactorSkeleton,
33+
FactorState,
3334
}
3435

3536
@generated function ==(x::T, y::T) where {T <: GeneratedCompareUnion}
36-
ignored = []
37+
ignored = [:computeMem]
3738
return mapreduce(
3839
n -> :(x.$n == y.$n),
3940
(a, b) -> :($a && $b),
@@ -315,7 +316,17 @@ function compareFactor(
315316
skipcompute::Bool = true,
316317
)
317318
#
318-
skip_ = union([:attributes; :solverData; :_variableOrderSymbols; :_gradients], skip)
319+
skip_ = union(
320+
[
321+
:attributes,
322+
:solverData,
323+
:observation,
324+
:computeMem,
325+
:_variableOrderSymbols,
326+
:_gradients,
327+
],
328+
skip,
329+
)
319330
TP = compareAll(A, B; skip = skip_, show = show)
320331
@debug "compareFactor 1/5" TP
321332
TP =

src/services/DFGFactor.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Return user factor type from factor graph identified by label `::Symbol`.
3232
Notes
3333
- Replaces older `getfnctype`.
3434
"""
35-
getFactorType(data::GenericFunctionNodeData) = data.fnc.usrfnc!
35+
getFactorType(data::GenericFunctionNodeData{<:FactorOperationalMemory}) = data.fnc.usrfnc!
36+
getFactorType(data::GenericFunctionNodeData{<:AbstractFactor}) = data.fnc
3637
getFactorType(fct::FactorCompute) = getFactorType(getSolverData(fct))
3738
getFactorType(f::FactorDFG) = getTypeFromSerializationModule(f.fnctype)() # TODO find a better way to do this that does not rely on empty constructor
3839
getFactorType(dfg::AbstractDFG, lbl::Symbol) = getFactorType(getFactor(dfg, lbl))

test/plottingTest.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ map(v -> addVariable!(dfg, v), verts)
1717
map(
1818
n -> addFactor!(
1919
dfg,
20-
FactorCompute{TestFunctorInferenceType1}(
20+
FactorCompute(
2121
Symbol("x$(n)x$(n+1)f1"),
2222
[verts[n].label, verts[n + 1].label],
23+
GenericFunctionNodeData(; fnc=TestFunctorInferenceType1())
2324
),
2425
),
2526
1:(numNodes - 1),

test/testBlocks.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,13 @@ function DFGFactorSCA()
395395

396396
gfnd = GenericFunctionNodeData(; fnc = TestCCW(TestFunctorInferenceType1()))
397397

398-
f1 = FactorCompute{TestCCW{TestFunctorInferenceType1}}(f1_lbl, [:a, :b])
399398
f1 = FactorCompute(f1_lbl, [:a, :b], gfnd; tags = f1_tags, solvable = 0)
400399

401-
f2 = FactorCompute{TestCCW{TestFunctorInferenceType1}}(
400+
f2 = FactorCompute(
402401
:bcf1,
403402
[:b, :c],
404-
ZonedDateTime("2020-08-11T00:12:03.000-05:00"),
403+
GenericFunctionNodeData(; fnc=TestCCW{TestFunctorInferenceType1}());
404+
timestamp = ZonedDateTime("2020-08-11T00:12:03.000-05:00"),
405405
)
406406
#TODO add tests for mutating vos in updateFactor and orphan related checks.
407407
# we should perhaps prevent an empty vos
@@ -473,7 +473,7 @@ function VariablesandFactorsCRUD_SET!(fg, v1, v2, v3, f0, f1, f2)
473473
@test getLabel(fg[getLabel(v1)]) == getLabel(v1)
474474

475475
#TODO standardize this error and res also for that matter
476-
fnope = FactorCompute{TestCCW{TestFunctorInferenceType1}}(:broken, [:a, :nope])
476+
fnope = FactorCompute(:broken, [:a, :nope], GenericFunctionNodeData(; fnc=TestCCW{TestFunctorInferenceType1}()))
477477
@test_throws KeyError addFactor!(fg, fnope)
478478

479479
@test addFactor!(fg, f1) == f1
@@ -1683,7 +1683,7 @@ function ProducingDotFiles(
16831683
end
16841684
if f1 === nothing
16851685
if (FACTYPE == FactorCompute)
1686-
f1 = FactorCompute{TestFunctorInferenceType1}(:abf1, [:a, :b])
1686+
f1 = FactorCompute(:abf1, [:a, :b], GenericFunctionNodeData(;fnc = TestFunctorInferenceType1()))
16871687
else
16881688
f1 = FACTYPE(:abf1, [:a, :b])
16891689
end

0 commit comments

Comments
 (0)