use crate::ops::workgroup::stack::{StackError, WorkgroupStack};
#[test]
pub fn push_then_pop_is_identity() {
let mut stack: WorkgroupStack<u32> = WorkgroupStack::new(2);
assert!(stack.push(7_u32).is_ok());
assert_eq!(stack.pop(), Ok(7));
assert!(stack.is_empty());
}
#[test]
pub fn overflow_is_reported_without_mutation() {
let mut stack: WorkgroupStack<u32> = WorkgroupStack::new(1);
assert!(stack.push(11_u32).is_ok());
assert_eq!(stack.push(12), Err(StackError::Overflow));
assert_eq!(stack.len(), 1);
assert_eq!(stack.peek(), Ok(11));
}
#[test]
pub fn wgsl_kernel_source_exposes_the_expected_entry_point() {
let wgsl = crate::ops::workgroup::stack::lowering::WGSL;
let entry = crate::ops::workgroup::stack::lowering::ENTRY_POINT;
assert!(wgsl.contains(entry), "WGSL missing entry point {entry}");
assert!(crate::ops::workgroup::stack::lowering::exposes_registered_entry_point());
}