stepflow_test_util/lib.rs
1pub fn test_id_val() -> u32 {
2 use std::sync::atomic::{AtomicU32, Ordering};
3 static COUNT: AtomicU32 = AtomicU32::new(0);
4
5 // add extra bits to make it easy to identiy test IDs
6 (u16::MAX as u32) << 16 | COUNT.fetch_add(1, Ordering::SeqCst)
7}
8
9#[macro_export]
10macro_rules! test_id {
11 ($id_type:ident) => {
12 $id_type::new(stepflow_test_util::test_id_val())
13 }
14}