mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-17 09:21:33 +00:00
30 lines
796 B
Rust
30 lines
796 B
Rust
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());
|
|
}
|