-
Notifications
You must be signed in to change notification settings - Fork 45
/
ranking_test.go
327 lines (317 loc) · 10.2 KB
/
ranking_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
package gcse
import (
"strings"
"testing"
"github.com/golangplus/testing/assert"
)
func TestEffectiveImported(t *testing.T) {
pkg := "labix.org/v2/mgo/bson"
imported := strings.Fields(
`bitbucket.org/phlyingpenguin/collectinator
bitbucket.org/phlyingpenguin/collectinator/account
bitbucket.org/phlyingpenguin/collectinator/blog
bitbucket.org/phlyingpenguin/collectinator/common
code.google.com/p/sadbox/sessions/mongodb
git.300brand.com/coverage
git.300brand.com/coverage/storage/mongo
github.com/GeertJohan/outyet
github.com/MG-RAST/AWE/core
github.com/MG-RAST/Shock/shock-server
github.com/MG-RAST/Shock/shock-server/controller/node
github.com/MG-RAST/Shock/shock-server/node
github.com/MG-RAST/Shock/shock-server/preauth
github.com/MG-RAST/Shock/shock-server/user
github.com/abiosoft/gopages-sample/store
github.com/adnaan/hamster
github.com/alouca/MongoQueue
github.com/araddon/loges
github.com/araddon/mgou
github.com/arbaal/go-gridfs-serve
github.com/athom/tenpu
github.com/bketelsen/skynet/client
github.com/bketelsen/skynet/rpc/bsonrpc
github.com/bketelsen/skynet/service
github.com/cgrates/cgrates/rater
github.com/chrissexton/alepale/bot
github.com/chrissexton/alepale/plugins
github.com/drevell/mgou
github.com/edsrzf/mgo
github.com/emicklei/landskape/dao
github.com/fluffle/sp0rkle/collections/conf
github.com/fluffle/sp0rkle/collections/factoids
github.com/fluffle/sp0rkle/collections/karma
github.com/fluffle/sp0rkle/collections/markov
github.com/fluffle/sp0rkle/collections/quotes
github.com/fluffle/sp0rkle/collections/reminders
github.com/fluffle/sp0rkle/collections/seen
github.com/fluffle/sp0rkle/collections/stats
github.com/fluffle/sp0rkle/collections/urls
github.com/fluffle/sp0rkle/drivers/factdriver
github.com/fluffle/sp0rkle/drivers/quotedriver
github.com/fluffle/sp0rkle/drivers/reminddriver
github.com/fluffle/sp0rkle/drivers/urldriver
github.com/globocom/gandalf/api
github.com/globocom/gandalf/repository
github.com/globocom/gandalf/user
github.com/globocom/mongoapi
github.com/globocom/tsuru/api
github.com/globocom/tsuru/app
github.com/globocom/tsuru/auth
github.com/globocom/tsuru/collector
github.com/globocom/tsuru/provision/docker
github.com/globocom/tsuru/provision/juju
github.com/globocom/tsuru/provision/lxc
github.com/globocom/tsuru/quota
github.com/globocom/tsuru/service
github.com/godfried/impendulo/db
github.com/godfried/impendulo/processing
github.com/godfried/impendulo/processing/monitor
github.com/godfried/impendulo/project
github.com/godfried/impendulo/server
github.com/godfried/impendulo/server/web
github.com/godfried/impendulo/tool
github.com/godfried/impendulo/tool/javac
github.com/godfried/impendulo/tool/jpf
github.com/godfried/impendulo/tool/junit
github.com/godfried/impendulo/util
github.com/gosexy/db/mongo
github.com/gregworley/koalab-golang-api
github.com/isaiah/tsuru_service
github.com/jasonmoo/gearman-go/client
github.com/jbaikge/coverage
github.com/jbaikge/est
github.com/jmcvetta/jfu
github.com/jmoiron/monet/app
github.com/jmoiron/monet/blog
github.com/jmoiron/monet/db
github.com/jmoiron/monet/gallery
github.com/johnwesonga/gotodolist
github.com/jordanorelli/go-instagram
github.com/jordanorelli/twitter
github.com/kidstuff/mtoy
github.com/kidstuff/mtoy/mgoauth
github.com/kidstuff/mtoy/mgosessions
github.com/liudian/mogogo/src/mogogo
github.com/lukegb/irclogsme
github.com/lukegb/irclogsme/logger
github.com/lukegb/irclogsme/server
github.com/mdennebaum/mgomodel
github.com/melvinmt/startupreader.com
github.com/mikespook/gearman-go/client
github.com/miraclesu/service
github.com/monnand/bully
github.com/mschoch/tuq/datasources/mongodb
github.com/msurdi/alf/db
github.com/netbrain/gonk/examples/authentication/app/role
github.com/netbrain/gonk/examples/authentication/app/user
github.com/nono/koalab-golang-api
github.com/nstott/mongobench
github.com/nvcnvn/glog
github.com/nvcnvn/glog/dbctx
github.com/nvcnvn/gorms
github.com/nvcnvn/gorms/dbctx
github.com/openvn/toys/secure/membership
github.com/openvn/toys/secure/membership/sessions
github.com/opesun/hypecms/model/basic
github.com/opesun/hypecms/model/patterns
github.com/opesun/hypecms/model/scut
github.com/opesun/hypecms/modules/admin/model
github.com/opesun/hypecms/modules/bootstrap
github.com/opesun/hypecms/modules/bootstrap/model
github.com/opesun/hypecms/modules/content
github.com/opesun/hypecms/modules/content/model
github.com/opesun/hypecms/modules/custom_actions
github.com/opesun/hypecms/modules/custom_actions/model
github.com/opesun/hypecms/modules/display_editor
github.com/opesun/hypecms/modules/display_editor/model
github.com/opesun/hypecms/modules/skeleton
github.com/opesun/hypecms/modules/template_editor
github.com/opesun/hypecms/modules/template_editor/model
github.com/opesun/hypecms/modules/user/model
github.com/opesun/nocrud/frame/impl/set/mongodb
github.com/opesun/nocrud/frame/misc/convert
github.com/opesun/nocrud/modules/fulltext
github.com/opesun/resolver
github.com/pavel-paulau/blurr/databases
github.com/pjvds/httpcallback.io/data/mongo
github.com/pjvds/httpcallback.io/model
github.com/prinsmike/GoVHostLog
github.com/prinsmike/gohome
github.com/reiver/turtledq
github.com/retzkek/transfat
github.com/rif/gocmd
github.com/rwynn/gtm
github.com/scottcagno/netkit
github.com/scottferg/goat
github.com/shawnps/mappuri
github.com/skelterjohn/bsonrpc
github.com/stretchr/codecs/bson
github.com/sunfmin/batchbuy/model
github.com/sunfmin/mgodb
github.com/sunfmin/tenpu/gridfs
github.com/sunfmin/tenpu/thumbnails
github.com/surma/importalias
github.com/tanema/mgorx
github.com/trevex/golem_examples
github.com/ungerik/go-start/model
github.com/ungerik/go-start/mongo
github.com/ungerik/go-start/mongomedia
github.com/ungerik/go-start/user
github.com/vbatts/imgsrv
github.com/wendyeq/iweb
github.com/wesnow/qufadai/src
github.com/xing4git/chirp/dao
github.com/xing4git/chirp/dao/redisdao
github.com/xing4git/chirp/model
github.com/xing4git/chirp/service/feedservice
github.com/zeebo/est
github.com/zeebo/goci/app/entities
github.com/zeebo/goci/app/frontend
github.com/zeebo/goci/app/httputil
github.com/zeebo/goci/app/notifications
github.com/zeebo/goci/app/response
github.com/zeebo/goci/app/tracker
github.com/zeebo/goci/app/workqueue
github.com/zeebo/gostbook
labix.org/v2/mgo
labix.org/v2/mgo/txn
launchpad.net/hockeypuck/mgo
launchpad.net/juju-core/charm
launchpad.net/juju-core/state
launchpad.net/juju-core/state/presence
launchpad.net/juju-core/state/watcher
launchpad.net/juju-core/store
launchpad.net/juju-core/version
launchpad.net/mgo/v2`)
author := AuthorOfPackage(pkg)
project := ProjectOfPackage(pkg)
t.Logf("pkg: %s, author: %s, project: %s", pkg, author, project)
_ = imported
cnt := effectiveImported(imported, author, project)
t.Logf("cnt: %f", cnt)
assert.ValueShould(t, "cnt", cnt, cnt <= 100, "> 100: effectiveImported failed!")
}
func TestEffectiveImported_projsame(t *testing.T) {
pkg := "github.com/dotcloud/docker/term"
imported := strings.Fields(
`github.com/AsherBond/docker
github.com/ChaosCloud/docker
github.com/CodeNow/docker
github.com/DanielBryan/docker
github.com/Jukkrapong/docker
github.com/ToothlessGear/docker
github.com/Vladimiroff/docker
github.com/ZeissS/docker
github.com/amaudy/docker
github.com/anachronistic/docker
github.com/apatil/docker-cpuset-cpus
github.com/apatil/docker-lxc-options
github.com/aybabtme/docker
github.com/bdon/docker
github.com/benoitc/docker
github.com/billyoung/docker
github.com/bits/docker
github.com/bpo/docker
github.com/bradobro/docker
github.com/c4milo/docker
github.com/calavera/docker
github.com/carlosdp/docker
github.com/cespare/docker
github.com/crosbymichael/docker
github.com/dhrp/docker
github.com/dillera/docker
github.com/dlintw/docker
github.com/dotcloud/docker
github.com/dr-strangecode/docker
github.com/dsissitka/docker
github.com/dynport/docker
github.com/ehazlett/docker
github.com/errnoh/docker
github.com/fmd/docker
github.com/fsouza/docker
github.com/fsouza/go-dockerclient
github.com/gaffo/docker
github.com/gale320/docker
github.com/hantuo/docker
github.com/hukeli/docker
github.com/irr/docker
github.com/ismell/docker
github.com/jaepil/docker
github.com/jamtur01/docker
github.com/jbardin/docker
github.com/jmcvetta/docker
github.com/johnbellone/docker
github.com/johnnydtan/docker
github.com/junk16/docker
github.com/justone/docker
github.com/kencochrane/docker
github.com/kisielk/docker
github.com/kmindg/docker
github.com/kpelykh/docker
github.com/kstaken/docker
github.com/lopter/docker
github.com/mars9/docker
github.com/maxhodak/docker
github.com/metalivedev/docker
github.com/mewpkg/docker
github.com/mhennings/docker
github.com/mindreframer/docker
github.com/monnand/docker
github.com/ndarilek/docker
github.com/nickstenning/docker
github.com/offby1/docker
github.com/ooyala/docker
github.com/oss17888/docker
github.com/petar/gocircuit-docker
github.com/philips/docker
github.com/pjvds/docker
github.com/rhoml/docker
github.com/richo/docker
github.com/ryfow/docker
github.com/sabzil/docker
github.com/shin-/docker
github.com/silpion/docker
github.com/sinhalabs/docker
github.com/sleekslush/docker
github.com/sridatta/docker
github.com/stevedomin/docker
github.com/steveruckdashel/docker
github.com/stfp/docker
github.com/synack/docker
github.com/timcubb/docker
github.com/titanous/docker
github.com/twmb/docker
github.com/unclejack/docker
github.com/vagmi/docker
github.com/zimbatm/docker
github.com/zsol/docker`)
author := AuthorOfPackage(pkg)
project := ProjectOfPackage(pkg)
t.Logf("pkg: %s, author: %s, project: %s", pkg, author, project)
_ = imported
cnt := effectiveImported(imported, author, project)
t.Logf("cnt: %f", cnt)
assert.ValueShould(t, "cnt", cnt, cnt <= 10, "> 10: effectiveImported failed!")
}
func TestProjectOfPackage(t *testing.T) {
PKG_PRJ := []string{
`github.com/AsherBond/docker`, `docker`,
`gopkg.in/redis.v1`, `redis`,
`gopkg.in/inconshreveable/log15.v2`, `log15`,
`gopkg.in/fatih/v0/set`, `gopkg.in`,
}
for i := 0; i < len(PKG_PRJ); i += 2 {
assert.Equal(t, "project of "+PKG_PRJ[i], ProjectOfPackage(PKG_PRJ[i]), PKG_PRJ[i+1])
}
}
func TestAuthorOfPackage(t *testing.T) {
PKG_AUTHOR := []string{
`github.com/AsherBond/docker`, `AsherBond`,
`gopkg.in/redis.v1`, `go-redis`,
`gopkg.in/inconshreveable/log15.v2`, `inconshreveable`,
`gopkg.in/fatih/v0/set`, `fatih`,
}
for i := 0; i < len(PKG_AUTHOR); i += 2 {
assert.Equal(t, "author of "+PKG_AUTHOR[i], AuthorOfPackage(PKG_AUTHOR[i]), PKG_AUTHOR[i+1])
}
}