You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/04/19 19:00:44 UTC

[2/3] incubator-mynewt-core git commit: BLE Host - Check tx of disc-svc-uuid in unit tests

BLE Host - Check tx of disc-svc-uuid in unit tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a1e5c125
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a1e5c125
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a1e5c125

Branch: refs/heads/master
Commit: a1e5c1253b670f90ac59decce2917c179b0dfb96
Parents: 28b29f4
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Apr 19 11:57:28 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Apr 19 12:00:05 2017 -0700

----------------------------------------------------------------------
 net/nimble/host/test/src/ble_gatt_disc_s_test.c |  2 ++
 net/nimble/host/test/src/ble_hs_test_util.c     | 35 ++++++++++++++++++++
 net/nimble/host/test/src/ble_hs_test_util.h     |  6 ++++
 3 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1e5c125/net/nimble/host/test/src/ble_gatt_disc_s_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_disc_s_test.c b/net/nimble/host/test/src/ble_gatt_disc_s_test.c
index 0d75b6d..f4cff86 100644
--- a/net/nimble/host/test/src/ble_gatt_disc_s_test.c
+++ b/net/nimble/host/test/src/ble_gatt_disc_s_test.c
@@ -292,6 +292,8 @@ ble_gatt_disc_s_test_misc_good_uuid(
                                     ble_gatt_disc_s_test_misc_disc_cb, NULL);
     TEST_ASSERT(rc == 0);
 
+    ble_hs_test_util_verify_tx_disc_svc_uuid(services[0].uuid);
+
     ble_gatt_disc_s_test_misc_rx_uuid_rsp(2, services);
     ble_gatt_disc_s_test_misc_verify_services(services);
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1e5c125/net/nimble/host/test/src/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_hs_test_util.c b/net/nimble/host/test/src/ble_hs_test_util.c
index c1f7c0f..7c72d5d 100644
--- a/net/nimble/host/test/src/ble_hs_test_util.c
+++ b/net/nimble/host/test/src/ble_hs_test_util.c
@@ -1526,6 +1526,41 @@ ble_hs_test_util_verify_tx_exec_write(uint8_t expected_flags)
 }
 
 void
+ble_hs_test_util_verify_tx_find_type_value(uint16_t start_handle,
+                                           uint16_t end_handle,
+                                           uint16_t attr_type,
+                                           const void *value,
+                                           uint16_t value_len)
+{
+    struct ble_att_find_type_value_req req;
+    struct os_mbuf *om;
+
+    ble_hs_test_util_tx_all();
+    om = ble_hs_test_util_prev_tx_dequeue_pullup();
+    TEST_ASSERT_FATAL(om != NULL);
+    TEST_ASSERT(om->om_len == BLE_ATT_FIND_TYPE_VALUE_REQ_BASE_SZ + value_len);
+
+    ble_att_find_type_value_req_parse(om->om_data, om->om_len, &req);
+    TEST_ASSERT(req.bavq_start_handle == start_handle);
+    TEST_ASSERT(req.bavq_end_handle == end_handle);
+    TEST_ASSERT(req.bavq_attr_type == attr_type);
+    TEST_ASSERT(memcmp(om->om_data + BLE_ATT_FIND_TYPE_VALUE_REQ_BASE_SZ,
+                       value,
+                       value_len) == 0);
+}
+
+void
+ble_hs_test_util_verify_tx_disc_svc_uuid(const ble_uuid_t *uuid)
+{
+    uint8_t uuid_buf[16];
+
+    ble_uuid_flat(uuid, uuid_buf);
+    ble_hs_test_util_verify_tx_find_type_value(
+        1, 0xffff, BLE_ATT_UUID_PRIMARY_SERVICE,
+        uuid_buf, ble_uuid_length(uuid));
+}
+
+void
 ble_hs_test_util_verify_tx_read_rsp_gen(uint8_t att_op,
                                         uint8_t *attr_data, int attr_len)
 {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1e5c125/net/nimble/host/test/src/ble_hs_test_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_hs_test_util.h b/net/nimble/host/test/src/ble_hs_test_util.h
index a8ae1f3..4f9927a 100644
--- a/net/nimble/host/test/src/ble_hs_test_util.h
+++ b/net/nimble/host/test/src/ble_hs_test_util.h
@@ -231,6 +231,12 @@ void ble_hs_test_util_verify_tx_prep_write(uint16_t attr_handle,
                                            uint16_t offset,
                                            const void *data, int data_len);
 void ble_hs_test_util_verify_tx_exec_write(uint8_t expected_flags);
+void ble_hs_test_util_verify_tx_find_type_value(uint16_t start_handle,
+                                                uint16_t end_handle,
+                                                uint16_t attr_type,
+                                                const void *value,
+                                                uint16_t value_len);
+void ble_hs_test_util_verify_tx_disc_svc_uuid(const ble_uuid_t *uuid);
 void ble_hs_test_util_verify_tx_read_rsp(uint8_t *attr_data, int attr_len);
 void ble_hs_test_util_verify_tx_read_blob_rsp(uint8_t *attr_data,
                                               int attr_len);