github.com/cosmos/cosmos-sdk@v0.50.10/fuzz/tests/tendermint_amino_decodetime_test.go (about)

     1  //go:build gofuzz || go1.18
     2  
     3  package tests
     4  
     5  import (
     6  	"fmt"
     7  	"testing"
     8  
     9  	amino "github.com/tendermint/go-amino"
    10  )
    11  
    12  func FuzzTendermintAminoDecodeTime(f *testing.F) {
    13  	f.Fuzz(func(t *testing.T, data []byte) {
    14  		if len(data) == 0 {
    15  			return
    16  		}
    17  		_, n, err := amino.DecodeTime(data)
    18  		if err != nil {
    19  			return
    20  		}
    21  		if n < 0 {
    22  			panic(fmt.Sprintf("n=%d < 0", n))
    23  		}
    24  	})
    25  }