470 lines
8.5 KiB
Go
470 lines
8.5 KiB
Go
package main
|
|
|
|
type testDecomposingData struct {
|
|
TreeWeighted map[string]*WeightedNode
|
|
Threshold uint16
|
|
Parts []SubTree
|
|
}
|
|
|
|
func getSmallTree() testDecomposingData {
|
|
newTree := &Node{
|
|
ID: "1.0.0.0",
|
|
Name: "/",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.0.0",
|
|
Name: "folder1",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.1.0",
|
|
Name: "folder1",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.1.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.1.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.1.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.1.2.0",
|
|
Name: "folder2",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.2.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.2.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.2.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.1.3.0",
|
|
Name: "folder3",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.3.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.3.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.3.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.2.0.0",
|
|
Name: "folder2",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.2.1.0",
|
|
Name: "folder1",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.2.1.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.1.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.1.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.2.2.0",
|
|
Name: "folder2",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.2.2.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.2.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.2.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.2.3.0",
|
|
Name: "folder3",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.2.3.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.3.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.3.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.3.0.0",
|
|
Name: "folder3",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.3.1.0",
|
|
Name: "folder1",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.3.1.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.1.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.1.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.3.2.0",
|
|
Name: "folder2",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.3.2.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.2.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.2.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
ID: "1.3.3.0",
|
|
Name: "folder3",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.3.3.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.3.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.3.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
return testDecomposingData{
|
|
TreeWeighted: newTree.WeightingTreeWithStack(),
|
|
Threshold: 200,
|
|
Parts: []SubTree{
|
|
{
|
|
path: "/folder1",
|
|
tree: &Node{
|
|
ID: "1.1.1.0",
|
|
Name: "folder1",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.1.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.1.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.1.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder1",
|
|
tree: &Node{
|
|
ID: "1.1.2.0",
|
|
Name: "folder2",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.2.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.2.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.2.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder1",
|
|
tree: &Node{
|
|
ID: "1.1.3.0",
|
|
Name: "folder3",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.3.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.3.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.1.3.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder2",
|
|
tree: &Node{
|
|
ID: "1.2.1.0",
|
|
Name: "folder1",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.2.1.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.1.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.1.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder2",
|
|
tree: &Node{
|
|
ID: "1.2.2.0",
|
|
Name: "folder2",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.2.2.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.2.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.2.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder2",
|
|
tree: &Node{
|
|
ID: "1.2.3.0",
|
|
Name: "folder3",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.2.3.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.3.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.3.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder3",
|
|
tree: &Node{
|
|
ID: "1.3.1.0",
|
|
Name: "folder1",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.3.1.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.1.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.1.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder3",
|
|
tree: &Node{
|
|
ID: "1.3.2.0",
|
|
Name: "folder2",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.3.2.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.2.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.2.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/folder3",
|
|
tree: &Node{
|
|
ID: "1.3.3.0",
|
|
Name: "folder3",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.3.3.1",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.3.2",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.3.3",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
path: "/",
|
|
tree: &Node{
|
|
ID: "1.0.0.0",
|
|
Name: "/",
|
|
Children: []*Node{
|
|
{
|
|
ID: "1.1.0.0",
|
|
Name: "folder1",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.2.0.0",
|
|
Name: "folder2",
|
|
Children: []*Node{},
|
|
},
|
|
{
|
|
ID: "1.3.0.0",
|
|
Name: "folder3",
|
|
Children: []*Node{},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|