use std::{
io,
sync::{
Arc,
atomic::Ordering,
},
};
use qubit_atomic::Atomic;
use qubit_executor::executor::{
DirectExecutor,
Executor,
};
#[test]
fn test_executor_execute_default_delegates_to_call() {
let executor = DirectExecutor::new();
let calls = Arc::new(Atomic::new(0usize));
let calls_for_task = Arc::clone(&calls);
executor
.execute(move || {
calls_for_task.fetch_add_with_ordering(1, Ordering::AcqRel);
Ok::<(), io::Error>(())
})
.expect("direct executor should accept the runnable")
.get()
.expect("direct executor should run the runnable");
assert_eq!(calls.load(), 1);
}