mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-25 16:43:28 +00:00
test: fix and add to main make test
This commit is contained in:
parent
b1dcf9d89e
commit
1c22f3beea
@ -5,16 +5,32 @@ SUBDIRS = \
|
||||
att_db \
|
||||
avdtp \
|
||||
avrcp \
|
||||
tlv_posix \
|
||||
base64 \
|
||||
ble_client \
|
||||
btstack_link_key_db \
|
||||
crypto \
|
||||
des_iterator \
|
||||
gatt_client \
|
||||
hfp \
|
||||
hid_parser \
|
||||
linked_list \
|
||||
maths \
|
||||
obex \
|
||||
ring_buffer \
|
||||
sdp_client \
|
||||
security_manager \
|
||||
# maths \
|
||||
tlv_posix \
|
||||
|
||||
|
||||
# test fails
|
||||
# flash_tlv \
|
||||
# map_test \
|
||||
# mesh \
|
||||
# sdp \
|
||||
|
||||
# not unit-tests
|
||||
# map_client \
|
||||
# sbc \
|
||||
|
||||
subdirs:
|
||||
echo Building all tests
|
||||
|
@ -61,3 +61,5 @@ int hci_send_cmd(const hci_cmd_t *cmd, ...){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hci_halting_defer(void){
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ TEST_GROUP(HID){
|
||||
|
||||
TEST(HID, MouseWithoutReportID){
|
||||
static btstack_hid_parser_t hid_parser;
|
||||
btstack_hid_parser_init(&hid_parser, mouse_descriptor_without_report_id, sizeof(mouse_descriptor_without_report_id), BTSTACK_HID_REPORT_TYPE_INPUT, mouse_report_without_id_positive_xy, sizeof(mouse_report_without_id_positive_xy));
|
||||
btstack_hid_parser_init(&hid_parser, mouse_descriptor_without_report_id, sizeof(mouse_descriptor_without_report_id), HID_REPORT_TYPE_INPUT, mouse_report_without_id_positive_xy, sizeof(mouse_report_without_id_positive_xy));
|
||||
expect_field(&hid_parser, 9, 1, 1);
|
||||
expect_field(&hid_parser, 9, 2, 1);
|
||||
expect_field(&hid_parser, 9, 3, 0);
|
||||
@ -252,7 +252,7 @@ TEST(HID, MouseWithoutReportID){
|
||||
|
||||
TEST(HID, MouseWithoutReportIDSigned){
|
||||
static btstack_hid_parser_t hid_parser;
|
||||
btstack_hid_parser_init(&hid_parser, mouse_descriptor_without_report_id, sizeof(mouse_descriptor_without_report_id), BTSTACK_HID_REPORT_TYPE_INPUT, mouse_report_without_id_negative_xy, sizeof(mouse_report_without_id_negative_xy));
|
||||
btstack_hid_parser_init(&hid_parser, mouse_descriptor_without_report_id, sizeof(mouse_descriptor_without_report_id), HID_REPORT_TYPE_INPUT, mouse_report_without_id_negative_xy, sizeof(mouse_report_without_id_negative_xy));
|
||||
expect_field(&hid_parser, 9, 1, 1);
|
||||
expect_field(&hid_parser, 9, 2, 1);
|
||||
expect_field(&hid_parser, 9, 3, 0);
|
||||
@ -264,7 +264,7 @@ TEST(HID, MouseWithoutReportIDSigned){
|
||||
|
||||
TEST(HID, MouseWithReportID){
|
||||
static btstack_hid_parser_t hid_parser;
|
||||
btstack_hid_parser_init(&hid_parser, mouse_descriptor_with_report_id, sizeof(mouse_descriptor_with_report_id), BTSTACK_HID_REPORT_TYPE_INPUT, mouse_report_with_id_1, sizeof(mouse_report_with_id_1));
|
||||
btstack_hid_parser_init(&hid_parser, mouse_descriptor_with_report_id, sizeof(mouse_descriptor_with_report_id), HID_REPORT_TYPE_INPUT, mouse_report_with_id_1, sizeof(mouse_report_with_id_1));
|
||||
expect_field(&hid_parser, 9, 1, 1);
|
||||
expect_field(&hid_parser, 9, 2, 1);
|
||||
expect_field(&hid_parser, 9, 3, 0);
|
||||
@ -276,7 +276,7 @@ TEST(HID, MouseWithReportID){
|
||||
|
||||
TEST(HID, BootKeyboard){
|
||||
static btstack_hid_parser_t hid_parser;
|
||||
btstack_hid_parser_init(&hid_parser, hid_descriptor_keyboard_boot_mode, sizeof(hid_descriptor_keyboard_boot_mode), BTSTACK_HID_REPORT_TYPE_INPUT, keyboard_report1, sizeof(keyboard_report1));
|
||||
btstack_hid_parser_init(&hid_parser, hid_descriptor_keyboard_boot_mode, sizeof(hid_descriptor_keyboard_boot_mode), HID_REPORT_TYPE_INPUT, keyboard_report1, sizeof(keyboard_report1));
|
||||
expect_field(&hid_parser, 7, 0xe0, 1);
|
||||
expect_field(&hid_parser, 7, 0xe1, 0);
|
||||
expect_field(&hid_parser, 7, 0xe2, 0);
|
||||
@ -297,7 +297,7 @@ TEST(HID, BootKeyboard){
|
||||
|
||||
TEST(HID, Combo1){
|
||||
static btstack_hid_parser_t hid_parser;
|
||||
btstack_hid_parser_init(&hid_parser, combo_descriptor_with_report_ids, sizeof(combo_descriptor_with_report_ids), BTSTACK_HID_REPORT_TYPE_INPUT, combo_report1, sizeof(combo_report1));
|
||||
btstack_hid_parser_init(&hid_parser, combo_descriptor_with_report_ids, sizeof(combo_descriptor_with_report_ids), HID_REPORT_TYPE_INPUT, combo_report1, sizeof(combo_report1));
|
||||
expect_field(&hid_parser, 9, 1, 1);
|
||||
expect_field(&hid_parser, 9, 2, 1);
|
||||
expect_field(&hid_parser, 9, 3, 0);
|
||||
@ -309,7 +309,7 @@ TEST(HID, Combo1){
|
||||
|
||||
TEST(HID, Combo2){
|
||||
static btstack_hid_parser_t hid_parser;
|
||||
btstack_hid_parser_init(&hid_parser, combo_descriptor_with_report_ids, sizeof(combo_descriptor_with_report_ids), BTSTACK_HID_REPORT_TYPE_INPUT, combo_report2, sizeof(combo_report2));
|
||||
btstack_hid_parser_init(&hid_parser, combo_descriptor_with_report_ids, sizeof(combo_descriptor_with_report_ids), HID_REPORT_TYPE_INPUT, combo_report2, sizeof(combo_report2));
|
||||
expect_field(&hid_parser, 7, 0xe0, 1);
|
||||
expect_field(&hid_parser, 7, 0xe1, 0);
|
||||
expect_field(&hid_parser, 7, 0xe2, 0);
|
||||
@ -332,14 +332,14 @@ TEST(HID, GetReportSize){
|
||||
int report_size = 0;
|
||||
const uint8_t * hid_descriptor = combo_descriptor_with_report_ids;
|
||||
uint16_t hid_descriptor_len = sizeof(combo_descriptor_with_report_ids);
|
||||
report_size = btstack_hid_get_report_size_for_id(1, BTSTACK_HID_REPORT_TYPE_INPUT, hid_descriptor_len, hid_descriptor);
|
||||
report_size = btstack_hid_get_report_size_for_id(1, HID_REPORT_TYPE_INPUT, hid_descriptor_len, hid_descriptor);
|
||||
CHECK_EQUAL(3, report_size);
|
||||
|
||||
hid_descriptor = hid_descriptor_keyboard_boot_mode;
|
||||
hid_descriptor_len = sizeof(hid_descriptor_keyboard_boot_mode);
|
||||
report_size = btstack_hid_get_report_size_for_id(0, BTSTACK_HID_REPORT_TYPE_OUTPUT, hid_descriptor_len, hid_descriptor);
|
||||
report_size = btstack_hid_get_report_size_for_id(0, HID_REPORT_TYPE_OUTPUT, hid_descriptor_len, hid_descriptor);
|
||||
CHECK_EQUAL(1, report_size);
|
||||
report_size = btstack_hid_get_report_size_for_id(0, BTSTACK_HID_REPORT_TYPE_INPUT, hid_descriptor_len, hid_descriptor);
|
||||
report_size = btstack_hid_get_report_size_for_id(0, HID_REPORT_TYPE_INPUT, hid_descriptor_len, hid_descriptor);
|
||||
CHECK_EQUAL(8, report_size);
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ COMMON = \
|
||||
pan.c \
|
||||
sdp_util.c \
|
||||
spp_server.c \
|
||||
btstack_hid_parser.c \
|
||||
|
||||
COMMON_OBJ = $(COMMON:.c=.o)
|
||||
|
||||
|
@ -169,7 +169,7 @@ TEST(SDPRecordBuilder, AVRCP_TARGET){
|
||||
service_provider_name = "";
|
||||
descriptor_size = 0;
|
||||
expected_len = avrcp_target_record_size(browsing, service_name, service_provider_name);
|
||||
avrcp_target_create_sdp_record(service_buffer, 0, browsing, 0, service_name, service_provider_name);
|
||||
avrcp_target_create_sdp_record(service_buffer, 0, 0, service_name, service_provider_name);
|
||||
CHECK_EQUAL(de_get_len(service_buffer), expected_len);
|
||||
|
||||
browsing = 1;
|
||||
@ -177,7 +177,7 @@ TEST(SDPRecordBuilder, AVRCP_TARGET){
|
||||
service_provider_name = "";
|
||||
descriptor_size = 0;
|
||||
expected_len = avrcp_target_record_size(browsing, service_name, service_provider_name);
|
||||
avrcp_target_create_sdp_record(service_buffer, 0, browsing, 0, service_name, service_provider_name);
|
||||
avrcp_target_create_sdp_record(service_buffer, 0, 0, service_name, service_provider_name);
|
||||
CHECK_EQUAL(de_get_len(service_buffer), expected_len);
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ TEST(SDPRecordBuilder, AVRCP_CONTROLLER){
|
||||
service_provider_name = "";
|
||||
descriptor_size = 0;
|
||||
expected_len = avrcp_controller_record_size(browsing, service_name, service_provider_name);
|
||||
avrcp_controller_create_sdp_record(service_buffer, 0, browsing, 0, service_name, service_provider_name);
|
||||
avrcp_controller_create_sdp_record(service_buffer, 0, 0, service_name, service_provider_name);
|
||||
CHECK_EQUAL(de_get_len(service_buffer), expected_len);
|
||||
|
||||
browsing = 1;
|
||||
@ -217,7 +217,7 @@ TEST(SDPRecordBuilder, AVRCP_CONTROLLER){
|
||||
service_provider_name = "";
|
||||
descriptor_size = 0;
|
||||
expected_len = avrcp_controller_record_size(browsing, service_name, service_provider_name);
|
||||
avrcp_controller_create_sdp_record(service_buffer, 0, browsing, 0, service_name, service_provider_name);
|
||||
avrcp_controller_create_sdp_record(service_buffer, 0, 0, service_name, service_provider_name);
|
||||
CHECK_EQUAL(de_get_len(service_buffer), expected_len);
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ TEST(SDPRecordBuilder, GN){
|
||||
IPv4Subnet = NULL;
|
||||
IPv6Subnet = NULL;
|
||||
expected_len = pan_gn_sdp_record_size(network_packet_types, name, desc, IPv4Subnet, IPv6Subnet);
|
||||
pan_create_gn_sdp_service(service_buffer, 0, network_packet_types, name, desc, BNEP_SECURITY_NONE, IPv4Subnet, IPv6Subnet);
|
||||
pan_create_gn_sdp_record(service_buffer, 0, network_packet_types, name, desc, BNEP_SECURITY_NONE, IPv4Subnet, IPv6Subnet);
|
||||
CHECK_EQUAL(de_get_len(service_buffer), expected_len);
|
||||
|
||||
// test ipv4 param
|
||||
@ -472,7 +472,7 @@ TEST(SDPRecordBuilder, GN){
|
||||
IPv4Subnet = NULL;
|
||||
IPv6Subnet = "";
|
||||
expected_len = pan_gn_sdp_record_size(network_packet_types, name, desc, IPv4Subnet, IPv6Subnet);
|
||||
pan_create_gn_sdp_service(service_buffer, 0, network_packet_types, name, desc, BNEP_SECURITY_NONE, IPv4Subnet, IPv6Subnet);
|
||||
pan_create_gn_sdp_record(service_buffer, 0, network_packet_types, name, desc, BNEP_SECURITY_NONE, IPv4Subnet, IPv6Subnet);
|
||||
CHECK_EQUAL(de_get_len(service_buffer), expected_len);
|
||||
|
||||
// test ipv6 param
|
||||
@ -482,7 +482,7 @@ TEST(SDPRecordBuilder, GN){
|
||||
IPv4Subnet = "";
|
||||
IPv6Subnet = "";
|
||||
expected_len = pan_gn_sdp_record_size(network_packet_types, name, desc, IPv4Subnet, IPv6Subnet);
|
||||
pan_create_gn_sdp_service(service_buffer, 0, network_packet_types, name, desc, BNEP_SECURITY_NONE, IPv4Subnet, IPv6Subnet);
|
||||
pan_create_gn_sdp_record(service_buffer, 0, network_packet_types, name, desc, BNEP_SECURITY_NONE, IPv4Subnet, IPv6Subnet);
|
||||
CHECK_EQUAL(de_get_len(service_buffer), expected_len);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user