|
|
package xcollection
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
"strconv"
|
|
|
"testing"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -106,21 +106,21 @@ func Test_TreeNodeByDepth(t *testing.T) { |
|
|
}
|
|
|
|
|
|
type st struct {
|
|
|
Id int
|
|
|
Pid int
|
|
|
Id int64
|
|
|
Pid int64
|
|
|
}
|
|
|
|
|
|
func (t *st) PID() string {
|
|
|
return strconv.Itoa(t.Pid)
|
|
|
func (t *st) PID() int64 {
|
|
|
return t.Id
|
|
|
}
|
|
|
func (t *st) ID() string {
|
|
|
return strconv.Itoa(t.Id)
|
|
|
func (t *st) ID() int64 {
|
|
|
return t.Pid
|
|
|
}
|
|
|
|
|
|
func treeNodeResults(nodes []TreeNode) []string {
|
|
|
var res []string
|
|
|
for i := range nodes {
|
|
|
res = append(res, nodes[i].ID())
|
|
|
res = append(res, fmt.Sprintf("%d", nodes[i].ID()))
|
|
|
}
|
|
|
return res
|
|
|
} |
...
|
...
|
|