testutil

package
v0.0.0-...-ae8e89f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqualErrors

func AssertEqualErrors(t *testing.T, testName string, expectedError error, actualError error)

AssertEqualErrors asserts that the errors are equal, by checking if the actual error is caused by the expected error or that they are both nil.

func LoadNativeBlock

func LoadNativeBlock(file string) (*api.EthereumBlock, error)

func LoadRawBlock

func LoadRawBlock(file string) (*api.Block, error)

func LoadRosettaBlock

func LoadRosettaBlock(file string) (*rt.BlockResponse, error)

func LoadRosettaRaw

func LoadRosettaRaw(
	block *rt.BlockResponse,
	transactions *rt.BlockTransactionResponse,
	blockChain common.Blockchain,
	network common.Network) (*api.Block, error)

func LoadRosettaTransaction

func LoadRosettaTransaction(file string) (*rt.BlockTransactionResponse, error)

func MakeBlock

func MakeBlock(height uint64, tag uint32, opts ...Option) *api.Block

func MakeBlockEvent

func MakeBlockEvent(eventType api.BlockchainEvent_Type, height uint64, tag uint32, opts ...Option) *model.BlockEvent

func MakeBlockEventEntries

func MakeBlockEventEntries(eventType api.BlockchainEvent_Type, eventTag uint32, endEventId int64, startHeight uint64, endHeight uint64, tag uint32, opts ...Option) []*model.EventEntry

func MakeBlockEvents

func MakeBlockEvents(eventType api.BlockchainEvent_Type, startHeight uint64, endHeight uint64, tag uint32, opts ...Option) []*model.BlockEvent

func MakeBlockMetadata

func MakeBlockMetadata(height uint64, tag uint32, opts ...Option) *api.BlockMetadata

func MakeBlockMetadatas

func MakeBlockMetadatas(size int, tag uint32, opts ...Option) []*api.BlockMetadata

func MakeBlockMetadatasFromStartHeight

func MakeBlockMetadatasFromStartHeight(startHeight uint64, size int, tag uint32, opts ...Option) []*api.BlockMetadata

func MakeBlocksFromStartHeight

func MakeBlocksFromStartHeight(startHeight uint64, size int, tag uint32, opts ...Option) []*api.Block

func MakeBlocksWithTransactionsFromStartHeight

func MakeBlocksWithTransactionsFromStartHeight(startHeight uint64, size int, tag uint32, transactionSize int, opts ...Option) []*api.Block

func MakeNativeBlock

func MakeNativeBlock(height uint64, tag uint32, opts ...Option) *api.NativeBlock

func MakeRosettaBlock

func MakeRosettaBlock(height uint64, tag uint32, opts ...Option) *api.RosettaBlock

func MakeTransactionHashList

func MakeTransactionHashList(size int) []string

func MakeTransactionsFromStartHeight

func MakeTransactionsFromStartHeight(startHeight int, size int, tag uint32) []*model.Transaction

func MatchProto

func MatchProto(message proto.Message) gomock.Matcher

func MustTime

func MustTime(value string) time.Time

func MustTimestamp

func MustTimestamp(value string) *timestamppb.Timestamp

func NumberOfSolanaVoteTransactions

func NumberOfSolanaVoteTransactions(require *Assertions, rosettaTxs []*rosetta.Transaction) int

Types

type Assertions

type Assertions struct {
	*require.Assertions
}

Assertions extends require.Assertions to support comparison of proto messages.

func Require

func Require(t require.TestingT) *Assertions

func (*Assertions) Equal

func (a *Assertions) Equal(expected any, actual any, msgAndArgs ...any)
type Header struct {
	Hash       string `json:"hash"`
	ParentHash string `json:"parentHash"`
	Number     string `json:"number"`
	Timestamp  string `json:"timestamp"`
}

type Option

type Option func(*builderOptions)

func WithBlockHashFormat

func WithBlockHashFormat(format string) Option

func WithBlockSkipped

func WithBlockSkipped() Option

func WithDataCompression

func WithDataCompression(compression api.Compression) Option

func WithTimestamp

func WithTimestamp(timestamp int64) Option

type ProtoMatcher

type ProtoMatcher struct {
	// contains filtered or unexported fields
}

func (*ProtoMatcher) Matches

func (m *ProtoMatcher) Matches(x any) bool

Matches implements gomock.Matcher.

func (*ProtoMatcher) String

func (m *ProtoMatcher) String() string

String implements gomock.Matcher.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL