v0.3.5-pre.002
This commit is contained in:
29
crates/ksp-interface-lib/tests/slot_lifecycle_public_api.rs
Normal file
29
crates/ksp-interface-lib/tests/slot_lifecycle_public_api.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
// file: crates/ksp-interface-lib/tests/slot_lifecycle_public_api.rs
|
||||
// version: 1
|
||||
|
||||
#[test]
|
||||
fn public_v0_3_5_pre_002_slot_lifecycle_contract_is_available_from_crate_root() {
|
||||
let event = ksp_interface_lib::SlotLifecycleEvent::new(u64::MAX, ksp_interface_lib::SlotLifecycleStage::Rooted);
|
||||
|
||||
assert_eq!(event.slot(), u64::MAX);
|
||||
assert_eq!(event.stage(), ksp_interface_lib::SlotLifecycleStage::Rooted);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public_v0_3_5_pre_002_slot_lifecycle_stage_remains_downstream_evolvable() {
|
||||
fn stage_label(stage: ksp_interface_lib::SlotLifecycleStage) -> &'static str {
|
||||
return match stage {
|
||||
ksp_interface_lib::SlotLifecycleStage::Processed => "processed",
|
||||
ksp_interface_lib::SlotLifecycleStage::FirstShredReceived => "first_shred_received",
|
||||
ksp_interface_lib::SlotLifecycleStage::Completed => "completed",
|
||||
ksp_interface_lib::SlotLifecycleStage::CreatedBank => "created_bank",
|
||||
ksp_interface_lib::SlotLifecycleStage::Dead => "dead",
|
||||
ksp_interface_lib::SlotLifecycleStage::OptimisticallyConfirmed => "optimistically_confirmed",
|
||||
ksp_interface_lib::SlotLifecycleStage::Rooted => "rooted",
|
||||
_ => "future",
|
||||
};
|
||||
}
|
||||
|
||||
assert_eq!(stage_label(ksp_interface_lib::SlotLifecycleStage::Processed), "processed");
|
||||
assert_eq!(stage_label(ksp_interface_lib::SlotLifecycleStage::Rooted), "rooted");
|
||||
}
|
||||
Reference in New Issue
Block a user