diff --git a/src/bat_charger.cpp b/src/bat_charger.cpp index 8e0090c..e88c53f 100644 --- a/src/bat_charger.cpp +++ b/src/bat_charger.cpp @@ -6,9 +6,7 @@ #include "bat_charger.h" -#ifndef UNIT_TEST #include -#endif #include // for fabs function #include diff --git a/src/daq.cpp b/src/daq.cpp index 954516c..cf2b12b 100644 --- a/src/daq.cpp +++ b/src/daq.cpp @@ -6,9 +6,7 @@ #include "daq.h" -#ifndef UNIT_TEST #include -#endif #include // log for thermistor calculation #include diff --git a/src/dcdc.cpp b/src/dcdc.cpp index a20dac3..3fb074e 100644 --- a/src/dcdc.cpp +++ b/src/dcdc.cpp @@ -6,9 +6,7 @@ #include "dcdc.h" -#ifndef UNIT_TEST #include -#endif #include // for fabs function #include // for min/max function diff --git a/src/device_status.cpp b/src/device_status.cpp index 91bcf48..5e5c8dc 100644 --- a/src/device_status.cpp +++ b/src/device_status.cpp @@ -6,9 +6,7 @@ #include "device_status.h" -#ifndef UNIT_TEST #include -#endif #include // for fabs function #include diff --git a/src/helper.cpp b/src/helper.cpp index eb84da5..f778b85 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -8,13 +8,11 @@ #include -#ifndef UNIT_TEST #include -#endif uint32_t uptime() { -#ifndef UNIT_TEST +#ifdef __ZEPHYR__ return k_uptime_get() / 1000; #else return time(NULL); diff --git a/src/load.cpp b/src/load.cpp index 34d103a..bea82a5 100644 --- a/src/load.cpp +++ b/src/load.cpp @@ -6,9 +6,7 @@ #include "load.h" -#ifndef UNIT_TEST #include -#endif #if DT_OUTPUTS_LOAD_PRESENT || UNIT_TEST diff --git a/src/pwm_switch.cpp b/src/pwm_switch.cpp index 49cf74b..26f139c 100644 --- a/src/pwm_switch.cpp +++ b/src/pwm_switch.cpp @@ -6,9 +6,7 @@ #include "pwm_switch.h" -#ifndef UNIT_TEST #include -#endif #include #include diff --git a/src/pwm_switch_driver.c b/src/pwm_switch_driver.c index 8088fca..505e99d 100644 --- a/src/pwm_switch_driver.c +++ b/src/pwm_switch_driver.c @@ -6,9 +6,7 @@ #include "pwm_switch.h" -#ifndef UNIT_TEST #include -#endif #include #include diff --git a/src/setup.cpp b/src/setup.cpp index 8f306df..ac1fe5b 100644 --- a/src/setup.cpp +++ b/src/setup.cpp @@ -9,9 +9,7 @@ * @brief Setup of ports and other essential charge controller objects */ -#ifndef UNIT_TEST #include -#endif #include "thingset.h" // handles access to internal data via communication interfaces #include "board.h" // hardware-specific settings diff --git a/src/setup.h b/src/setup.h index 1b81d82..9bf9d81 100644 --- a/src/setup.h +++ b/src/setup.h @@ -4,9 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef UNIT_TEST #include -#endif #include diff --git a/test/zephyr.h b/test/zephyr.h new file mode 100644 index 0000000..80ef740 --- /dev/null +++ b/test/zephyr.h @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2020 Martin Jäger / Libre Solar + */ + +/** + * @file + * + * @brief Mock necessary functions and generated Devicetree or Kconfig defines from Zephyr + * for unit tests + */