Module testutil

Source
Expand description

Test utilities provided to all crates.

Structs§

FakeAtomicInstant
A fake implementation of AtomicInstant for use in testing.
FakeBindingsCtx
A test helper used to provide an implementation of a bindings context.
FakeCoreCtx
A test helper used to provide an implementation of a core context.
FakeCryptoRng
A wrapper which implements RngCore and CryptoRng for any RngCore.
FakeDeviceId
A fake device ID for use in testing.
FakeEventCtx
A fake EventContext.
FakeFrameCtx
A fake [FrameContext].
FakeInstant
A fake implementation of Instant for use in testing.
FakeInstantCtx
A fake InstantContext which stores the current time as a FakeInstant.
FakeLinkAddress
A fake LinkAddress.
FakeLinkDeviceId
A fake ID identifying a FakeLinkDevice.
FakeNetwork
A fake network, composed of many FakeCoreCtxs.
FakeReferencyDeviceId
A fake device ID for use in testing.
FakeSocketWritableListener
A fake SocketWritableListener implementation.
FakeTimerCtx
A fake TimerContext which stores time as a FakeInstantCtx.
FakeTimerId
The unique timer identifier for [FakeTimer].
FakeTxMetadata
The fake metadata supported by FakeBindingsCtx.
FakeWeakAddressId
A fake weak address ID.
FakeWeakDeviceId
A fake weak device id.
InstantAndData
Arbitrary data of type D attached to a FakeInstant.
MonotonicIdentifier
A convenient monotonically increasing identifier to use in tests.
MultipleDevicesIdState
Holds per-device state for a MultipleDevicesId.
PendingFrameData
The data associated with a FakeNetwork’s pending frame.
RealBencher
An alias for the bencher used in real benchmarks. Timer struct to iterate a benchmarked function and measure the runtime.
StepResult
The result of a single step in a FakeNetwork
TestAddrs
A configuration for a simple network.
TestBencher
A Bencher whose iter method runs the provided argument a small, fixed number of times.

Enums§

FakeLinkDevice
A fake LinkDevice.
MultipleDevicesId
A device ID type that supports identifying more than one distinct device.

Constants§

TEST_ADDRS_V4
A TestAddrs with reasonable values for an IPv4 network.
TEST_ADDRS_V6
A TestAddrs with reasonable values for an IPv6 network.

Traits§

AlwaysDefaultsSettingsContext
A marker trait that allows a type to implement SettingsContext that always yields a default value for the settings type.
Bencher
A trait to allow faking of the type providing benchmarking.
FakeNetworkLinks
A set of links in a FakeNetwork.
FakeNetworkSpec
A network spec that defines a FakeNetwork.
FakeStrongDeviceId
Marks a fake strong device id.
FakeTimerCtxExt
Adds methods for interacting with FakeTimerCtx and its wrappers.
TestDualStackIpExt
An extension trait for Ip providing test-related functionality.
TestIpExt
An extension trait for Ip providing test-related functionality.
WithFakeFrameContext
A trait for abstracting contexts that may contain a FakeFrameCtx.
WithFakeTimerContext
A trait abstracting access to a FakeTimerCtx instance.

Functions§

assert_empty
Asserts that an iterable object produces zero items.
new_rng
Create a new deterministic RNG from a seed.
run_with_many_seeds
Invokes a function multiple times with different RNG seeds.
set_logger_for_test
Install a logger for tests.

Type Aliases§

PendingFrame
A PendingFrameData and the instant it was sent.