mock

package
v1.0.88 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 9 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 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 NodesCoordinatorCacheMock

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

func (*NodesCoordinatorCacheMock) Get

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

func (*NodesCoordinatorCacheMock) Put

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

type NodesCoordinatorMock added in v1.0.20

type NodesCoordinatorMock struct {
	ComputeValidatorsGroupCalled  func([]byte) ([]sharding.Validator, error)
	GetValidatorsPublicKeysCalled func(randomness []byte) ([]string, error)
}

NodesCoordinatorMock -

func (NodesCoordinatorMock) ComputeValidatorsGroup added in v1.0.20

func (ncm NodesCoordinatorMock) ComputeValidatorsGroup(randomness []byte) (validatorsGroup []sharding.Validator, err error)

ComputeValidatorsGroup -

func (NodesCoordinatorMock) ConsensusGroupSize added in v1.0.20

func (ncm NodesCoordinatorMock) ConsensusGroupSize() int

ConsensusGroupSize -

func (NodesCoordinatorMock) GetSelectedPublicKeys added in v1.0.20

func (ncm NodesCoordinatorMock) GetSelectedPublicKeys(selection []byte) (publicKeys []string, err error)

GetSelectedPublicKeys -

func (NodesCoordinatorMock) GetValidatorWithPublicKey added in v1.0.20

func (ncm NodesCoordinatorMock) GetValidatorWithPublicKey(publicKey []byte) (sharding.Validator, uint32, error)

GetValidatorWithPublicKey -

func (NodesCoordinatorMock) GetValidatorsPublicKeys added in v1.0.20

func (ncm NodesCoordinatorMock) GetValidatorsPublicKeys(randomness []byte) ([]string, error)

GetValidatorsPublicKeys -

func (NodesCoordinatorMock) SetConsensusGroupSize added in v1.0.20

func (ncm NodesCoordinatorMock) SetConsensusGroupSize(int) error

SetConsensusGroupSize -

func (NodesCoordinatorMock) SetNodesPerShards added in v1.0.20

func (ncm NodesCoordinatorMock) SetNodesPerShards(map[uint32][]sharding.Validator) error

SetNodesPerShards -

type RaterMock

type RaterMock struct {
	ComputeRatingCalled  func(string, uint32) uint32
	GetRatingCalled      func(string) uint32
	GetRatingsCalled     func([]string) map[string]uint32
	GetStartRatingCalled func() uint32
}

RaterMock -

func (*RaterMock) ComputeRating

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

ComputeRating -

func (*RaterMock) GetRating

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

GetRating -

func (*RaterMock) GetRatings added in v1.0.67

func (rm *RaterMock) GetRatings(pks []string) map[string]uint32

GetRatings -

func (*RaterMock) GetStartRating

func (rm *RaterMock) GetStartRating() uint32

GetStartRating -

func (*RaterMock) IsInterfaceNil

func (rm *RaterMock) IsInterfaceNil() bool

IsInterfaceNil -

type ValidatorMock

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

ValidatorMock -

func NewValidatorMock

func NewValidatorMock(stake *big.Int, rating int32, pubKey []byte, address []byte) *ValidatorMock

NewValidatorMock -

func (*ValidatorMock) Address

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

Address -

func (*ValidatorMock) PubKey

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

PubKey -

func (*ValidatorMock) Rating added in v1.0.20

func (vm *ValidatorMock) Rating() int32

Rating -

func (*ValidatorMock) Stake added in v1.0.20

func (vm *ValidatorMock) Stake() *big.Int

Stake -

Jump to

Keyboard shortcuts

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