mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
more test cases
This commit is contained in:
parent
55b6efb755
commit
c0283eee1a
|
@ -1,8 +1,6 @@
|
|||
package bounded_tree
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
@ -135,7 +133,7 @@ func (t *BoundedTree) HasVisited(p util.FullPath) bool {
|
|||
}
|
||||
|
||||
components := p.Split()
|
||||
fmt.Printf("components %v %d\n", components, len(components))
|
||||
// fmt.Printf("components %v %d\n", components, len(components))
|
||||
return t.hasVisited(t.root, util.FullPath("/"), components, 0)
|
||||
}
|
||||
|
||||
|
@ -149,7 +147,7 @@ func (t *BoundedTree) hasVisited(n *Node, currentPath util.FullPath, components
|
|||
return false
|
||||
}
|
||||
|
||||
fmt.Printf(" hasVisited child %v %+v %d\n", currentPath, components, i)
|
||||
// fmt.Printf(" hasVisited child %v %+v %d\n", currentPath, components, i)
|
||||
|
||||
if i >= len(components) {
|
||||
return true
|
||||
|
|
|
@ -62,6 +62,15 @@ func TestBoundedTree(t *testing.T) {
|
|||
tree.EnsureVisited(util.FullPath("/a/b/c"), visitFn)
|
||||
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/a/b")))
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/a/b/c")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/c/d")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/e")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/f")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/g")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/h")))
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/")))
|
||||
assert.Equal(t, true, tree.HasVisited(util.FullPath("/x")))
|
||||
assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/e/x")))
|
||||
|
||||
printMap(tree.root.Children)
|
||||
|
||||
|
|
Loading…
Reference in a new issue