// file: crates/ksp-interface-lib/unit_tests/slot_lifecycle.rs // version: 2 #[test] fn slot_lifecycle_stages_are_distinct_copy_and_complete_for_the_admitted_family() { fn assert_copy() {} assert_copy::(); let stages = [ crate::SlotLifecycleStage::Processed, crate::SlotLifecycleStage::FirstShredReceived, crate::SlotLifecycleStage::Completed, crate::SlotLifecycleStage::CreatedBank, crate::SlotLifecycleStage::Dead, crate::SlotLifecycleStage::OptimisticallyConfirmed, crate::SlotLifecycleStage::Rooted, ]; for (index, stage) in stages.iter().enumerate() { for other in stages.iter().skip(index + 1) { assert_ne!(stage, other); } } } #[test] fn slot_lifecycle_event_preserves_full_u64_slot_and_stage() { fn assert_copy() {} assert_copy::(); let event = crate::SlotLifecycleEvent::new(u64::MAX, crate::SlotLifecycleStage::Rooted); assert_eq!(event.slot(), u64::MAX); assert_eq!(event.stage(), crate::SlotLifecycleStage::Rooted); let copied = event; assert_eq!(event, copied); } #[test] fn slot_lifecycle_debug_is_bounded_and_contains_only_shared_fields() { let event = crate::SlotLifecycleEvent::new(42, crate::SlotLifecycleStage::OptimisticallyConfirmed); let debug = std::format!("{event:?}"); assert!(debug.len() <= 128); assert!(debug.contains("slot: 42")); assert!(debug.contains("OptimisticallyConfirmed")); assert!(!debug.contains("provider")); assert!(!debug.contains("yellowstone")); assert!(!debug.contains("websocket")); }