Skip to content

Commit 952c23c

Browse files
authored
Hotfix/backendset (#82)
* hotfix backendset * updated test for fix
1 parent 55e3459 commit 952c23c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/LightGraphsDFG/services/LightGraphsDFG.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ end
331331

332332
function _isbackendset(dfg::LightGraphsDFG, idx::Int, backendset::Int)::Bool
333333
p = props(dfg.g, idx)
334-
haskey(p, :variable) && (return p[:variable].ready == backendset)
335-
haskey(p, :factor) && (return p[:factor].ready == backendset)
334+
haskey(p, :variable) && (return p[:variable].backendset == backendset)
335+
haskey(p, :factor) && (return p[:factor].backendset == backendset)
336336

337337
#TODO should this be an error?
338338
@warn "Node not a factor or variable"

test/interfaceTests.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ end
131131
numNodes = 10
132132
dfg = testDFGAPI{NoSolverParams}()
133133
verts = map(n -> DFGVariable(Symbol("x$n")), 1:numNodes)
134+
#change ready and backendset for x7,x8 for improved tests on x7x8f1
135+
verts[7].ready = 1
136+
verts[8].backendset = 1
134137
map(v -> addVariable!(dfg, v), verts)
135138
map(n -> addFactor!(dfg, [verts[n], verts[n+1]], DFGFactor{Int, :Symbol}(Symbol("x$(n)x$(n+1)f1"))), 1:(numNodes-1))
136139
# map(n -> addFactor!(dfg, [verts[n], verts[n+2]], DFGFactor(Symbol("x$(n)x$(n+2)f2"))), 1:2:(numNodes-2))
@@ -147,12 +150,15 @@ map(n -> addFactor!(dfg, [verts[n], verts[n+1]], DFGFactor{Int, :Symbol}(Symbol(
147150
@test getNeighbors(dfg, getFactor(dfg, :x1x2f1)) == ls(dfg, getFactor(dfg, :x1x2f1))
148151
@test getNeighbors(dfg, :x1x2f1) == ls(dfg, :x1x2f1)
149152

150-
# TODO @Dehann, I don't know exactly what wil be in it, so testing with 0 and 1
151153
# ready and backendset
152154
@test getNeighbors(dfg, :x5, ready=1) == Symbol[]
153155
@test getNeighbors(dfg, :x5, ready=0) == [:x4x5f1,:x5x6f1]
154156
@test getNeighbors(dfg, :x5, backendset=1) == Symbol[]
155157
@test getNeighbors(dfg, :x5, backendset=0) == [:x4x5f1,:x5x6f1]
158+
@test getNeighbors(dfg, :x7x8f1, ready=0) == [:x8]
159+
@test getNeighbors(dfg, :x7x8f1, backendset=0) == [:x7]
160+
@test getNeighbors(dfg, :x7x8f1, ready=1) == [:x7]
161+
@test getNeighbors(dfg, :x7x8f1, backendset=1) == [:x8]
156162
@test getNeighbors(dfg, verts[1], ready=0) == [:x1x2f1]
157163
@test getNeighbors(dfg, verts[1], ready=1) == Symbol[]
158164
@test getNeighbors(dfg, verts[1], backendset=0) == [:x1x2f1]

0 commit comments

Comments
 (0)