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 2016/07/25 21:02:51 UTC

incubator-mynewt-core git commit: BLE Host - Update unit tests for new GATTs API.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop dd1a3db44 -> 1d8ecf9f4


BLE Host - Update unit tests for new GATTs API.


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/1d8ecf9f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/1d8ecf9f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/1d8ecf9f

Branch: refs/heads/develop
Commit: 1d8ecf9f41b2bffcaffa02697310a5f7aa431b2b
Parents: dd1a3db
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jul 25 13:49:35 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jul 25 13:49:35 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_gatts.c               |  1 +
 net/nimble/host/src/test/ble_gatts_reg_test.c | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1d8ecf9f/net/nimble/host/src/ble_gatts.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gatts.c b/net/nimble/host/src/ble_gatts.c
index 5456cd4..31f3a6f 100644
--- a/net/nimble/host/src/ble_gatts.c
+++ b/net/nimble/host/src/ble_gatts.c
@@ -2047,6 +2047,7 @@ ble_gatts_init(void)
         }
     }
 
+    ble_gatts_num_svc_entries = 0;
     for (i = 0; i < ble_gatts_num_svc_defs; i++) {
         rc = ble_gatts_register_svcs(ble_gatts_svc_defs[i],
                                      ble_hs_cfg.gatts_register_cb,

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1d8ecf9f/net/nimble/host/src/test/ble_gatts_reg_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatts_reg_test.c b/net/nimble/host/src/test/ble_gatts_reg_test.c
index 963800a..ad5f18f 100644
--- a/net/nimble/host/src/test/ble_gatts_reg_test.c
+++ b/net/nimble/host/src/test/ble_gatts_reg_test.c
@@ -301,9 +301,8 @@ TEST_CASE(ble_gatts_reg_test_svc_return)
 {
     int rc;
 
-    ble_gatts_reg_test_init();
-
     /*** Missing UUID. */
+    ble_gatts_reg_test_init();
     struct ble_gatt_svc_def svcs_no_uuid[] = { {
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
     }, {
@@ -314,6 +313,7 @@ TEST_CASE(ble_gatts_reg_test_svc_return)
     TEST_ASSERT(rc == BLE_HS_EINVAL);
 
     /*** Circular dependency. */
+    ble_gatts_reg_test_init();
     struct ble_gatt_svc_def svcs_circ[] = { {
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = BLE_UUID16(0x1234),
@@ -330,6 +330,7 @@ TEST_CASE(ble_gatts_reg_test_svc_return)
     TEST_ASSERT(rc == BLE_HS_EINVAL);
 
     /*** Success. */
+    ble_gatts_reg_test_init();
     struct ble_gatt_svc_def svcs_good[] = { {
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = BLE_UUID16(0x1234),
@@ -349,9 +350,8 @@ TEST_CASE(ble_gatts_reg_test_chr_return)
 {
     int rc;
 
-    ble_gatts_reg_test_init();
-
     /*** Missing callback. */
+    ble_gatts_reg_test_init();
     struct ble_gatt_svc_def svcs_no_chr_cb[] = { {
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = BLE_UUID16(0x1234),
@@ -369,6 +369,7 @@ TEST_CASE(ble_gatts_reg_test_chr_return)
     TEST_ASSERT(rc == BLE_HS_EINVAL);
 
     /*** Success. */
+    ble_gatts_reg_test_init();
     struct ble_gatt_svc_def svcs_good[] = { {
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = BLE_UUID16(0x1234),
@@ -391,9 +392,8 @@ TEST_CASE(ble_gatts_reg_test_dsc_return)
 {
     int rc;
 
-    ble_gatts_reg_test_init();
-
     /*** Missing callback. */
+    ble_gatts_reg_test_init();
     struct ble_gatt_svc_def svcs_no_dsc_cb[] = { {
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = BLE_UUID16(0x1234),
@@ -418,6 +418,7 @@ TEST_CASE(ble_gatts_reg_test_dsc_return)
     TEST_ASSERT(rc == BLE_HS_EINVAL);
 
     /*** Success. */
+    ble_gatts_reg_test_init();
     struct ble_gatt_svc_def svcs_good[] = { {
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = BLE_UUID16(0x1234),