|
|
|
@ -442,8 +442,10 @@ mod test {
@@ -442,8 +442,10 @@ mod test {
|
|
|
|
|
|
|
|
|
|
async fn advance(dur: Duration) { |
|
|
|
|
// HACK: advance should really be enough, but we need another yield_now
|
|
|
|
|
tokio::time::pause(); |
|
|
|
|
tokio::time::advance(dur).await; |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
tokio::time::resume(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[tokio::test] |
|
|
|
@ -461,12 +463,9 @@ mod test {
@@ -461,12 +463,9 @@ mod test {
|
|
|
|
|
|
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
|
|
|
|
|
pause(); |
|
|
|
|
advance(Duration::from_secs(1)).await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[true, false]); |
|
|
|
|
|
|
|
|
|
advance(Duration::from_secs(10)).await; |
|
|
|
|
advance(Duration::from_secs(11)).await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[false, false]); |
|
|
|
|
|
|
|
|
@ -481,11 +480,11 @@ mod test {
@@ -481,11 +480,11 @@ mod test {
|
|
|
|
|
.await |
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
advance(Duration::from_secs(1)).await; |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[false, true]); |
|
|
|
|
|
|
|
|
|
advance(Duration::from_secs(10)).await; |
|
|
|
|
advance(Duration::from_secs(11)).await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[true, false]); |
|
|
|
|
|
|
|
|
@ -493,8 +492,6 @@ mod test {
@@ -493,8 +492,6 @@ mod test {
|
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[false, false]); |
|
|
|
|
|
|
|
|
|
resume(); |
|
|
|
|
|
|
|
|
|
runner.quit().await.unwrap(); |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
} |
|
|
|
@ -519,9 +516,7 @@ mod test {
@@ -519,9 +516,7 @@ mod test {
|
|
|
|
|
.await |
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
pause(); |
|
|
|
|
|
|
|
|
|
advance(Duration::from_secs(1)).await; |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[false, true]); |
|
|
|
|
|
|
|
|
@ -531,12 +526,10 @@ mod test {
@@ -531,12 +526,10 @@ mod test {
|
|
|
|
|
assert_section_states(&interface, &[true, false]); |
|
|
|
|
|
|
|
|
|
runner.cancel_run(run3).await.unwrap(); |
|
|
|
|
advance(Duration::from_secs(10)).await; |
|
|
|
|
advance(Duration::from_secs(11)).await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[false, false]); |
|
|
|
|
|
|
|
|
|
resume(); |
|
|
|
|
|
|
|
|
|
runner.quit().await.unwrap(); |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
} |
|
|
|
@ -561,24 +554,17 @@ mod test {
@@ -561,24 +554,17 @@ mod test {
|
|
|
|
|
.await |
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
pause(); |
|
|
|
|
|
|
|
|
|
advance(Duration::from_secs(1)).await; |
|
|
|
|
|
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
assert_section_states(&interface, &[false, true]); |
|
|
|
|
|
|
|
|
|
runner.cancel_all().await.unwrap(); |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[false, false]); |
|
|
|
|
|
|
|
|
|
runner.cancel_all().await.unwrap(); |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
|
|
|
|
|
assert_section_states(&interface, &[false, false]); |
|
|
|
|
|
|
|
|
|
resume(); |
|
|
|
|
|
|
|
|
|
runner.quit().await.unwrap(); |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
} |
|
|
|
@ -603,9 +589,7 @@ mod test {
@@ -603,9 +589,7 @@ mod test {
|
|
|
|
|
.await |
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
pause(); |
|
|
|
|
|
|
|
|
|
advance(Duration::from_secs(1)).await; |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
assert_section_states(&interface, &[false, true]); |
|
|
|
|
|
|
|
|
|
runner.pause().await.unwrap(); |
|
|
|
@ -638,11 +622,9 @@ mod test {
@@ -638,11 +622,9 @@ mod test {
|
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
assert_section_states(&interface, &[false, true]); |
|
|
|
|
|
|
|
|
|
advance(Duration::from_secs(10)).await; |
|
|
|
|
advance(Duration::from_secs(11)).await; |
|
|
|
|
assert_section_states(&interface, &[false, false]); |
|
|
|
|
|
|
|
|
|
resume(); |
|
|
|
|
|
|
|
|
|
runner.quit().await.unwrap(); |
|
|
|
|
tokio::task::yield_now().await; |
|
|
|
|
} |
|
|
|
|