Добавил пример бенчмарка
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
083eba9102
commit
7927845192
|
@ -20,6 +20,14 @@ func (root Node) WeighingTreeWithRecursion() map[string]uint16 {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (root Node) WeighingTreeIdiomaticDFS() map[string]uint16 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (root Node) WeighingTreeIdiomaticBFS() map[string]uint16 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (root Node) DecomposeTree(weights map[string]uint16, limit int) ([]*Node, error) {
|
func (root Node) DecomposeTree(weights map[string]uint16, limit int) ([]*Node, error) {
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cut_the_tree_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func BenchmarkNode_WeighingTreeWithRecursion(b *testing.B) {
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
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}
|
||||||
|
|
||||||
|
assert.EqualValues(b, output, testOrdinaryVFS.WeighingTreeWithRecursion())
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNode_WeighingTreeWithRecursion(t *testing.T) {
|
func TestNode_WeighingTreeAllAlgo(t *testing.T) {
|
||||||
for name,tt := range map[string]struct{
|
for name,tt := range map[string]struct{
|
||||||
input cut_the_tree.Node
|
input cut_the_tree.Node
|
||||||
output map[string]uint16
|
output map[string]uint16
|
||||||
|
@ -23,8 +23,9 @@ func TestNode_WeighingTreeWithRecursion(t *testing.T) {
|
||||||
},
|
},
|
||||||
}{
|
}{
|
||||||
t.Run(name,func(t *testing.T) {
|
t.Run(name,func(t *testing.T) {
|
||||||
out := tt.input.WeighingTreeWithRecursion()
|
assert.EqualValues(t, tt.output, tt.input.WeighingTreeWithRecursion())
|
||||||
assert.EqualValues(t, tt.output, out)
|
assert.EqualValues(t, tt.output, tt.input.WeighingTreeIdiomaticDFS())
|
||||||
|
assert.EqualValues(t, tt.output, tt.input.WeighingTreeIdiomaticBFS())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue