From fc648bc873eb5941aec078843f7d7bc99c1c1c8d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 19 Jun 2019 11:10:32 +0200 Subject: [PATCH] test: make sure we have the correct number of pools fixes #3 --- pool_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pool_test.go b/pool_test.go index 1941144..7421bd5 100644 --- a/pool_test.go +++ b/pool_test.go @@ -32,6 +32,17 @@ func TestAllocations(t *testing.T) { } } +func TestRange(t *testing.T) { + min := nextLogBase2(1) + max := nextLogBase2(uint32(MaxLength)) + if int(max) != len(GlobalPool.pools)-1 { + t.Errorf("expected %d pools, found %d", max, len(GlobalPool.pools)) + } + if min != 0 { + t.Errorf("unused min pool") + } +} + func TestPool(t *testing.T) { // disable GC so we can control when it happens. defer debug.SetGCPercent(debug.SetGCPercent(-1)) -- GitLab