diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /vendor/psm/tests | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/psm/tests')
-rw-r--r-- | vendor/psm/tests/stack_direction.rs | 6 | ||||
-rw-r--r-- | vendor/psm/tests/stack_direction_2.rs | 29 |
2 files changed, 35 insertions, 0 deletions
diff --git a/vendor/psm/tests/stack_direction.rs b/vendor/psm/tests/stack_direction.rs new file mode 100644 index 000000000..609decbfe --- /dev/null +++ b/vendor/psm/tests/stack_direction.rs @@ -0,0 +1,6 @@ +extern crate psm; + +#[test] +fn always_equal() { + assert_eq!(psm::StackDirection::new(), psm::StackDirection::new()); +} diff --git a/vendor/psm/tests/stack_direction_2.rs b/vendor/psm/tests/stack_direction_2.rs new file mode 100644 index 000000000..dd0679074 --- /dev/null +++ b/vendor/psm/tests/stack_direction_2.rs @@ -0,0 +1,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()); +} |