作者 yangfu

feat-1.0

1 package xcollection 1 package xcollection
2 2
3 import ( 3 import (
  4 + "fmt"
4 "github.com/stretchr/testify/assert" 5 "github.com/stretchr/testify/assert"
5 - "strconv"  
6 "testing" 6 "testing"
7 ) 7 )
8 8
@@ -106,21 +106,21 @@ func Test_TreeNodeByDepth(t *testing.T) { @@ -106,21 +106,21 @@ func Test_TreeNodeByDepth(t *testing.T) {
106 } 106 }
107 107
108 type st struct { 108 type st struct {
109 - Id int  
110 - Pid int 109 + Id int64
  110 + Pid int64
111 } 111 }
112 112
113 -func (t *st) PID() string {  
114 - return strconv.Itoa(t.Pid) 113 +func (t *st) PID() int64 {
  114 + return t.Id
115 } 115 }
116 -func (t *st) ID() string {  
117 - return strconv.Itoa(t.Id) 116 +func (t *st) ID() int64 {
  117 + return t.Pid
118 } 118 }
119 119
120 func treeNodeResults(nodes []TreeNode) []string { 120 func treeNodeResults(nodes []TreeNode) []string {
121 var res []string 121 var res []string
122 for i := range nodes { 122 for i := range nodes {
123 - res = append(res, nodes[i].ID()) 123 + res = append(res, fmt.Sprintf("%d", nodes[i].ID()))
124 } 124 }
125 return res 125 return res
126 } 126 }