erigon-pulse/erigon-lib/state/aggregator_fuzz_test.go
battlmonstr 231e468e19 Add 'erigon-lib/' from commit '93d9c9d9fe4bd8a49f7a98a6bce0f0da7094c7d3'
git-subtree-dir: erigon-lib
git-subtree-mainline: 3c8cbda809
git-subtree-split: 93d9c9d9fe
2023-09-20 14:50:25 +02:00

25 lines
461 B
Go

//go:build !nofuzz
package state
import (
"testing"
"github.com/stretchr/testify/require"
)
func Fuzz_BtreeIndex_Allocation(f *testing.F) {
f.Add(uint64(1_000_000), uint64(1024))
f.Fuzz(func(t *testing.T, keyCount, M uint64) {
if keyCount < M*4 || M < 4 {
t.Skip()
}
bt := newBtAlloc(keyCount, M, false)
bt.traverseDfs()
require.GreaterOrEqual(t, bt.N, keyCount)
require.LessOrEqual(t, float64(bt.N-keyCount)/float64(bt.N), 0.05)
})
}