Documentation ¶
Overview ¶
Package test contains implementations of the peer interfaces that are useful for testing.
Index ¶
- func AuthMsgsSerializationTest(t *testing.T, serializerTest func(t *testing.T, msg wire.Msg))
- func ControlMsgsSerializationTest(t *testing.T, serializerTest func(t *testing.T, msg wire.Msg))
- func GenericBusTest(t *testing.T, busAssigner func(wire.Account) (pub wire.Bus, sub wire.Bus), ...)
- func GenericMarshalerTest(t *testing.T, serializers ...binary)
- func NewRandomAccount(rng *rand.Rand) wire.Account
- func NewRandomAddress(rng *rand.Rand) wire.Address
- func NewRandomAddresses(rng *rand.Rand, n int) []wire.Address
- func NewRandomEnvelope(rng *rand.Rand, m wire.Msg) *wire.Envelope
- func SetNewRandomAccount(f NewRandomAccountFunc)
- func SetNewRandomAddress(f NewRandomAddressFunc)
- func TestAddressImplementation(t *testing.T, newAddress wire.NewAddressFunc, ...)
- type NewRandomAccountFunc
- type NewRandomAddressFunc
- type SerializingLocalBus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMsgsSerializationTest ¶ added in v0.9.0
AuthMsgsSerializationTest runs serialization tests on auth message.
func ControlMsgsSerializationTest ¶ added in v0.9.0
ControlMsgsSerializationTest runs serialization tests on control messages.
func GenericBusTest ¶
func GenericBusTest(t *testing.T, busAssigner func(wire.Account) (pub wire.Bus, sub wire.Bus), numClients, numMsgs int, )
GenericBusTest tests the general functionality of a bus in the happy case: it tests that messages sent over the bus arrive at the correct destination. The parameter numClients controls how many clients communicate over the bus, and numMsgs controls how many messages each client sends to all other clients. The parameter busAssigner is used to assign a bus to each client, and must perform any necessary work to make clients able to communicate with each other (such as setting up dialers and listeners, in case of networking). It can either return the same bus twice, or separately select a bus to subscribe the client to, and a bus the client should use for publishing messages.
func GenericMarshalerTest ¶ added in v0.9.0
GenericMarshalerTest runs multiple tests to check whether encoding and decoding of serializer values works.
func NewRandomAccount ¶ added in v0.10.1
NewRandomAccount returns a new random account.
func NewRandomAddress ¶
NewRandomAddress returns a new random address.
func NewRandomAddresses ¶
NewRandomAddresses returns a slice of random peer addresses.
func NewRandomEnvelope ¶
NewRandomEnvelope returns an envelope around message m with random sender and recipient generated using randomness from rng.
func SetNewRandomAccount ¶ added in v0.10.1
func SetNewRandomAccount(f NewRandomAccountFunc)
SetNewRandomAccount sets the account randomizer function.
func SetNewRandomAddress ¶ added in v0.10.1
func SetNewRandomAddress(f NewRandomAddressFunc)
SetNewRandomAddress sets the address randomizer function.
func TestAddressImplementation ¶ added in v0.10.1
func TestAddressImplementation(t *testing.T, newAddress wire.NewAddressFunc, newRandomAddress NewRandomAddressFunc)
TestAddressImplementation runs a test suite designed to test the general functionality of an address implementation.
Types ¶
type NewRandomAccountFunc ¶ added in v0.10.1
NewRandomAccountFunc is a account randomizer function.
type NewRandomAddressFunc ¶ added in v0.10.1
NewRandomAddressFunc is a address randomizer function.
type SerializingLocalBus ¶ added in v0.7.0
SerializingLocalBus is a local bus that also serializes messages for testing.
func NewSerializingLocalBus ¶ added in v0.7.0
func NewSerializingLocalBus() *SerializingLocalBus
NewSerializingLocalBus creates a new serializing local bus.