feat: wider fuzz tests, stronger options. #9
@@ -50,7 +50,7 @@ func FuzzInsertLookup(f *testing.F) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
seedA, seedB := scenario.seedA, scenario.seedB
|
seedA, seedB := scenario.seedA, scenario.seedB
|
||||||
growthFactor := max(1, int(scenario.growthFactor))
|
growthFactor := max(2, int(scenario.growthFactor))
|
||||||
capacity := int(scenario.capacity)
|
capacity := int(scenario.capacity)
|
||||||
minimumLoad := math.Abs(math.Mod(scenario.load, 1.0))
|
minimumLoad := math.Abs(math.Mod(scenario.load, 1.0))
|
||||||
|
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ func MinimumLoad(value float64) Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GrowthFactor controls how much the capacity of the [Table] multiplies when
|
// GrowthFactor controls how much the capacity of the [Table] multiplies when
|
||||||
// it must resize. The value must be greater than 0.
|
// it must resize. The value must be greater than 1.
|
||||||
func GrowthFactor(value int) Option {
|
func GrowthFactor(value int) Option {
|
||||||
if value <= 0 {
|
if value < 2 {
|
||||||
panic(fmt.Sprintf("go-cuckoo: GrowthFactor must be greater than 0, got %d", value))
|
panic(fmt.Sprintf("go-cuckoo: GrowthFactor must be greater than 1, got %d", value))
|
||||||
}
|
}
|
||||||
|
|
||||||
return func(s *settings) { s.growthFactor = uint64(value) }
|
return func(s *settings) { s.growthFactor = uint64(value) }
|
||||||
|
|||||||
2
testdata/fuzz/FuzzInsertLookup/a79aad05d13023ec
vendored
Normal file
2
testdata/fuzz/FuzzInsertLookup/a79aad05d13023ec
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
go test fuzz v1
|
||||||
|
[]byte("1000010X17000A11\xf5XA000\xe00001aA120000000000000111220000122910000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
|
||||||
Reference in New Issue
Block a user