use super::sort_batch_by_slot;
#[test]
fn batched_verify_dispatch_is_slot_order_not_arrival_order() {
let slots = [Some(3usize), Some(1), Some(2)];
let mut by_slot = vec![0usize, 1, 2];
sort_batch_by_slot(&mut by_slot, |i| slots[i]);
let dispatched: Vec<usize> = by_slot.iter().map(|&i| slots[i].unwrap()).collect();
assert_eq!(
dispatched,
vec![1, 2, 3],
"the batch must be dispatched in ascending ssm-slot order — arrival \
order fails the consecutive-slot pointer check and declines the \
batched verify"
);
}
#[test]
fn slotless_sequences_sort_last_and_index_breaks_ties() {
let slots = [None, Some(5usize), None, Some(0)];
let mut by_slot = vec![0usize, 1, 2, 3];
sort_batch_by_slot(&mut by_slot, |i| slots[i]);
assert_eq!(
by_slot,
vec![3, 1, 0, 2],
"slotted ascending first (0 then 5), then slotless by active index"
);
}