telltale_runtime/testing/mod.rs
1//! Testing utilities for choreographic protocols
2//!
3//! This module provides building blocks for protocol testing, simulation,
4//! and integration with external simulators like aura-simulator.
5//!
6//! # Overview
7//!
8//! The testing module provides:
9//!
10//! - **Deterministic execution**: `Clock` and `Rng` traits for reproducible runs
11//! - **State machines**: `ProtocolStateMachine` for step-by-step execution
12//! - **Transport abstraction**: `SimulatedTransport` for custom message delivery
13//! - **Event observation**: `ProtocolObserver` for monitoring protocol execution
14//! - **Message envelopes**: `ProtocolEnvelope` for structured message passing
15//!
16//! # Architecture
17//!
18//! ```text
19//! ┌─────────────────────────────────────────────────────────────┐
20//! │ Simulator / Test Harness │
21//! └─────────────────────────────────────────────────────────────┘
22//! │
23//! ┌──────────────────┼──────────────────┐
24//! │ │ │
25//! ▼ ▼ ▼
26//! ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
27//! │ Clock │ │ Rng │ │ Observer │
28//! │ Trait │ │ Trait │ │ Trait │
29//! └─────────────┘ └─────────────┘ └─────────────┘
30//! │
31//! ▼
32//! ┌─────────────────────────────────────────────────────────┐
33//! │ ProtocolStateMachine │
34//! │ blocked_on() -> BlockedOn │
35//! │ step(input) -> StepOutput │
36//! │ checkpoint() / restore() │
37//! └─────────────────────────────────────────────────────────┘
38//! │
39//! ▼
40//! ┌─────────────────────────────────────────────────────────┐
41//! │ SimulatedTransport │
42//! │ send(to, envelope) -> Result │
43//! │ recv(from) -> Result<Envelope> │
44//! └─────────────────────────────────────────────────────────┘
45//! ```
46
47pub mod clock;
48pub mod envelope;
49pub mod observer;
50pub mod state_machine;
51pub mod transport;
52
53// Re-export main types
54pub use clock::{AsyncClock, Clock, MockClock, Rng, SeededRng, WallClock};
55pub use envelope::ProtocolEnvelope;
56pub use observer::{NullObserver, ProtocolObserver, RecordingObserver};
57pub use state_machine::{BlockedOn, Checkpoint, ProtocolStateMachine, StepInput, StepOutput};
58pub use transport::{
59 AsyncSimulatedTransport, InMemoryTransport, SimulatedTransport, TransportError,
60};