use std::sync::Arc;
use crate::clock::{Hlc, LogicalCounter, ManualClock, NodeId, PhysicalTime, Timestamp};
use crate::replica::Replica;
use crate::replicated_map::Config;
#[tokio::test]
async fn engine_mints_through_the_injected_clock() {
let config = Config::default()
.with_port(8080)
.with_listen_addr("127.0.0.70".parse().unwrap())
.with_insecure_no_key();
let clock = Arc::new(ManualClock::new(NodeId::new(42)));
let eng: Replica<i32, i32> = Replica::new_with_clock(config, clock)
.await
.expect("bind failed");
assert_eq!(
eng.clock_now(),
Timestamp::new(
Hlc::new(PhysicalTime::from_millis(0), LogicalCounter::new(1)),
NodeId::new(42)
)
);
assert_eq!(
eng.clock_now(),
Timestamp::new(
Hlc::new(PhysicalTime::from_millis(0), LogicalCounter::new(2)),
NodeId::new(42)
)
);
}