graph/iterator: extend iteration tests and fix counting error

This commit is contained in:
Dan Kortschak
2020-06-07 08:03:22 +09:30
parent 16da37cc66
commit 2db33926ac
2 changed files with 7 additions and 4 deletions

View File

@@ -24,10 +24,7 @@ func (n *OrderedNodes) Len() int {
if n.idx >= len(n.nodes) {
return 0
}
if n.idx <= 0 {
return len(n.nodes)
}
return len(n.nodes[n.idx:])
return len(n.nodes[n.idx+1:])
}
// Next returns whether the next call of Node will return a valid node.