Expand description
Test utilities and helpers for testing.
This module provides helpers and utilities to simplify writing tests across the CHIE codebase.
§Example
use chie_core::test_utils::{MockPeerBuilder, random_cid, TempDir};
// Create mock peer
let peer = MockPeerBuilder::new("peer1")
.with_reputation(0.8)
.build();
// Generate random test data
let cid = random_cid();
let temp_dir = TempDir::new("test").unwrap();Structs§
- Mock
Config - Mock configuration for testing.
- Mock
Peer - Mock peer data.
- Mock
Peer Builder - Builder for creating mock peer data.
- TempDir
- Helper for creating temporary test directories.
Functions§
- assert_
approx_ eq - Assert that two floats are approximately equal.
- random_
bytes - Generate random bytes for testing.
- random_
cid - Generate a random CID for testing.
- random_
peer_ id - Generate a random peer ID for testing.