Skip to main content

jugar_probar/tui/
mod.rs

1//! TUI Testing Support (Feature 21 - EDD Compliance)
2//!
3//! Test terminal user interfaces with zero external dependencies.
4//! Uses custom TextGrid and MockTty for 100% provable UX.
5//!
6//! ## EXTREME TDD: Tests written FIRST per spec
7//!
8//! ## Toyota Way Application
9//!
10//! - **Poka-Yoke**: Type-safe frame capture with TextGrid
11//! - **Muda**: Direct buffer comparison without rendering overhead
12//! - **Genchi Genbutsu**: MockTty reflects actual terminal behavior
13//! - **Jidoka**: Fail-fast on frame mismatch
14//!
15//! ## ComputeBlock Testing (PROBAR-SPEC-009)
16//!
17//! With the `compute-blocks` feature, probar supports testing presentar-terminal
18//! ComputeBlocks with SIMD verification and latency budget assertions.
19//!
20//! ```ignore
21//! use jugar_probar::tui::{ComputeBlockAssertion, assert_brick_valid};
22//! use presentar_terminal::SparklineBlock;
23//!
24//! let block = SparklineBlock::new(60);
25//! assert_brick_valid(&block).unwrap();
26//!
27//! ComputeBlockAssertion::new(&block)
28//!     .to_have_simd_support()
29//!     .to_have_latency_under(100);
30//! ```
31
32mod assertions;
33mod backend;
34mod buffer;
35mod snapshot;
36mod tty;
37
38// Brick and ComputeBlock testing (optional, requires presentar-terminal)
39#[cfg(feature = "compute-blocks")]
40mod brick;
41#[cfg(feature = "compute-blocks")]
42mod compute_block;
43
44pub use assertions::{expect_frame, FrameAssertion, MultiValueTracker, ValueTracker};
45pub use backend::{FrameDiff, LineDiff, TuiFrame, TuiTestBackend};
46pub use buffer::TextGrid;
47pub use snapshot::{FrameSequence, SnapshotManager, TuiSnapshot};
48pub use tty::{AnsiCommand, ClearMode, MockTty};
49
50// Re-export Brick testing utilities
51#[cfg(feature = "compute-blocks")]
52pub use brick::{
53    assert_brick_budget, assert_brick_valid, brick_verification_score, BrickAssertionResult,
54    BrickTestAssertion, BrickVerificationError, BudgetExceededError,
55};
56
57// Re-export ComputeBlock testing utilities
58#[cfg(feature = "compute-blocks")]
59pub use compute_block::{
60    assert_compute_latency, assert_simd_available, detect_simd, simd_available,
61    ComputeBlockAssertion, LatencyBudgetError, SimdNotAvailableError,
62};
63
64// Re-export presentar-terminal types for convenience
65#[cfg(feature = "compute-blocks")]
66pub use presentar_terminal::{
67    ComputeBlock, ComputeBlockId, CpuFrequencyBlock, CpuGovernor, CpuGovernorBlock,
68    FrequencyScalingState, GpuThermalBlock, GpuThermalState, GpuVramBlock, HugePagesBlock,
69    LoadTrendBlock, MemPressureBlock, MemoryPressureLevel, SimdInstructionSet, SparklineBlock,
70};
71
72// Note: Brick, BrickAssertion, BrickBudget, BrickVerification are exported
73// from the main jugar_probar::brick module (probar defines the trait, presentar uses it)