mock

package
v1.0.101 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultipleShardsCoordinatorFake

func NewMultipleShardsCoordinatorFake(numOfShards uint32, currentShard uint32) *multipleShardsCoordinatorFake

NewMultipleShardsCoordinatorFake -

Types

type AddressConverterFake

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

AddressConverterFake -

func NewAddressConverterFake

func NewAddressConverterFake(addressLen int, prefix string) *AddressConverterFake

NewAddressConverterFake -

func (*AddressConverterFake) AddressLen

func (acf *AddressConverterFake) AddressLen() int

AddressLen -

func (*AddressConverterFake) ConvertToHex

func (acf *AddressConverterFake) ConvertToHex(addressContainer state.AddressContainer) (string, error)

ConvertToHex -

func (*AddressConverterFake) CreateAddressFromHex

func (acf *AddressConverterFake) CreateAddressFromHex(hexAddress string) (state.AddressContainer, error)

CreateAddressFromHex -

func (*AddressConverterFake) CreateAddressFromPublicKeyBytes

func (acf *AddressConverterFake) CreateAddressFromPublicKeyBytes(pubKey []byte) (state.AddressContainer, error)

CreateAddressFromPublicKeyBytes -

func (*AddressConverterFake) IsInterfaceNil

func (acf *AddressConverterFake) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AddressConverterFake) PrepareAddressBytes

func (acf *AddressConverterFake) PrepareAddressBytes(addressBytes []byte) ([]byte, error)

PrepareAddressBytes -

type AddressMock

type AddressMock struct {
	Bts []byte
}

AddressMock -

func (*AddressMock) Bytes

func (address *AddressMock) Bytes() []byte

Bytes -

func (*AddressMock) IsInterfaceNil

