Crate tari_test_utils

Source
Expand description

§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§

enums
futures
paths
random
runtime
streams

Macros§

async_assert
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.
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 from an enum variant. Each extracted variable is decalred as mutable for maximum flexibility.