tearup 0.3.0

Setup - teardown your tests
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::{sync::Mutex, time::SystemTime};

pub type Checkpoint = Mutex<Option<SystemTime>>;
pub type AsyncCheckpoint = tokio::sync::Mutex<Option<SystemTime>>;

pub fn assert_order(checkpoint_before: &Checkpoint, checkpoint_after: &Checkpoint) {
    assert!(checkpoint_before.lock().unwrap().unwrap() < checkpoint_after.lock().unwrap().unwrap());
}

pub async fn assert_async_order(
    checkpoint_before: &AsyncCheckpoint,
    checkpoint_after: &AsyncCheckpoint,
) {
    assert!(checkpoint_before.lock().await.unwrap() < checkpoint_after.lock().await.unwrap());
}