func (address *AddressMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type CacherMock

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

CacherMock -

func NewCacherMock

func NewCacherMock() *CacherMock

NewCacherMock -

func (*CacherMock) Clear

func (cm *CacherMock) Clear()

Clear -

func (*CacherMock) Get

func (cm *CacherMock) Get(key []byte) (value interface{}, ok bool)

Get -

func (*CacherMock) Has

func (cm *CacherMock) Has(key []byte) bool

Has -

func (*CacherMock) HasOrAdd

func (cm *CacherMock) HasOrAdd(key []byte, value interface{}) (bool, bool)

HasOrAdd -

func (*CacherMock) IsInterfaceNil

func (cm *CacherMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CacherMock) Keys

func (cm *CacherMock) Keys() [][]byte

Keys -

func (*CacherMock) Len

func (cm *CacherMock) Len() int

Len -

func (*CacherMock) MaxSize

func (cm *CacherMock) MaxSize() int

MaxSize -

func (*CacherMock) Peek

func (cm *CacherMock) Peek(key []byte) (value interface{}, ok bool)

Peek -

func (*CacherMock) Put

func (cm *CacherMock) Put(key []byte, value interface{}) (evicted bool)

Put -

func (*CacherMock) RegisterHandler

func (cm *CacherMock) RegisterHandler(func(key []byte, value interface{}))

RegisterHandler -

func (*CacherMock) Remove

func (cm *CacherMock) Remove(key []byte)

Remove -

func (*CacherMock) RemoveOldest

func (cm *CacherMock) RemoveOldest()

RemoveOldest -

type EpochHandlerMock

type EpochHandlerMock struct {
	EpochValue uint32
}

EpochHandlerMock -

func (*EpochHandlerMock) Epoch

func (ehm *EpochHandlerMock) Epoch() uint32

Epoch -

func (*EpochHandlerMock) IsInterfaceNil

func (ehm *EpochHandlerMock) IsInterfaceNil() bool

IsInterfaceNil -

type EpochStartNotifierStub

type EpochStartNotifierStub struct {
	RegisterHandlerCalled   func(handler epochStart.EpochStartHandler)
	UnregisterHandlerCalled func(handler epochStart.EpochStartHandler)
	NotifyAllPrepareCalled  func(hdr data.HeaderHandler)
	NotifyAllCalled         func(hdr data.HeaderHandler)
}

EpochStartNotifierStub -

func (*EpochStartNotifierStub) IsInterfaceNil

func (esnm *EpochStartNotifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*EpochStartNotifierStub) NotifyAll

func (esnm *EpochStartNotifierStub) NotifyAll(hdr data.HeaderHandler)

NotifyAll -

func (*EpochStartNotifierStub) NotifyAllPrepare

func (esnm *EpochStartNotifierStub) NotifyAllPrepare(metaHeader data.HeaderHandler)

NotifyAllPrepare -

func (*EpochStartNotifierStub) RegisterHandler

func (esnm *EpochStartNotifierStub) RegisterHandler(handler epochStart.EpochStartHandler)

RegisterHandler -

func (*EpochStartNotifierStub) UnregisterHandler

func (esnm *EpochStartNotifierStub) UnregisterHandler(handler epochStart.EpochStartHandler)

UnregisterHandler -

type HasherMock

type HasherMock struct {
}

HasherMock that will be used for testing

func (*HasherMock) Compute

func (sha *HasherMock) Compute(s string) []byte

Compute will output the SHA's equivalent of the input string

func (*HasherMock) EmptyHash

func (sha *HasherMock) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (*HasherMock) IsInterfaceNil

func (sha *HasherMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HasherMock) Size

func (sha *HasherMock) Size() int

Size return the required size in bytes

type HasherStub

type HasherStub struct {
	ComputeCalled   func(s string) []byte
	EmptyHashCalled func() []byte
	SizeCalled      func() int
}

HasherStub -

func (*HasherStub) Compute

func (hs *HasherStub) Compute(s string) []byte

Compute will output the SHA's equivalent of the input string

func (*HasherStub) EmptyHash

func (hs *HasherStub) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (*HasherStub) IsInterfaceNil

func (hs *HasherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HasherStub) Size

func (hs *HasherStub) Size() int

Size returns the required size in bytes

type HeaderHandlerStub

type HeaderHandlerStub struct {
	GetPrevRandSeedCalled     func() []byte
	GetRandSeedCalled         func() []byte
	IsStartOfEpochBlockCalled func() bool
	GetEpochCaled             func() uint32
}

HeaderHandlerStub --

func (*HeaderHandlerStub) CheckChainID

func (hhs *HeaderHandlerStub) CheckChainID(_ []byte) error

CheckChainID -

func (*HeaderHandlerStub) Clone

func (hhs *HeaderHandlerStub) Clone() data.HeaderHandler

Clone --

func (*HeaderHandlerStub) GetAccumulatedFees

func (hhs *HeaderHandlerStub) GetAccumulatedFees() *big.Int

GetAccumulatedFees --

func (*HeaderHandlerStub) GetChainID

func (hhs *HeaderHandlerStub) GetChainID() []byte

GetChainID -

func (*HeaderHandlerStub) GetEpoch

func (hhs *HeaderHandlerStub) GetEpoch() uint32

GetEpoch -

func (*HeaderHandlerStub) GetEpochStartMetaHash

func (hhs *HeaderHandlerStub) GetEpochStartMetaHash() []byte

GetEpochStartMetaHash -

func (*HeaderHandlerStub) GetLeaderSignature

func (hhs *HeaderHandlerStub) GetLeaderSignature() []byte

GetLeaderSignature -

func (*HeaderHandlerStub) GetMiniBlockHeadersWithDst

func (hhs *HeaderHandlerStub) GetMiniBlockHeadersWithDst(_ uint32) map[string]uint32

GetMiniBlockHeadersWithDst -

func (*HeaderHandlerStub) GetMiniBlockProcessed

func (hhs *HeaderHandlerStub) GetMiniBlockProcessed(_ []byte) bool

GetMiniBlockProcessed -

func (*HeaderHandlerStub) GetNonce

func (hhs *HeaderHandlerStub) GetNonce() uint64

GetNonce -

func (*HeaderHandlerStub) GetPrevHash

func (hhs *HeaderHandlerStub) GetPrevHash() []byte

GetPrevHash -

func (*HeaderHandlerStub) GetPrevRandSeed

func (hhs *HeaderHandlerStub) GetPrevRandSeed() []byte

GetPrevRandSeed -

func (*HeaderHandlerStub) GetPubKeysBitmap

func (hhs *HeaderHandlerStub) GetPubKeysBitmap() []byte

GetPubKeysBitmap -

func (*HeaderHandlerStub) GetRandSeed

func (hhs *HeaderHandlerStub) GetRandSeed() []byte

GetRandSeed -

func (*HeaderHandlerStub) GetReceiptsHash

func (hhs *HeaderHandlerStub) GetReceiptsHash() []byte

GetReceiptsHash --

func (*HeaderHandlerStub) GetRootHash

func (hhs *HeaderHandlerStub) GetRootHash() []byte

GetRootHash -

func (*HeaderHandlerStub) GetRound

func (hhs *HeaderHandlerStub) GetRound() uint64

GetRound -

func (*HeaderHandlerStub) GetShardID

func (hhs *HeaderHandlerStub) GetShardID() uint32

GetShardID --

func (*HeaderHandlerStub) GetSignature

func (hhs *HeaderHandlerStub) GetSignature() []byte

GetSignature -

func (*HeaderHandlerStub) GetTimeStamp

func (hhs *HeaderHandlerStub) GetTimeStamp() uint64

GetTimeStamp -

func (*HeaderHandlerStub) GetTxCount

func (hhs *HeaderHandlerStub) GetTxCount() uint32

GetTxCount -

func (*HeaderHandlerStub) GetValidatorStatsRootHash

func (hhs *HeaderHandlerStub) GetValidatorStatsRootHash() []byte

GetValidatorStatsRootHash -

func (*HeaderHandlerStub) IsInterfaceNil

func (hhs *HeaderHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HeaderHandlerStub) IsStartOfEpochBlock

func (hhs *HeaderHandlerStub) IsStartOfEpochBlock() bool

IsStartOfEpochBlock --

func (*HeaderHandlerStub) ItemsInBody

func (hhs *HeaderHandlerStub) ItemsInBody() uint32

ItemsInBody -

func (*HeaderHandlerStub) ItemsInHeader

func (hhs *HeaderHandlerStub) ItemsInHeader() uint32

ItemsInHeader -

func (*HeaderHandlerStub) SetAccumulatedFees

func (hhs *HeaderHandlerStub) SetAccumulatedFees(_ *big.Int)

SetAccumulatedFees --

func (*HeaderHandlerStub) SetChainID

func (hhs *HeaderHandlerStub) SetChainID(_ []byte)

SetChainID -

func (*HeaderHandlerStub) SetEpoch

func (hhs *HeaderHandlerStub) SetEpoch(_ uint32)

SetEpoch -

func (*HeaderHandlerStub) SetLeaderSignature

func (hhs *HeaderHandlerStub) SetLeaderSignature(_ []byte)

SetLeaderSignature -

func (*HeaderHandlerStub) SetMiniBlockProcessed

func (hhs *HeaderHandlerStub) SetMiniBlockProcessed(_ []byte, _ bool)

SetMiniBlockProcessed -

func (*HeaderHandlerStub) SetNonce

func (hhs *HeaderHandlerStub) SetNonce(_ uint64)

SetNonce -

func (*HeaderHandlerStub) SetPrevHash

func (hhs *HeaderHandlerStub) SetPrevHash(_ []byte)

SetPrevHash -

func (*HeaderHandlerStub) SetPrevRandSeed

func (hhs *HeaderHandlerStub) SetPrevRandSeed(_ []byte)

SetPrevRandSeed -

func (*HeaderHandlerStub) SetPubKeysBitmap

func (hhs *HeaderHandlerStub) SetPubKeysBitmap(_ []byte)

SetPubKeysBitmap -

func (*HeaderHandlerStub) SetRandSeed

func (hhs *HeaderHandlerStub) SetRandSeed(_ []byte)

SetRandSeed -

func (*HeaderHandlerStub) SetRootHash

func (hhs *HeaderHandlerStub) SetRootHash(_ []byte)

SetRootHash -

func (*HeaderHandlerStub) SetRound

func (hhs *HeaderHandlerStub) SetRound(_ uint64)

SetRound -

func (*HeaderHandlerStub) SetShardID

func (hhs *HeaderHandlerStub) SetShardID(_ uint32)

SetShardID --

func (*HeaderHandlerStub) SetSignature

func (hhs *HeaderHandlerStub) SetSignature(_ []byte)

SetSignature -

func (*HeaderHandlerStub) SetTimeStamp

func (hhs *HeaderHandlerStub) SetTimeStamp(_ uint64)

SetTimeStamp -

func (*HeaderHandlerStub) SetTxCount

func (hhs *HeaderHandlerStub) SetTxCount(_ uint32)

SetTxCount -

func (*HeaderHandlerStub) SetValidatorStatsRootHash

func (hhs *HeaderHandlerStub) SetValidatorStatsRootHash(_ []byte)

SetValidatorStatsRootHash -

type NodesCoordinatorCacheMock

type NodesCoordinatorCacheMock struct {
	PutCalled func(key []byte, value interface{}) (evicted bool)
	GetCalled func(key []byte) (value interface{}, ok bool)
}

NodesCoordinatorCacheMock -

func (*NodesCoordinatorCacheMock) Get

func (rm *NodesCoordinatorCacheMock) Get(key []byte) (value interface{}, ok bool)

Get -

func (*NodesCoordinatorCacheMock) Put

func (rm *NodesCoordinatorCacheMock) Put(key []byte, value interface{}) (evicted bool)

Put -

type RaterMock

type RaterMock struct {
	ComputeRatingCalled  func(string, uint32) uint32
	GetRatingCalled      func(string) uint32
	GetStartRatingCalled func() uint32
	GetChancesCalled     func(uint32) uint32
}

RaterMock -

func (*RaterMock) ComputeRating

func (rm *RaterMock) ComputeRating(ratingOptionKey string, previousValue uint32) uint32

ComputeRating -

func (*RaterMock) GetChance

func (rm *RaterMock) GetChance(rating uint32) uint32

GetChance -

func (*RaterMock) GetRating

func (rm *RaterMock) GetRating(pk string) uint32

GetRating -

func (*RaterMock) GetStartRating

func (rm *RaterMock) GetStartRating() uint32

GetStartRating -

func (*RaterMock) IsInterfaceNil

func (rm *RaterMock) IsInterfaceNil() bool

IsInterfaceNil -

type StorerMock

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

StorerMock -

func NewStorerMock

func NewStorerMock() *StorerMock

NewStorerMock -

func (*StorerMock) ClearCache

func (sm *StorerMock) ClearCache()

ClearCache -

func (*StorerMock) Close

func (sm *StorerMock) Close() error

Close -

func (*StorerMock) DestroyUnit

func (sm *StorerMock) DestroyUnit() error

DestroyUnit -

func (*StorerMock) Get

func (sm *StorerMock) Get(key []byte) ([]byte, error)

Get -

func (*StorerMock) GetFromEpoch

func (sm *StorerMock) GetFromEpoch(key []byte, _ uint32) ([]byte, error)

GetFromEpoch -

func (*StorerMock) Has

func (sm *StorerMock) Has(_ []byte) error

Has -

func (*StorerMock) HasInEpoch

func (sm *StorerMock) HasInEpoch(_ []byte, _ uint32) error

HasInEpoch -

func (*StorerMock) IsInterfaceNil

func (sm *StorerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*StorerMock) Put

func (sm *StorerMock) Put(key, data []byte) error

Put -

func (*StorerMock) Remove

func (sm *StorerMock) Remove(_ []byte) error

Remove -

func (*StorerMock) SearchFirst

func (sm *StorerMock) SearchFirst(key []byte) ([]byte, error)

SearchFirst -

type ValidatorMock

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

ValidatorMock -

func NewValidatorMock

func NewValidatorMock(pubKey []byte, address []byte, chances uint32) *ValidatorMock

NewValidatorMock -

func (*ValidatorMock) Address

func (vm *ValidatorMock) Address() []byte

Address -

func (*ValidatorMock) Chances added in v0.0.5

func (vm *ValidatorMock) Chances() uint32

Chances -

func (*ValidatorMock) Clone added in v0.0.5

func (vm *ValidatorMock) Clone() (interface{}, error)

Clone clones the validator

func (*ValidatorMock) PubKey

func (vm *ValidatorMock) PubKey() []byte

PubKey -

func (*ValidatorMock) SetChances added in v0.0.5

func (vm *ValidatorMock) SetChances(chances uint32)

SetChances -

Jump to

Keyboard shortcuts

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