X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=p2p%2Fsecurity%2Fbanscore_test.go;fp=p2p%2Ftrust%2Fbanscore_test.go;h=6dd0944f7418286f6052b95727560358a8b09c1b;hp=a4a4fcf79b28473a6bf2e41f0263bc5d0f1d1689;hb=807d99726f6a0610fa9c835e2aabd983801d3510;hpb=aa87732ffe2e2418d8f1ae37da388ecf73e59621 diff --git a/p2p/trust/banscore_test.go b/p2p/security/banscore_test.go similarity index 99% rename from p2p/trust/banscore_test.go rename to p2p/security/banscore_test.go index a4a4fcf7..6dd0944f 100644 --- a/p2p/trust/banscore_test.go +++ b/p2p/security/banscore_test.go @@ -1,4 +1,4 @@ -package trust +package security import ( "math" @@ -23,7 +23,6 @@ func TestInt(t *testing.T) { {bs: DynamicBanScore{lastUnix: 0, transient: math.MaxUint32, persistent: math.MaxUint32}, timeLapse: 0, wantValue: math.MaxUint32 - 1}, } - Init() for i, intTest := range banScoreIntTests { rst := intTest.bs.int(time.Unix(intTest.timeLapse, 0)) if rst != intTest.wantValue { @@ -53,7 +52,6 @@ func TestIncrease(t *testing.T) { {bs: DynamicBanScore{lastUnix: 0, transient: 0, persistent: math.MaxUint32}, transientAdd: math.MaxUint32, persistentAdd: 0, timeLapse: Lifetime + 1, wantValue: math.MaxUint32 - 1}, } - Init() for i, incTest := range banScoreIncreaseTests { rst := incTest.bs.increase(incTest.persistentAdd, incTest.transientAdd, time.Unix(incTest.timeLapse, 0)) if rst != incTest.wantValue {