tests/weighting_n_cutting_the_tree/cutting_test_models.go

1162 lines
22 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{},
},
},
},
},
},
}
}
func getSingleNodeTree() testDecomposingData {
newTree := &Node{
ID: "1.0.0.0",
Name: "/",
Children: []*Node{},
}
return testDecomposingData{
TreeWeighted: newTree.WeightingTreeWithStack(),
Threshold: 200,
Parts: []SubTree{
{
path: "/",
tree: &Node{
ID: "1.0.0.0",
Name: "/",
Children: []*Node{},
},
},
},
}
}
func getDeepTree() testDecomposingData {
newTree := &Node{
ID: "1",
Name: "/",
Children: []*Node{
{
ID: "1.2",
Name: "folder2",
Children: []*Node{
{
ID: "1.2.3",
Name: "folder3",
Children: []*Node{
{
ID: "1.2.3.4",
Name: "folder4",
Children: []*Node{
{
ID: "1.2.3.4.5",
Name: "folder5",
Children: []*Node{
{
ID: "1.2.3.4.5.6",
Name: "folder6",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7",
Name: "folder7",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7.8",
Name: "folder8",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7.8.9",
Name: "folder9",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7.8.9.0",
Name: "folder0",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7.8.9.0.A",
Name: "folderA",
Children: []*Node{},
},
},
},
},
},
},
},
},
},
},
},
},
},
},
},
},
},
},
},
},
}
return testDecomposingData{
TreeWeighted: newTree.WeightingTreeWithStack(),
Threshold: 200,
Parts: []SubTree{
{
path: "/folder2/folder3/folder4/folder5/folder6/folder7/folder8",
tree: &Node{
ID: "1.2.3.4.5.6.7.8.9",
Name: "folder9",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7.8.9.0",
Name: "folder0",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7.8.9.0.A",
Name: "folderA",
Children: []*Node{},
},
},
},
},
},
},
{
path: "/folder2/folder3/folder4/folder5",
tree: &Node{
ID: "1.2.3.4.5.6",
Name: "folder6",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7",
Name: "folder7",
Children: []*Node{
{
ID: "1.2.3.4.5.6.7.8",
Name: "folder8",
Children: []*Node{},
},
},
},
},
},
},
{
path: "/",
tree: &Node{
ID: "1.2",
Name: "folder2",
Children: []*Node{
{
ID: "1.2.3",
Name: "folder3",
Children: []*Node{
{
ID: "1.2.3.4",
Name: "folder4",
Children: []*Node{
{
ID: "1.2.3.4.5",
Name: "folder5",
Children: []*Node{},
},
},
},
},
},
},
},
},
{
path: "/",
tree: &Node{
ID: "1",
Name: "/",
Children: []*Node{},
},
},
},
}
}
func getWideTree() testDecomposingData {
newTree := &Node{
ID: "0",
Name: "/",
Children: []*Node{
{
ID: "0.1",
Name: "folder01",
Children: []*Node{
{
ID: "0.1.1",
Name: "folder011",
Children: []*Node{
{
ID: "0.1.1.1",
Name: "folder0111",
Children: []*Node{},
},
{
ID: "0.1.1.2",
Name: "folder0112",
Children: []*Node{},
},
{
ID: "0.1.1.3",
Name: "folder0113",
Children: []*Node{},
},
{
ID: "0.1.1.4",
Name: "folder0114",
Children: []*Node{},
},
{
ID: "0.1.1.5",
Name: "folder0115",
Children: []*Node{},
},
{
ID: "0.1.1.6",
Name: "folder0116",
Children: []*Node{},
},
{
ID: "0.1.1.7",
Name: "folder0117",
Children: []*Node{},
},
{
ID: "0.1.1.8",
Name: "folder0118",
Children: []*Node{},
},
{
ID: "0.1.1.9",
Name: "folder0119",
Children: []*Node{},
},
},
},
},
},
},
}
return testDecomposingData{
TreeWeighted: newTree.WeightingTreeWithStack(),
Threshold: 60,
Parts: []SubTree{
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.1",
Name: "folder0111",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.2",
Name: "folder0112",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.3",
Name: "folder0113",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.4",
Name: "folder0114",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.5",
Name: "folder0115",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.6",
Name: "folder0116",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.7",
Name: "folder0117",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.8",
Name: "folder0118",
Children: []*Node{},
},
},
{
path: "/folder01/folder011",
tree: &Node{
ID: "0.1.1.9",
Name: "folder0119",
Children: []*Node{},
},
},
{
path: "/folder01",
tree: &Node{
ID: "0.1.1",
Name: "folder011",
Children: []*Node{},
},
},
{
path: "/",
tree: &Node{
ID: "0.1",
Name: "folder01",
Children: []*Node{},
},
},
{
path: "/",
tree: &Node{
ID: "0",
Name: "/",
Children: []*Node{},
},
},
},
}
}
func getAssimmetricTree() 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.1.1",
Name: "folder1.1.1.1.1",
Children: []*Node{
{
ID: "1.1.1.1.1.1",
Name: "folder1.1.1.1.1.1",
Children: []*Node{},
},
{
ID: "1.1.1.1.1.2",
Name: "folder1.1.1.1.1.2",
Children: []*Node{
{
ID: "1.1.1.1.1.2.1",
Name: "folder1.1.1.1.1.2.1",
Children: []*Node{},
}, {
ID: "1.1.1.1.1.2.2",
Name: "folder1.1.1.1.1.2.2",
Children: []*Node{},
}, {
ID: "1.1.1.1.1.2.3",
Name: "folder1.1.1.1.1.2.3",
Children: []*Node{},
}, {
ID: "1.1.1.1.1.2.4",
Name: "folder1.1.1.1.1.2.4",
Children: []*Node{{
ID: "1.1.1.1.1.2.4.1",
Name: "folder1.1.1.1.1.2.4.1",
Children: []*Node{{
ID: "1.1.1.1.1.2.4.1.1",
Name: "folder1.1.1.1.1.2.4.1.1",
Children: []*Node{},
}, {
ID: "1.1.1.1.1.2.4.1.2",
Name: "folder1.1.1.1.1.2.4.1.2",
Children: []*Node{},
}},
}},
}, {
ID: "1.1.1.1.1.2.5",
Name: "folder1.1.1.1.1.2.5",
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{},
},
},
},
},
},
},
}
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{},
},
},
},
},
},
}
}