use std::thread;
use st3::lifo::Worker;
let worker = Worker::new(256);
worker.push("a").unwrap();
worker.push("b").unwrap();
worker.push("c").unwrap();
worker.push("d").unwrap();
let stealer = worker.stealer();
let th = thread::spawn(move || {
let other_worker = Worker::new(256);
match stealer.steal(&other_worker, |n| n/2) {
Ok(actual) => actual,
Err(_) => 0,
}
});
let mut pop_count = 0;
while worker.pop().is_some() {
pop_count += 1;
}
let steal_count = th.join().unwrap();
assert_eq!(pop_count + steal_count, 4);