Skip to content

Commit

Permalink
chore: add test for 'wait_until_state'
Browse files Browse the repository at this point in the history
  • Loading branch information
zeldan committed Oct 8, 2024
1 parent 6ab2f48 commit 5f72b72
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/dht.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,23 @@ mod tests {

dht.pin.done();
}

#[test]
fn test_wait_until_state() {
let expectations = [
PinTransaction::get(State::Low),
PinTransaction::get(State::Low),
PinTransaction::get(State::High),
];

let mock_pin = Mock::new(&expectations);
let mock_delay = MockNoop::new();

let mut dht = Dht::new(mock_pin, mock_delay);

let result = dht.wait_until_state(PinState::High);
assert!(result.is_ok());

dht.pin.done();
}
}

0 comments on commit 5f72b72

Please sign in to comment.