Add test/zephyr.h to mock Zephyr functions/defines
This commit is contained in:
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "bat_charger.h"
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include <math.h> // for fabs function
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "daq.h"
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include <math.h> // log for thermistor calculation
|
||||
#include <assert.h>
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "dcdc.h"
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include <math.h> // for fabs function
|
||||
#include <stdlib.h> // for min/max function
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "device_status.h"
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include <math.h> // for fabs function
|
||||
#include <stdio.h>
|
||||
|
||||
+1
-3
@@ -8,13 +8,11 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
uint32_t uptime()
|
||||
{
|
||||
#ifndef UNIT_TEST
|
||||
#ifdef __ZEPHYR__
|
||||
return k_uptime_get() / 1000;
|
||||
#else
|
||||
return time(NULL);
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "load.h"
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#if DT_OUTPUTS_LOAD_PRESENT || UNIT_TEST
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "pwm_switch.h"
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "pwm_switch.h"
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
* @brief Setup of ports and other essential charge controller objects
|
||||
*/
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include "thingset.h" // handles access to internal data via communication interfaces
|
||||
#include "board.h" // hardware-specific settings
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
#include <zephyr.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.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
|
||||
*/
|
||||
Reference in New Issue
Block a user