Documentation ¶
Index ¶
- type TestSuite
- func (ts *TestSuite) DecodingHex(in string) []byte
- func (ts *TestSuite) GenerateTestAccount(number int32) (*account.Account, crypto.Signer)
- func (ts *TestSuite) GenerateTestBlock(proposer *crypto.Address, prevBlockHash *hash.Hash) *block.Block
- func (ts *TestSuite) GenerateTestBondTx() (*tx.Tx, crypto.Signer)
- func (ts *TestSuite) GenerateTestCertificate(blockHash hash.Hash) *block.Certificate
- func (ts *TestSuite) GenerateTestChangeProposerVote(height uint32, round int16) (*vote.Vote, crypto.Signer)
- func (ts *TestSuite) GenerateTestCommittee(num int) (committee.Committee, []crypto.Signer)
- func (ts *TestSuite) GenerateTestPrecommitVote(height uint32, round int16) (*vote.Vote, crypto.Signer)
- func (ts *TestSuite) GenerateTestPrepareVote(height uint32, round int16) (*vote.Vote, crypto.Signer)
- func (ts *TestSuite) GenerateTestProposal(height uint32, round int16) (*proposal.Proposal, crypto.Signer)
- func (ts *TestSuite) GenerateTestSortitionTx() (*tx.Tx, crypto.Signer)
- func (ts *TestSuite) GenerateTestTransferTx() (*tx.Tx, crypto.Signer)
- func (ts *TestSuite) GenerateTestUnbondTx() (*tx.Tx, crypto.Signer)
- func (ts *TestSuite) GenerateTestValidator(number int32) (*validator.Validator, crypto.Signer)
- func (ts *TestSuite) GenerateTestWithdrawTx() (*tx.Tx, crypto.Signer)
- func (ts *TestSuite) RandInt(max int) int
- func (ts *TestSuite) RandInt16(max int16) int16
- func (ts *TestSuite) RandInt16NonZero(max int16) int16
- func (ts *TestSuite) RandInt32(max int32) int32
- func (ts *TestSuite) RandInt32NonZero(max int32) int32
- func (ts *TestSuite) RandInt64(max int64) int64
- func (ts *TestSuite) RandInt64NonZero(max int64) int64
- func (ts *TestSuite) RandIntNonZero(max int) int
- func (ts *TestSuite) RandUint16(max uint16) uint16
- func (ts *TestSuite) RandUint16NonZero(max uint16) uint16
- func (ts *TestSuite) RandUint32(max uint32) uint32
- func (ts *TestSuite) RandUint32NonZero(max uint32) uint32
- func (ts *TestSuite) RandUint64(max uint64) uint64
- func (ts *TestSuite) RandUint64NonZero(max uint64) uint64
- func (ts *TestSuite) RandomAddress() crypto.Address
- func (ts *TestSuite) RandomBLSKeyPair() (*bls.PublicKey, *bls.PrivateKey)
- func (ts *TestSuite) RandomBytes(len int) []byte
- func (ts *TestSuite) RandomHash() hash.Hash
- func (ts *TestSuite) RandomPeerID() peer.ID
- func (ts *TestSuite) RandomProof() sortition.Proof
- func (ts *TestSuite) RandomSeed() sortition.VerifiableSeed
- func (ts *TestSuite) RandomSigner() crypto.Signer
- func (ts *TestSuite) RandomStamp() hash.Stamp
- func (ts *TestSuite) RandomString(len int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestSuite ¶
TestSuite provides a set of helper functions for testing purposes. All the random values are generated based on a logged seed. By using a pre-generated seed, it is possible to reproduce failed tests by re-evaluating all the random values. This helps in identifying and debugging failures in testing conditions.
func NewTestSuite ¶
NewTestSuite creates a new TestSuite by generating new seed.
func NewTestSuiteForSeed ¶
NewTestSuiteForSeed creates a new TestSuite with the given seed.
func (*TestSuite) DecodingHex ¶
DecodingHex decodes the input string from hexadecimal format and returns the resulting byte slice.
func (*TestSuite) GenerateTestAccount ¶
GenerateTestAccount generates an account for testing purposes.
func (*TestSuite) GenerateTestBlock ¶
func (ts *TestSuite) GenerateTestBlock(proposer *crypto.Address, prevBlockHash *hash.Hash) *block.Block
GenerateTestBlock generates a block vote for testing.
func (*TestSuite) GenerateTestBondTx ¶
GenerateTestBondTx generates a bond transaction for testing.
func (*TestSuite) GenerateTestCertificate ¶
func (ts *TestSuite) GenerateTestCertificate(blockHash hash.Hash) *block.Certificate
GenerateTestCertificate generates a certificate for testing.
func (*TestSuite) GenerateTestChangeProposerVote ¶
func (ts *TestSuite) GenerateTestChangeProposerVote(height uint32, round int16) (*vote.Vote, crypto.Signer)
GenerateTestChangeProposerVote generates a proposer-change vote for testing.
func (*TestSuite) GenerateTestCommittee ¶
GenerateTestCommittee generates a committee for testing purposes. All committee members have the same power.
func (*TestSuite) GenerateTestPrecommitVote ¶
func (ts *TestSuite) GenerateTestPrecommitVote(height uint32, round int16) (*vote.Vote, crypto.Signer)
GenerateTestPrecommitVote generates a precommit vote for testing.
func (*TestSuite) GenerateTestPrepareVote ¶
func (ts *TestSuite) GenerateTestPrepareVote(height uint32, round int16) (*vote.Vote, crypto.Signer)
GenerateTestPrepareVote generates a prepare vote for testing.
func (*TestSuite) GenerateTestProposal ¶
func (ts *TestSuite) GenerateTestProposal(height uint32, round int16) (*proposal.Proposal, crypto.Signer)
GenerateTestProposal generates a proposal for testing.
func (*TestSuite) GenerateTestSortitionTx ¶
GenerateTestSortitionTx generates a sortition transaction for testing.
func (*TestSuite) GenerateTestTransferTx ¶
GenerateTestTransferTx generates a transfer transaction for testing.
func (*TestSuite) GenerateTestUnbondTx ¶
GenerateTestUnbondTx generates an unbond transaction for testing.
func (*TestSuite) GenerateTestValidator ¶
GenerateTestValidator generates a validator for testing purposes.
func (*TestSuite) GenerateTestWithdrawTx ¶
GenerateTestWithdrawTx generates a withdraw transaction for testing.
func (*TestSuite) RandInt16NonZero ¶
RandInt16NonZero returns a random int16 between 1 and max+1.
func (*TestSuite) RandInt32NonZero ¶
RandInt32NonZero returns a random int32 between 1 and max+1.
func (*TestSuite) RandInt64NonZero ¶
RandInt64NonZero returns a random int64 between 1 and max+1.
func (*TestSuite) RandIntNonZero ¶
RandIntNonZero returns a random int between 1 and max+1.
func (*TestSuite) RandUint16 ¶
RandUint16 returns a random uint16 between 0 and max.
func (*TestSuite) RandUint16NonZero ¶
RandUint16NonZero returns a random uint16 between 1 and max+1.
func (*TestSuite) RandUint32 ¶
RandUint32 returns a random uint32 between 0 and max.
func (*TestSuite) RandUint32NonZero ¶
RandUint32NonZero returns a random uint32 between 1 and max+1.
func (*TestSuite) RandUint64 ¶
RandUint64 returns a random uint64 between 0 and max.
func (*TestSuite) RandUint64NonZero ¶
RandUint64NonZero returns a random uint64 between 1 and max+1.
func (*TestSuite) RandomAddress ¶
RandomAddress generates a random address for testing.
func (*TestSuite) RandomBLSKeyPair ¶
func (ts *TestSuite) RandomBLSKeyPair() (*bls.PublicKey, *bls.PrivateKey)
RandomBLSKeyPair generates a random BLS key pair for testing.
func (*TestSuite) RandomBytes ¶
RandomBytes returns a slice of random bytes of the given length.
func (*TestSuite) RandomHash ¶
RandomHash generates a random hash for testing.
func (*TestSuite) RandomPeerID ¶
RandomPeerID returns a random peer ID.
func (*TestSuite) RandomProof ¶
RandomProof generates a random Proof for testing.
func (*TestSuite) RandomSeed ¶
func (ts *TestSuite) RandomSeed() sortition.VerifiableSeed
RandomSeed generates a random VerifiableSeed for testing.
func (*TestSuite) RandomSigner ¶
RandomSigner generates a random signer for testing.
func (*TestSuite) RandomStamp ¶
RandomStamp generates a random stamp for testing.
func (*TestSuite) RandomString ¶
RandomString generates a random string of the given length.