34 lines
743 B
Go
34 lines
743 B
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.Tree,
|
|
output: testOrdinaryVFS.Weghts,
|
|
},
|
|
"VFS in the form of a pathological tree":{
|
|
input: testPathologicalTree.Tree,
|
|
output: testPathologicalTree.Weghts,
|
|
},
|
|
}{
|
|
t.Run(name,func(t *testing.T) {
|
|
assert.EqualValues(t, tt.output, tt.input.WeighingTreeWithRecursion())
|
|
assert.EqualValues(t, tt.output, tt.input.WeighingTreeWithStack())
|
|
assert.EqualValues(t, tt.output, tt.input.WeightingTreeWithDLL())
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestNode_DecomposeTree(t *testing.T) {
|
|
|
|
}
|