Skip to content

Commit 3c678a4

Browse files
committed
[wip] adding unit tests
1 parent 1e68e1b commit 3c678a4

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

services/inc/ncp_fw_update.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include "hal_platform.h"
2121
#include "system_tick_hal.h"
22-
#include "core_hal.h"
2322
#include "system_defs.h"
2423
#include "system_mode.h"
2524
#include "system_network.h"
@@ -196,6 +195,7 @@ class SaraNcpFwUpdate {
196195
void logSaraNcpFwUpdateData(SaraNcpFwUpdateData& data);
197196
};
198197

198+
#ifndef UNIT_TEST
199199
class NcpFwUpdateDiagnostics: public AbstractUnsignedIntegerDiagnosticData {
200200
public:
201201
NcpFwUpdateDiagnostics() :
@@ -207,6 +207,7 @@ class NcpFwUpdateDiagnostics: public AbstractUnsignedIntegerDiagnosticData {
207207
return 0; // OK
208208
}
209209
};
210+
#endif // UNIT_TEST
210211

211212
} // namespace services
212213

services/src/ncp_fw_update.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ LOG_SOURCE_CATEGORY(SARA_NCP_FW_UPDATE_LOG_CATEGORY);
3535

3636
#include "check.h"
3737
#include "delay_hal.h"
38-
#include "platform_headers.h"
3938
#include "system_network.h"
4039

4140
// Change to 0 for debugging faster

test/unit_tests/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,13 @@ Build and run the tests and coverage:
2121
```bash
2222
make all test coverage
2323
```
24+
25+
26+
MacOSX
27+
------
28+
29+
Github issue: https://github.com/Homebrew/homebrew-core/issues/67427
30+
31+
You may run into an error `ld: library not found for -licudata` and will need to export the following before running `make`
32+
33+
`export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/opt/icu4c/lib`

test/unit_tests/services/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ add_executable( ${target_name}
77
${TEST_DIR}/util/random.cpp
88
${DEVICE_OS_DIR}/services/src/simple_file_storage.cpp
99
${DEVICE_OS_DIR}/services/src/str_util.cpp
10+
${DEVICE_OS_DIR}/services/src/ncp_fw_update.cpp
11+
ncp_fw_update.cpp
1012
simple_file_storage.cpp
1113
str_util.cpp
1214
varint.cpp
@@ -17,6 +19,7 @@ add_executable( ${target_name}
1719
target_compile_definitions( ${target_name}
1820
PRIVATE PLATFORM_ID=3
1921
PRIVATE HAL_PLATFORM_FILESYSTEM=1
22+
PRIVATE HAL_PLATFORM_NCP_FW_UPDATE=1
2023
)
2124

2225
# Set compiler flags specific to target

0 commit comments

Comments
 (0)