1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
extern crate psm;
#[inline(never)]
fn test_direction(previous_sp: *mut u8) {
let current_sp = psm::stack_pointer();
match psm::StackDirection::new() {
psm::StackDirection::Ascending => {
assert!(
current_sp > previous_sp,
"the stack pointer is not ascending! current = {:p}, previous = {:p}",
current_sp,
previous_sp
);
}
psm::StackDirection::Descending => {
assert!(
current_sp < previous_sp,
"the stack pointer is not descending! current = {:p}, previous = {:p}",
current_sp,
previous_sp
);
}
}
}
#[test]
fn direction_right() {
test_direction(psm::stack_pointer());
}
|