forked from cerc-io/plugeth
trie: fix random test generator early terminate (#28590)
This change fixes a minor bug in the `randTest.Generate` function, which caused the `quick.Check` to be a no-op.
This commit is contained in:
parent
2a2013014c
commit
333dd956bf
@ -372,6 +372,9 @@ func TestRandomCases(t *testing.T) {
|
|||||||
// Instances of this test are created by Generate.
|
// Instances of this test are created by Generate.
|
||||||
type randTest []randTestStep
|
type randTest []randTestStep
|
||||||
|
|
||||||
|
// compile-time interface check
|
||||||
|
var _ quick.Generator = (randTest)(nil)
|
||||||
|
|
||||||
type randTestStep struct {
|
type randTestStep struct {
|
||||||
op int
|
op int
|
||||||
key []byte // for opUpdate, opDelete, opGet
|
key []byte // for opUpdate, opDelete, opGet
|
||||||
@ -394,7 +397,7 @@ const (
|
|||||||
func (randTest) Generate(r *rand.Rand, size int) reflect.Value {
|
func (randTest) Generate(r *rand.Rand, size int) reflect.Value {
|
||||||
var finishedFn = func() bool {
|
var finishedFn = func() bool {
|
||||||
size--
|
size--
|
||||||
return size > 0
|
return size == 0
|
||||||
}
|
}
|
||||||
return reflect.ValueOf(generateSteps(finishedFn, r))
|
return reflect.ValueOf(generateSteps(finishedFn, r))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user