Skip to content

Commit

Permalink
Improve testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ar37-rs committed Sep 26, 2022
1 parent 2fbaf3c commit cad588d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/drive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,27 @@ fn drive() {
for i in 1..20 {
handle.send(i);
}
handle.error("Ok".to_string());
handle.success("Ok".to_string());
}
});

let mut exit = false;
let mut received_last_value = 0;
let mut sum = 0;

loop {
if flower.is_active() {
flower
.extract(|channel| {
if let Some(value) = channel {
sum += value;
received_last_value = value;
println!("{}", value);
}
})
.finalize(|result| {
match result {
Ok(value) => {
assert_eq!("Ok", &value);
assert_eq!(String::from("Ok"), value);
}
_ => (),
}
Expand All @@ -44,4 +45,5 @@ fn drive() {
}

assert_eq!(received_last_value, 19);
assert_eq!(sum, 190);
}

0 comments on commit cad588d

Please sign in to comment.