@@ -37,19 +37,15 @@ func TestMakeTree(t *testing.T) {
37
37
{Locator : loc , ID : "611" , ParentID : "61" , Deleted : true },
38
38
}
39
39
40
- res := MakeTree (comments , "time" , 0 )
40
+ res := MakeTree (comments , "time" )
41
41
resJSON , err := json .Marshal (& res )
42
42
require .NoError (t , err )
43
43
44
44
expJSON := mustLoadJSONFile (t , "testdata/tree.json" )
45
45
assert .Equal (t , expJSON , resJSON )
46
- assert .Equal (t , store.PostInfo {URL : "url" , Count : 12 , FirstTS : ts (46 , 1 ), LastTS : ts (47 , 22 )}, res .Info )
47
46
48
- res = MakeTree ([]store.Comment {}, "time" , 0 )
47
+ res = MakeTree ([]store.Comment {}, "time" )
49
48
assert .Equal (t , & Tree {}, res )
50
-
51
- res = MakeTree (comments , "time" , 10 )
52
- assert .Equal (t , store.PostInfo {URL : "url" , Count : 12 , FirstTS : ts (46 , 1 ), LastTS : ts (47 , 22 ), ReadOnly : true }, res .Info )
53
49
}
54
50
55
51
func TestMakeEmptySubtree (t * testing.T ) {
@@ -79,7 +75,7 @@ func TestMakeEmptySubtree(t *testing.T) {
79
75
{Locator : loc , ID : "3" , Timestamp : ts (48 , 1 ), Deleted : true }, // deleted top level
80
76
}
81
77
82
- res := MakeTree (comments , "time" , 0 )
78
+ res := MakeTree (comments , "time" )
83
79
resJSON , err := json .Marshal (& res )
84
80
require .NoError (t , err )
85
81
t .Log (string (resJSON ))
@@ -108,50 +104,50 @@ func TestTreeSortNodes(t *testing.T) {
108
104
{ID : "5" , Deleted : true , Timestamp : time .Date (2017 , 12 , 25 , 19 , 47 , 22 , 150 , time .UTC )},
109
105
}
110
106
111
- res := MakeTree (comments , "+active" , 0 )
107
+ res := MakeTree (comments , "+active" )
112
108
assert .Equal (t , "2" , res .Nodes [0 ].Comment .ID )
113
109
t .Log (res .Nodes [0 ].Comment .ID , res .Nodes [0 ].tsModified )
114
110
115
- res = MakeTree (comments , "-active" , 0 )
111
+ res = MakeTree (comments , "-active" )
116
112
t .Log (res .Nodes [0 ].Comment .ID , res .Nodes [0 ].tsModified )
117
113
assert .Equal (t , "1" , res .Nodes [0 ].Comment .ID )
118
114
119
- res = MakeTree (comments , "+time" , 0 )
115
+ res = MakeTree (comments , "+time" )
120
116
t .Log (res .Nodes [0 ].Comment .ID , res .Nodes [0 ].tsModified )
121
117
assert .Equal (t , "1" , res .Nodes [0 ].Comment .ID )
122
118
123
- res = MakeTree (comments , "-time" , 0 )
119
+ res = MakeTree (comments , "-time" )
124
120
assert .Equal (t , "6" , res .Nodes [0 ].Comment .ID )
125
121
126
- res = MakeTree (comments , "score" , 0 )
122
+ res = MakeTree (comments , "score" )
127
123
assert .Equal (t , "4" , res .Nodes [0 ].Comment .ID )
128
124
assert .Equal (t , "3" , res .Nodes [1 ].Comment .ID )
129
125
assert .Equal (t , "6" , res .Nodes [2 ].Comment .ID )
130
126
assert .Equal (t , "1" , res .Nodes [3 ].Comment .ID )
131
127
132
- res = MakeTree (comments , "+score" , 0 )
128
+ res = MakeTree (comments , "+score" )
133
129
assert .Equal (t , "4" , res .Nodes [0 ].Comment .ID )
134
130
135
- res = MakeTree (comments , "-score" , 0 )
131
+ res = MakeTree (comments , "-score" )
136
132
assert .Equal (t , "2" , res .Nodes [0 ].Comment .ID )
137
133
assert .Equal (t , "1" , res .Nodes [1 ].Comment .ID )
138
134
assert .Equal (t , "3" , res .Nodes [2 ].Comment .ID )
139
135
assert .Equal (t , "6" , res .Nodes [3 ].Comment .ID )
140
136
141
- res = MakeTree (comments , "+controversy" , 0 )
137
+ res = MakeTree (comments , "+controversy" )
142
138
assert .Equal (t , "3" , res .Nodes [0 ].Comment .ID )
143
139
assert .Equal (t , "6" , res .Nodes [1 ].Comment .ID )
144
140
assert .Equal (t , "2" , res .Nodes [2 ].Comment .ID )
145
141
assert .Equal (t , "4" , res .Nodes [3 ].Comment .ID )
146
142
assert .Equal (t , "1" , res .Nodes [4 ].Comment .ID )
147
143
148
- res = MakeTree (comments , "-controversy" , 0 )
144
+ res = MakeTree (comments , "-controversy" )
149
145
assert .Equal (t , "1" , res .Nodes [0 ].Comment .ID )
150
146
assert .Equal (t , "4" , res .Nodes [1 ].Comment .ID )
151
147
assert .Equal (t , "2" , res .Nodes [2 ].Comment .ID )
152
148
assert .Equal (t , "3" , res .Nodes [3 ].Comment .ID )
153
149
154
- res = MakeTree (comments , "undefined" , 0 )
150
+ res = MakeTree (comments , "undefined" )
155
151
t .Log (res .Nodes [0 ].Comment .ID , res .Nodes [0 ].tsModified )
156
152
assert .Equal (t , "1" , res .Nodes [0 ].Comment .ID )
157
153
}
@@ -164,7 +160,7 @@ func BenchmarkTree(b *testing.B) {
164
160
assert .NoError (b , err )
165
161
166
162
for i := 0 ; i < b .N ; i ++ {
167
- res := MakeTree (comments , "time" , 0 )
163
+ res := MakeTree (comments , "time" )
168
164
assert .NotNil (b , res )
169
165
}
170
166
}
0 commit comments