mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-21 12:40:42 +00:00
test: fix compile warnings and gatt_client test
This commit is contained in:
parent
1dab9fd639
commit
4a34092706
@ -17,7 +17,8 @@ static void (*registered_hci_event_handler) (uint8_t packet_type, uint16_t chann
|
||||
static btstack_linked_list_t connections;
|
||||
static const uint16_t max_mtu = 23;
|
||||
static uint8_t l2cap_stack_buffer[HCI_INCOMING_PRE_BUFFER_SIZE + 8 + max_mtu]; // pre buffer + HCI Header + L2CAP header
|
||||
uint16_t gatt_client_handle = 0x40;
|
||||
static uint16_t gatt_client_handle = 0x40;
|
||||
static hci_connection_t hci_connection;
|
||||
|
||||
uint16_t get_gatt_client_handle(void){
|
||||
return gatt_client_handle;
|
||||
@ -149,8 +150,7 @@ hci_connection_t * hci_connection_for_bd_addr_and_type(bd_addr_t addr, bd_addr_t
|
||||
return NULL;
|
||||
}
|
||||
hci_connection_t * hci_connection_for_handle(hci_con_handle_t con_handle){
|
||||
printf("hci_connection_for_handle not implemented in mock backend\n");
|
||||
return NULL;
|
||||
return &hci_connection;
|
||||
}
|
||||
void hci_connections_get_iterator(btstack_linked_list_iterator_t *it){
|
||||
// printf("hci_connections_get_iterator not implemented in mock backend\n");
|
||||
|
@ -19,7 +19,6 @@ CFLAGS = \
|
||||
-DBTSTACK_TEST \
|
||||
-g \
|
||||
-Wall \
|
||||
-Wmissing-prototypes \
|
||||
-Wnarrowing \
|
||||
-I. \
|
||||
-I.. \
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#define TEST_DB "/tmp/test.tlv"
|
||||
|
||||
#define TAG(a,b,c,d) ( ((a)<<24) | ((b)<<16) | ((c)<<8) | (d) )
|
||||
|
||||
/// TLV
|
||||
TEST_GROUP(BSTACK_TLV){
|
||||
const btstack_tlv_t * btstack_tlv_impl;
|
||||
@ -38,13 +40,13 @@ TEST_GROUP(BSTACK_TLV){
|
||||
};
|
||||
|
||||
TEST(BSTACK_TLV, TestMissingTag){
|
||||
uint32_t tag = 'abcd';
|
||||
uint32_t tag = TAG('a','b','c','d');
|
||||
int size = btstack_tlv_impl->get_tag(&btstack_tlv_context, tag, NULL, 0);
|
||||
CHECK_EQUAL(size, 0);
|
||||
}
|
||||
|
||||
TEST(BSTACK_TLV, TestWriteRead){
|
||||
uint32_t tag = 'abcd';
|
||||
uint32_t tag = TAG('a','b','c','d');
|
||||
uint8_t data = 7;
|
||||
uint8_t buffer = data;
|
||||
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);
|
||||
@ -55,7 +57,7 @@ TEST(BSTACK_TLV, TestWriteRead){
|
||||
}
|
||||
|
||||
TEST(BSTACK_TLV, TestWriteWriteRead){
|
||||
uint32_t tag = 'abcd';
|
||||
uint32_t tag = TAG('a','b','c','d');
|
||||
uint8_t data = 7;
|
||||
uint8_t buffer = data;
|
||||
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);
|
||||
@ -69,8 +71,8 @@ TEST(BSTACK_TLV, TestWriteWriteRead){
|
||||
}
|
||||
|
||||
TEST(BSTACK_TLV, TestWriteABARead){
|
||||
uint32_t tag_a = 'aaaa';
|
||||
uint32_t tag_b = 'bbbb';
|
||||
uint32_t tag_a = TAG('a','a','a','a');
|
||||
uint32_t tag_b = TAG('b','b','b','b');;
|
||||
uint8_t data = 7;
|
||||
uint8_t buffer = data;
|
||||
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag_a, &buffer, 1);
|
||||
@ -87,7 +89,7 @@ TEST(BSTACK_TLV, TestWriteABARead){
|
||||
}
|
||||
|
||||
TEST(BSTACK_TLV, TestWriteDeleteRead){
|
||||
uint32_t tag = 'abcd';
|
||||
uint32_t tag = TAG('a','b','c','d');
|
||||
uint8_t data = 7;
|
||||
uint8_t buffer = data;
|
||||
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);
|
||||
@ -100,7 +102,7 @@ TEST(BSTACK_TLV, TestWriteDeleteRead){
|
||||
}
|
||||
|
||||
TEST(BSTACK_TLV, TestMigrate){
|
||||
uint32_t tag = 'abcd';
|
||||
uint32_t tag = TAG('a','b','c','d');
|
||||
uint8_t data[8];
|
||||
memcpy(data, "01234567", 8);
|
||||
|
||||
@ -145,7 +147,7 @@ TEST(BSTACK_TLV, TestMigrate2){
|
||||
}
|
||||
|
||||
TEST(BSTACK_TLV, TestWriteResetRead){
|
||||
uint32_t tag = 'abcd';
|
||||
uint32_t tag = TAG('a','b','c','d');
|
||||
uint8_t data = 7;
|
||||
uint8_t buffer = data;
|
||||
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user