Skip to content

Commit 7d114c2

Browse files
marengesanhmolt
andcommitted
tests: unittest: Added unittests for ble_bas
Added unit tests for ble_bas service Signed-off-by: Martin Engesvold <[email protected]> Co-authored-by: Andreas Moltumyr <[email protected]>
1 parent 2bb41b6 commit 7d114c2

File tree

5 files changed

+497
-0
lines changed

5 files changed

+497
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
/tests/lib/ble_adv/ @nrfconnect/ncs-bm-test
9393
/tests/lib/bm_storage/ @nrfconnect/ncs-bm
9494
/tests/lib/bm_timer/ @nrfconnect/ncs-bm @nrfconnect/ncs-bm-test
95+
/tests/subsys/bluetooth/services/ble_bas/ @nrfconnect/ncs-bm @nrfconnect/ncs-bm-test
9596

9697
# Zephyr module
9798
/zephyr/ @nrfconnect/ncs-co-build-system
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
11+
project(unit_test_ble_bas)
12+
13+
set(SOFTDEVICE_VARIANT "s115")
14+
set(SOFTDEVICE_INCLUDE_DIR "${ZEPHYR_NRF_BM_MODULE_DIR}/components/softdevice/\
15+
${SOFTDEVICE_VARIANT}/${SOFTDEVICE_VARIANT}_API/include")
16+
17+
cmock_handle(${SOFTDEVICE_INCLUDE_DIR}/ble_gatts.h)
18+
19+
target_compile_definitions(app PRIVATE
20+
NRF54L15_XXAA
21+
SVCALL_AS_NORMAL_FUNCTION
22+
SUPPRESS_INLINE_IMPLEMENTATION
23+
CONFIG_NRF_SDH_BLE_TOTAL_LINK_COUNT=1
24+
)
25+
26+
target_include_directories(app PRIVATE
27+
${SOFTDEVICE_INCLUDE_DIR}
28+
${ZEPHYR_NRF_BM_MODULE_DIR}/include
29+
${ZEPHYR_HAL_NORDIC_MODULE_DIR}/nrfx/mdk
30+
)
31+
32+
# Generate and add test file
33+
test_runner_generate(src/unity_test.c)
34+
target_sources(app PRIVATE src/unity_test.c)
35+
36+
# Unit under test
37+
target_sources(app PRIVATE ${ZEPHYR_NRF_BM_MODULE_DIR}/subsys/bluetooth/services/ble_bas/bas.c)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_UNITY=y

0 commit comments

Comments
 (0)