Skip to content

Commit

Permalink
[wip] adding unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
technobly committed Nov 15, 2021
1 parent 1e68e1b commit 3c678a4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion services/inc/ncp_fw_update.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "hal_platform.h"
#include "system_tick_hal.h"
#include "core_hal.h"
#include "system_defs.h"
#include "system_mode.h"
#include "system_network.h"
Expand Down Expand Up @@ -196,6 +195,7 @@ class SaraNcpFwUpdate {
void logSaraNcpFwUpdateData(SaraNcpFwUpdateData& data);
};

#ifndef UNIT_TEST
class NcpFwUpdateDiagnostics: public AbstractUnsignedIntegerDiagnosticData {
public:
NcpFwUpdateDiagnostics() :
Expand All @@ -207,6 +207,7 @@ class NcpFwUpdateDiagnostics: public AbstractUnsignedIntegerDiagnosticData {
return 0; // OK
}
};
#endif // UNIT_TEST

} // namespace services

Expand Down
1 change: 0 additions & 1 deletion services/src/ncp_fw_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ LOG_SOURCE_CATEGORY(SARA_NCP_FW_UPDATE_LOG_CATEGORY);

#include "check.h"
#include "delay_hal.h"
#include "platform_headers.h"
#include "system_network.h"

// Change to 0 for debugging faster
Expand Down
10 changes: 10 additions & 0 deletions test/unit_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ Build and run the tests and coverage:
```bash
make all test coverage
```


MacOSX
------

Github issue: https://github.com/Homebrew/homebrew-core/issues/67427

You may run into an error `ld: library not found for -licudata` and will need to export the following before running `make`

`export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/opt/icu4c/lib`
3 changes: 3 additions & 0 deletions test/unit_tests/services/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ add_executable( ${target_name}
${TEST_DIR}/util/random.cpp
${DEVICE_OS_DIR}/services/src/simple_file_storage.cpp
${DEVICE_OS_DIR}/services/src/str_util.cpp
${DEVICE_OS_DIR}/services/src/ncp_fw_update.cpp
ncp_fw_update.cpp
simple_file_storage.cpp
str_util.cpp
varint.cpp
Expand All @@ -17,6 +19,7 @@ add_executable( ${target_name}
target_compile_definitions( ${target_name}
PRIVATE PLATFORM_ID=3
PRIVATE HAL_PLATFORM_FILESYSTEM=1
PRIVATE HAL_PLATFORM_NCP_FW_UPDATE=1
)

# Set compiler flags specific to target
Expand Down

0 comments on commit 3c678a4

Please sign in to comment.