klauthed-testing 0.1.0

Test utilities for klauthed services, used as a dev-dependency.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Drive a deterministic clock in tests/fixtures.
//!
//! Run with: `cargo run -p klauthed-testing --example fixed_clock`

use klauthed_testing::clock::{Clock, Duration, fixed_clock};

fn main() {
    let clock = fixed_clock(0);
    println!("t0 = {}", clock.now());

    clock.advance(Duration::hours(1));
    println!("t1 = {} (advanced 1h)", clock.now());

    clock.advance(Duration::minutes(-30));
    println!("t2 = {} (rewound 30m)", clock.now());
}