Skip to content

Commit 4a34092

Browse files
committed
test: fix compile warnings and gatt_client test
1 parent 1dab9fd commit 4a34092

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

test/gatt_client/mock.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ static void (*registered_hci_event_handler) (uint8_t packet_type, uint16_t chann
1717
static btstack_linked_list_t connections;
1818
static const uint16_t max_mtu = 23;
1919
static uint8_t l2cap_stack_buffer[HCI_INCOMING_PRE_BUFFER_SIZE + 8 + max_mtu]; // pre buffer + HCI Header + L2CAP header
20-
uint16_t gatt_client_handle = 0x40;
20+
static uint16_t gatt_client_handle = 0x40;
21+
static hci_connection_t hci_connection;
2122

2223
uint16_t get_gatt_client_handle(void){
2324
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
149150
return NULL;
150151
}
151152
hci_connection_t * hci_connection_for_handle(hci_con_handle_t con_handle){
152-
printf("hci_connection_for_handle not implemented in mock backend\n");
153-
return NULL;
153+
return &hci_connection;
154154
}
155155
void hci_connections_get_iterator(btstack_linked_list_iterator_t *it){
156156
// printf("hci_connections_get_iterator not implemented in mock backend\n");

test/tlv_posix/Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ CFLAGS = \
1919
-DBTSTACK_TEST \
2020
-g \
2121
-Wall \
22-
-Wmissing-prototypes \
2322
-Wnarrowing \
2423
-I. \
2524
-I.. \

test/tlv_posix/tlv_test.c

+10-8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#define TEST_DB "/tmp/test.tlv"
1414

15+
#define TAG(a,b,c,d) ( ((a)<<24) | ((b)<<16) | ((c)<<8) | (d) )
16+
1517
/// TLV
1618
TEST_GROUP(BSTACK_TLV){
1719
const btstack_tlv_t * btstack_tlv_impl;
@@ -38,13 +40,13 @@ TEST_GROUP(BSTACK_TLV){
3840
};
3941

4042
TEST(BSTACK_TLV, TestMissingTag){
41-
uint32_t tag = 'abcd';
43+
uint32_t tag = TAG('a','b','c','d');
4244
int size = btstack_tlv_impl->get_tag(&btstack_tlv_context, tag, NULL, 0);
4345
CHECK_EQUAL(size, 0);
4446
}
4547

4648
TEST(BSTACK_TLV, TestWriteRead){
47-
uint32_t tag = 'abcd';
49+
uint32_t tag = TAG('a','b','c','d');
4850
uint8_t data = 7;
4951
uint8_t buffer = data;
5052
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);
@@ -55,7 +57,7 @@ TEST(BSTACK_TLV, TestWriteRead){
5557
}
5658

5759
TEST(BSTACK_TLV, TestWriteWriteRead){
58-
uint32_t tag = 'abcd';
60+
uint32_t tag = TAG('a','b','c','d');
5961
uint8_t data = 7;
6062
uint8_t buffer = data;
6163
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);
@@ -69,8 +71,8 @@ TEST(BSTACK_TLV, TestWriteWriteRead){
6971
}
7072

7173
TEST(BSTACK_TLV, TestWriteABARead){
72-
uint32_t tag_a = 'aaaa';
73-
uint32_t tag_b = 'bbbb';
74+
uint32_t tag_a = TAG('a','a','a','a');
75+
uint32_t tag_b = TAG('b','b','b','b');;
7476
uint8_t data = 7;
7577
uint8_t buffer = data;
7678
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag_a, &buffer, 1);
@@ -87,7 +89,7 @@ TEST(BSTACK_TLV, TestWriteABARead){
8789
}
8890

8991
TEST(BSTACK_TLV, TestWriteDeleteRead){
90-
uint32_t tag = 'abcd';
92+
uint32_t tag = TAG('a','b','c','d');
9193
uint8_t data = 7;
9294
uint8_t buffer = data;
9395
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);
@@ -100,7 +102,7 @@ TEST(BSTACK_TLV, TestWriteDeleteRead){
100102
}
101103

102104
TEST(BSTACK_TLV, TestMigrate){
103-
uint32_t tag = 'abcd';
105+
uint32_t tag = TAG('a','b','c','d');
104106
uint8_t data[8];
105107
memcpy(data, "01234567", 8);
106108

@@ -145,7 +147,7 @@ TEST(BSTACK_TLV, TestMigrate2){
145147
}
146148

147149
TEST(BSTACK_TLV, TestWriteResetRead){
148-
uint32_t tag = 'abcd';
150+
uint32_t tag = TAG('a','b','c','d');
149151
uint8_t data = 7;
150152
uint8_t buffer = data;
151153
btstack_tlv_impl->store_tag(&btstack_tlv_context, tag, &buffer, 1);

0 commit comments

Comments
 (0)