testutils

package
v0.0.0-...-8e980cd Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceMock

type DeviceMock struct {
	Contacts            *device.MemoryContactsContainer
	PacketsSent         [][]byte
	PacketsReceived     []device.MessageID
	MessagesReceived    [][]byte
	Sessions            []device.SessionID
	SessionsEstablished int
	SessionsBroken      int
	DelayActions        []func()
	SyncState           map[device.ContactID][]byte
	// contains filtered or unexported fields
}

func NewDeviceMock

func NewDeviceMock(t testing.TB, random *rand.Rand) *DeviceMock

func (*DeviceMock) ContactsContainer

func (d *DeviceMock) ContactsContainer() device.ContactsContainer

ContactsContainer implements device.Device.

func (*DeviceMock) CryptoRand

func (d *DeviceMock) CryptoRand() io.Reader

CryptoRand implements device.Device.

func (*DeviceMock) Delay

func (d *DeviceMock) Delay(action func(), duration time.Duration)

Delay implements device.Device.

func (*DeviceMock) ExecuteNextDelayAction

func (d *DeviceMock) ExecuteNextDelayAction()

func (*DeviceMock) Log

func (d *DeviceMock) Log(message string)

Log implements device.Device.

func (*DeviceMock) MaxPacketSize

func (d *DeviceMock) MaxPacketSize(address device.DeviceAddress) (int, error)

MaxPacketSize implements device.Device.

func (*DeviceMock) MessageDelivered

func (d *DeviceMock) MessageDelivered(messageID device.MessageID)

PacketReceived implements device.Device.

func (*DeviceMock) Now

func (d *DeviceMock) Now() time.Time

Now implements device.Device.

func (*DeviceMock) PopLastPacket

func (d *DeviceMock) PopLastPacket() []byte

func (*DeviceMock) ProcessMessage

func (d *DeviceMock) ProcessMessage(session device.SessionID, message []byte)

ProcessMessage implements device.Device.

func (*DeviceMock) Rand

func (d *DeviceMock) Rand() *rand.Rand

Rand implements device.Device.

func (*DeviceMock) ReplyPayload

func (d *DeviceMock) ReplyPayload(session device.SessionID, contact device.ContactID) []byte

ReplyPayload implements device.Device.

func (*DeviceMock) SendPacket

func (d *DeviceMock) SendPacket(address device.DeviceAddress, packet []byte)

SendPacket implements device.Device.

func (*DeviceMock) SessionBroken

func (d *DeviceMock) SessionBroken(session device.SessionID)

SessionBroken implements device.Device.

func (*DeviceMock) SessionEstablished

func (d *DeviceMock) SessionEstablished(session device.SessionID, contact device.ContactID, address device.DeviceAddress)

SessionEstablished implements device.Device.

func (*DeviceMock) SyncStateChanged

func (d *DeviceMock) SyncStateChanged(contact device.ContactID, stateUpdate []byte)

SyncStateChanged implements device.Device.

Jump to

Keyboard shortcuts

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