pub use axess_identity::SessionId;
#[cfg(test)]
mod tests {
use super::*;
use crate::testing::mock_random::MockRng;
#[test]
fn deterministic_with_mock_rng() {
let r1 = MockRng::new(42);
let r2 = MockRng::new(42);
assert_eq!(SessionId::new(&r1), SessionId::new(&r2));
}
#[test]
fn roundtrip_display_fromstr() {
let rng = MockRng::new(7);
let id = SessionId::new(&rng);
let s = id.to_string();
let id2: SessionId = s.parse().expect("parse");
assert_eq!(id, id2);
}
#[test]
fn as_uuid_returns_underlying_uuid() {
let rng = MockRng::new(11);
let id = SessionId::new(&rng);
let uuid = id.as_uuid();
assert_eq!(uuid.as_bytes(), id.as_bytes());
assert_ne!(uuid, uuid::Uuid::nil(), "session id must not be nil");
}
}