wip
This commit is contained in:
@@ -15,11 +15,21 @@ func TestAddRemove(t *testing.T) {
|
||||
println("delete", node.protoNodeId)
|
||||
return nil
|
||||
}
|
||||
for i:=0;i<1024;i++{
|
||||
for i:=0;i<32;i++{
|
||||
println("++++++++++", i)
|
||||
tree.Add(String(fmt.Sprintf("%02d", i)), String(fmt.Sprintf("%02d", i)))
|
||||
tree.Add(String(fmt.Sprintf("%02d", i)), nil)
|
||||
printTree(tree.root, "")
|
||||
}
|
||||
|
||||
if !tree.Has(String("30")) {
|
||||
t.Errorf("lookup error")
|
||||
}
|
||||
tree.RemoveWhere(String("30"), func(value ItemValue) bool {
|
||||
return true
|
||||
})
|
||||
if tree.Has(String("30")) {
|
||||
t.Errorf("remove error")
|
||||
}
|
||||
}
|
||||
|
||||
func printTree(node *BpNode, prefix string) {
|
||||
|
||||
10
weed/util/bptree/serde.go
Normal file
10
weed/util/bptree/serde.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package bptree
|
||||
|
||||
func (protoNode *ProtoNode) ToBpTree() *BpTree {
|
||||
node := protoNode.ToBpNode()
|
||||
return &BpTree{root: node}
|
||||
}
|
||||
|
||||
func (protoNode *ProtoNode) ToBpNode() *BpNode {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user