You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why this crate implements a proper way of mocking the protocol? It would be much more flexible, for unit test purposes, to provide to the end user the possibility to describe the trait mocked method behaviour using the mockall crate pattern
The text was updated successfully, but these errors were encountered:
For unit test purposes, it would make sense to add also a method named read_regs to I2CRegisterMap? It would make easy to perform comparison after i2c writing operations.
Maybe something like this could make sense
/// Read several registers starting from the given offset till offset+len
pub fn read_regs(&mut self, offset: usize, len: usize) -> Vec<u8> {
println!("READ | 0x{:X} : {:?}", offset, self.registers[offset+1..offset+len]);
self.registers[offset+1..offset+len].to_vec()
}
Why this crate implements a proper way of mocking the protocol? It would be much more flexible, for unit test purposes, to provide to the end user the possibility to describe the trait mocked method behaviour using the mockall crate pattern
The text was updated successfully, but these errors were encountered: