From f864600c4bf0b3f97b9a09b0735893c1e14337e2 Mon Sep 17 00:00:00 2001 From: bjoernQ Date: Tue, 12 Dec 2023 16:45:07 +0100 Subject: [PATCH] Fix tests --- bleps/tests/test_ble.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bleps/tests/test_ble.rs b/bleps/tests/test_ble.rs index 35f6b08..30e8a87 100644 --- a/bleps/tests/test_ble.rs +++ b/bleps/tests/test_ble.rs @@ -159,17 +159,32 @@ fn init_works() { let connector = connector(); let mut ble = Ble::new(&connector); - connector.provide_data_to_read(&[0x04, 0x0e, 0x04, 0x05, 0x03, 0x0c, 0x00]); + connector.provide_data_to_read(&[ + 0x04, 0x0e, 0x04, 0x05, 0x03, 0x0c, 0x00, 0x04, 0x0e, 0x04, 0x05, 0x01, 0x0c, 0x00, + ]); let res = ble.init(); assert_matches!(res, Ok(())); - assert_eq!(connector.get_write_idx(), 4); + assert_eq!(connector.get_write_idx(), 16); assert_eq!(connector.get_to_write_at(0), 0x01); assert_eq!(connector.get_to_write_at(1), 0x03); assert_eq!(connector.get_to_write_at(2), 0x0c); assert_eq!(connector.get_to_write_at(3), 0x00); + + assert_eq!(connector.get_to_write_at(4), 0x01); + assert_eq!(connector.get_to_write_at(5), 0x01); + assert_eq!(connector.get_to_write_at(6), 0x0c); + assert_eq!(connector.get_to_write_at(7), 0x08); + assert_eq!(connector.get_to_write_at(8), 0xff); + assert_eq!(connector.get_to_write_at(9), 0xff); + assert_eq!(connector.get_to_write_at(10), 0xff); + assert_eq!(connector.get_to_write_at(11), 0xff); + assert_eq!(connector.get_to_write_at(12), 0xff); + assert_eq!(connector.get_to_write_at(13), 0xff); + assert_eq!(connector.get_to_write_at(14), 0xff); + assert_eq!(connector.get_to_write_at(15), 0xff); } #[test]