blob: f74414d55ac089874cba2254687ba10e0d65968c (
plain)
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
|
use binaryninja::headless::Session;
use rstest::*;
// TODO: Add a test for MainThreadHandler
#[fixture]
#[once]
fn session() -> Session {
Session::new().expect("Failed to initialize session")
}
#[rstest]
fn test_not_main_thread(_session: &Session) {
// We should never be the main thread.
assert!(!binaryninja::is_main_thread())
}
#[rstest]
fn test_main_thread_different(_session: &Session) {
let calling_thread = std::thread::current();
binaryninja::main_thread::execute_on_main_thread_and_wait(move || {
let main_thread = std::thread::current();
assert_ne!(
calling_thread.id(),
main_thread.id(),
"Expected calling thread to be the different from the main thread"
)
});
}
|