diff options
Diffstat (limited to 'replay/replay_test.go')
-rw-r--r-- | replay/replay_test.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/replay/replay_test.go b/replay/replay_test.go index ceae2f3..5af66ff 100644 --- a/replay/replay_test.go +++ b/replay/replay_test.go @@ -19,13 +19,13 @@ const RejectAfterMessages = (1 << 64) - (1 << 4) - 1 func TestReplay(t *testing.T) { var filter ReplayFilter - T_LIM := CounterWindowSize + 1 + const T_LIM = windowSize + 1 testNumber := 0 - T := func(n uint64, v bool) { + T := func(n uint64, expected bool) { testNumber++ - if filter.ValidateCounter(n, RejectAfterMessages) != v { - t.Fatal("Test", testNumber, "failed", n, v) + if filter.ValidateCounter(n, RejectAfterMessages) != expected { + t.Fatal("Test", testNumber, "failed", n, expected) } } @@ -69,7 +69,7 @@ func TestReplay(t *testing.T) { t.Log("Bulk test 1") filter.Init() testNumber = 0 - for i := uint64(1); i <= CounterWindowSize; i++ { + for i := uint64(1); i <= windowSize; i++ { T(i, true) } T(0, true) @@ -78,7 +78,7 @@ func TestReplay(t *testing.T) { t.Log("Bulk test 2") filter.Init() testNumber = 0 - for i := uint64(2); i <= CounterWindowSize+1; i++ { + for i := uint64(2); i <= windowSize+1; i++ { T(i, true) } T(1, true) @@ -87,14 +87,14 @@ func TestReplay(t *testing.T) { t.Log("Bulk test 3") filter.Init() testNumber = 0 - for i := CounterWindowSize + 1; i > 0; i-- { + for i := uint64(windowSize + 1); i > 0; i-- { T(i, true) } t.Log("Bulk test 4") filter.Init() testNumber = 0 - for i := CounterWindowSize + 2; i > 1; i-- { + for i := uint64(windowSize + 2); i > 1; i-- { T(i, true) } T(0, false) @@ -102,18 +102,18 @@ func TestReplay(t *testing.T) { t.Log("Bulk test 5") filter.Init() testNumber = 0 - for i := CounterWindowSize; i > 0; i-- { + for i := uint64(windowSize); i > 0; i-- { T(i, true) } - T(CounterWindowSize+1, true) + T(windowSize+1, true) T(0, false) t.Log("Bulk test 6") filter.Init() testNumber = 0 - for i := CounterWindowSize; i > 0; i-- { + for i := uint64(windowSize); i > 0; i-- { T(i, true) } T(0, true) - T(CounterWindowSize+1, true) + T(windowSize+1, true) } |