Add test/zephyr.h to mock Zephyr functions/defines

This commit is contained in:
Martin Jäger
2020-06-04 16:28:19 +02:00
parent dfde83d8be
commit 3eb70e9a01
11 changed files with 13 additions and 21 deletions
-2
View File
@@ -6,9 +6,7 @@
#include "bat_charger.h"
#ifndef UNIT_TEST
#include <zephyr.h>
#endif
#include <math.h> // for fabs function
#include <stdio.h>
-2
View File
@@ -6,9 +6,7 @@
#include "daq.h"
#ifndef UNIT_TEST
#include <zephyr.h>
#endif
#include <math.h> // log for thermistor calculation
#include <assert.h>
-2
View File
@@ -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
-2
View File
@@ -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
View File
@@ -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);
-2
View File
@@ -6,9 +6,7 @@
#include "load.h"
#ifndef UNIT_TEST
#include <zephyr.h>
#endif
#if DT_OUTPUTS_LOAD_PRESENT || UNIT_TEST
-2
View File
@@ -6,9 +6,7 @@
#include "pwm_switch.h"
#ifndef UNIT_TEST
#include <zephyr.h>
#endif
#include <stdio.h>
#include <time.h>
-2
View File
@@ -6,9 +6,7 @@
#include "pwm_switch.h"
#ifndef UNIT_TEST
#include <zephyr.h>
#endif
#include <stdio.h>
#include <time.h>
-2
View File
@@ -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
-2
View File
@@ -4,9 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef UNIT_TEST
#include <zephyr.h>
#endif
#include <stdio.h>
+12
View File
@@ -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
*/