Skip to content

Commit

Permalink
Test that we can read from mock device at offset 0x0
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Pederson committed Jan 17, 2024
1 parent cdda7b4 commit 6ebeffa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,15 @@ where
Ok(messages.len() as u32)
}
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn test_can_read_at_zero_offset() {
let mut mock_device = MockI2CDevice::new();
mock_device.regmap.write_regs(0x0, &[0x1u8; 4]);
mock_device.read(&mut [0x0u8; 4]).unwrap();
}
}

0 comments on commit 6ebeffa

Please sign in to comment.