diff options
| author | Rubens Brandao <git@rubens.io> | 2024-06-20 15:34:39 -0300 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-02-07 17:58:26 -0500 |
| commit | 01ef88f28a999ab16508483bd5a442f26876a81e (patch) | |
| tree | f51d15afda44041a0f1c3e5a8222d63138a6f9cd /rust/tests | |
| parent | 0577345afbc75d72fd9f5e9c11e489b5f59202ae (diff) | |
Implement Rust BaseAddressDetection
Diffstat (limited to 'rust/tests')
| -rw-r--r-- | rust/tests/base_detection.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/rust/tests/base_detection.rs b/rust/tests/base_detection.rs new file mode 100644 index 00000000..b5497c3c --- /dev/null +++ b/rust/tests/base_detection.rs @@ -0,0 +1,24 @@ +use binaryninja::base_detection::BaseAddressDetectionSettings; +use binaryninja::binary_view::BinaryViewExt; +use binaryninja::headless::Session; +use rstest::{fixture, rstest}; +use std::path::PathBuf; + +#[fixture] +#[once] +fn session() -> Session { + Session::new().expect("Failed to initialize session") +} + +#[rstest] +fn test_failed_base_detection(_session: &Session) { + let out_dir = env!("OUT_DIR").parse::<PathBuf>().unwrap(); + let view = binaryninja::load(out_dir.join("atox.obj")).expect("Failed to create view"); + let bad = view + .base_address_detection() + .expect("Failed to create base address detection"); + assert!( + !bad.detect(&BaseAddressDetectionSettings::default()), + "Detection should fail on this view" + ); +} |
