Skip to content

Commit 2a39d1a

Browse files
committed
Test coverage and formatting
1 parent 31afe9f commit 2a39d1a

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/GraphsDFG/FactorGraphs/FactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function rem_vertex!(g::FactorGraph{T, V, F}, v::Integer) where {T, V, F}
173173
end
174174

175175
function Graphs.rem_vertices!(g::FactorGraph{T, V, F}, vs::Vector{Int}) where {T, V, F}
176-
for v in sort(vs, rev = true)
176+
for v in sort(vs; rev = true)
177177
v in vertices(g) || continue
178178
lastv = nv(g)
179179

src/entities/Error.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ struct IdNotFoundError{T} <: Exception
5454
available::Vector{T}
5555
end
5656

57-
IdNotFoundError(name::String, id::T) where T = IdNotFoundError(name, id, T[])
58-
IdNotFoundError(id::T) where T = IdNotFoundError("Node", id, T[])
57+
IdNotFoundError(name::String, id::T) where {T} = IdNotFoundError(name, id, T[])
58+
IdNotFoundError(id::T) where {T} = IdNotFoundError("Node", id, T[])
5959

6060
function Base.showerror(io::IO, ex::IdNotFoundError)
6161
print(io, "IdNotFoundError: ", ex.name, " id '", ex.id, "' not found.")

test/testBlocks.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,20 @@ function VariablesandFactorsCRUD_SET!(fg, v1, v2, v3, f0, f1, f2)
460460
@test addVariable!(fg, v3) === v3
461461
@test addFactor!(fg, f2) === f2
462462

463-
@test deleteFactor!(fg, f2) == 1
463+
@test deleteFactors!(fg, [getLabel(f2)]) == 1
464+
@test addFactor!(fg, f2) === f2
465+
@test deleteFactors!(fg; whereLabel = ==(string(getLabel(f2)))) == 1
466+
@test deleteFactors!(fg; whereLabel = ==("doesnotexist")) == 0
467+
468+
@test addFactor!(fg, f2) === f2
469+
@test deleteVariables!(fg, [getLabel(v3)]) == 2
470+
@test addVariable!(fg, v3) === v3
471+
@test deleteVariables!(fg; whereLabel = ==(string(getLabel(v3)))) == 1
472+
@test deleteVariables!(fg; whereLabel = ==("doesnotexist")) == 0
473+
464474
@test deleteFactor!(fg, f2) == 0
465475
@test lsf(fg) == [:abf1]
466476

467-
delvarCompare = getVariable(fg, :c)
468-
delfacCompare = []
469-
ndel = deleteVariable!(fg, v3)
470-
@test ndel == 1
471-
472477
@test getVariable(fg, :a) == v1
473478

474479
@test addFactor!(fg, f0) == f0

0 commit comments

Comments
 (0)