tests/cut_the_tree/funcs_test.go

34 lines
1.3 KiB
Go

package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNode_WeighingTreeAllAlgo(t *testing.T) {
for name,tt := range map[string]struct{
input Node
output map[string]uint16
}{
"Ordinary VFS tree":{
input:testOrdinaryVFS,
output: map[string]uint16{"node0":1416, "node01":194, "node011":49, "node012":49, "node013":49, "node02":194, "node021":49, "node022":49, "node023":49, "node03":983,"node031":361, "node0311":210, "node03111":53, "node03112":53, "node03113":53, "node0312":51, "node0313":51, "node032":49, "node033":526, "node0331":51, "node0332":375, "node03321":53, "node03322":53, "node03323":218, "node033231":55, "node033232":55, "node033233":55, "node0333":51},
},
"VFS in the form of a pathological tree":{
input: testPathologicalTree,
output: map[string]uint16{"node0":605, "node01":560, "node012":513, "node0123":464, "node01234":413, "node012345":360, "node0123456":305, "node01234567":248, "node012345678":189, "node0123456789":128, "node0123456789A":65},
},
}{
t.Run(name,func(t *testing.T) {
assert.EqualValues(t, tt.output, tt.input.WeighingTreeWithRecursion())
assert.EqualValues(t, tt.output, tt.input.WeighingTreeIdiomaticBFS())
//assert.EqualValues(t, tt.output, tt.input.WeighingTreeIdiomaticDFS())
})
}
}
func TestNode_DecomposeTree(t *testing.T) {
}