[][src]Crate tari_test_utils

Tari Test Utilities

This crate contains some commonly useful test utilities for testing Tari codebase.

Modules

  • futures - Contains utilities which make testing future-based code easier
  • paths - Contains utilities which return and create paths which are useful for tests involving files
  • random - Contains utilities to making generating random values easier

Modules

address
enums
futures
paths
random
runtime
streams

Macros

async_assert_eventually

Periodically check if a value becomes the expected value within a maximum number of attempts. The reason this has an 'async' in the name is because this doesn't use thread::sleep, but rather tokio::timer::delay(...). Therefore, needs to be in an async context using tokio threadpool.

collect_stream

Collect $take items from a stream or timeout for Duration $timeout. Requires the tokio runtime

collect_stream_count

Returns a HashMap of the number of occurrences of a particular item in a stream.

counter_context

Creates a test counter future Context.

panic_context

Creates a test counter future Context.

unpack_enum

Unpack the tuple or struct variant variables from an enum.