reducing clutter
This commit is contained in:
parent
a63c22fddf
commit
2235063a13
|
@ -20,6 +20,7 @@
|
|||
#include "boards.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
// todo: include it right here? #include "unit_test_framework.h"
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
@ -52,8 +53,6 @@ void print(const char *fmt, ...);
|
|||
|
||||
#define INLINE inline
|
||||
|
||||
typedef int bool_t;
|
||||
|
||||
#define EFI_ERROR_CODE 0xffffffff
|
||||
|
||||
#define CCM_OPTIONAL
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* global_execution_queue.cpp
|
||||
*
|
||||
* @date Dec 8, 2018
|
||||
* @author Andrey Belomutskiy, (c) 2012-2018
|
||||
*/
|
||||
|
||||
#include "signal_executor.h"
|
||||
#include "event_queue.h"
|
||||
|
||||
// this global instance is used by integration tests via 'scheduleByTimestamp' global methods below
|
||||
EventQueue schedulingQueue;
|
||||
|
||||
bool_t debugSignalExecutor = false;
|
||||
|
||||
void scheduleForLater(scheduling_s *scheduling, int delayUs,
|
||||
schfunc_t callback, void *param) {
|
||||
if (debugSignalExecutor) {
|
||||
printf("scheduleTask %d\r\n", delayUs);
|
||||
}
|
||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, callback, param);
|
||||
}
|
||||
|
||||
void scheduleByTimestamp(scheduling_s *scheduling,
|
||||
efitimeus_t time, schfunc_t callback, void *param) {
|
||||
if (debugSignalExecutor) {
|
||||
printf("scheduleByTime %d\r\n", time);
|
||||
}
|
||||
schedulingQueue.insertTask(scheduling, time, callback, param);
|
||||
}
|
||||
|
||||
void initSignalExecutorImpl(void) {
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
TEST_SRC_CPP = test_util.cpp \
|
||||
unit_test_framework.cpp \
|
||||
boards.cpp \
|
||||
global_execution_queue.cpp \
|
||||
test_basic_math/test_find_index.cpp \
|
||||
test_basic_math/test_interpolation_3d.cpp \
|
||||
test_data_structures/test_engine_math.cpp \
|
||||
|
@ -12,6 +13,7 @@ TEST_SRC_CPP = test_util.cpp \
|
|||
test_fuel_map.cpp \
|
||||
test_fuelCut.cpp \
|
||||
engine_test_helper.cpp \
|
||||
test_pwm_generator.cpp \
|
||||
test_logic_expression.cpp \
|
||||
test_speed_density.cpp \
|
||||
test_signal_executor.cpp \
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
extern EventQueue schedulingQueue;
|
||||
extern int timeNowUs;
|
||||
extern EnginePins enginePins;
|
||||
|
||||
void testFasterEngineSpinningUp() {
|
||||
// this is just a reference unit test implementation
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* test_pwm_generator.cpp
|
||||
*
|
||||
* @date Dec 8, 2018
|
||||
* Author: user
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "unit_test_framework.h"
|
||||
#include "event_queue.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
|
||||
extern EventQueue schedulingQueue;
|
||||
extern int timeNowUs;
|
||||
|
||||
void testApplyPinState(PwmConfig *state, int stateIndex) {
|
||||
|
||||
}
|
||||
|
||||
void testPwmGenerator() {
|
||||
print("*************************************** testPwmGenerator\r\n");
|
||||
|
||||
SimplePwm pwm;
|
||||
|
||||
OutputPin pin;
|
||||
|
||||
//pwm.setFrequency(600);
|
||||
|
||||
schedulingQueue.clear();
|
||||
|
||||
startSimplePwm(&pwm, "unit_test",
|
||||
&pin,
|
||||
600 /* frequency */,
|
||||
0.80 /* duty cycle */,
|
||||
&testApplyPinState);
|
||||
|
||||
assertEquals(1, schedulingQueue.size());
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -5,40 +5,17 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2018
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include "global.h"
|
||||
#include <time.h>
|
||||
|
||||
#include "signal_executor.h"
|
||||
#include "test_signal_executor.h"
|
||||
#include "io_pins.h"
|
||||
#include "utlist.h"
|
||||
#include "event_queue.h"
|
||||
#include "unit_test_framework.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
#include "unit_test_framework.h"
|
||||
|
||||
EventQueue schedulingQueue;
|
||||
|
||||
bool_t debugSignalExecutor = false;
|
||||
|
||||
void scheduleForLater(scheduling_s *scheduling, int delayUs,
|
||||
schfunc_t callback, void *param) {
|
||||
if (debugSignalExecutor) {
|
||||
printf("scheduleTask %d\r\n", delayUs);
|
||||
}
|
||||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, callback, param);
|
||||
}
|
||||
|
||||
void scheduleByTimestamp(scheduling_s *scheduling,
|
||||
efitimeus_t time, schfunc_t callback, void *param) {
|
||||
if (debugSignalExecutor) {
|
||||
printf("scheduleByTime %d\r\n", time);
|
||||
}
|
||||
schedulingQueue.insertTask(scheduling, time, callback, param);
|
||||
}
|
||||
|
||||
void initSignalExecutorImpl(void) {
|
||||
}
|
||||
|
||||
// this instance is used by some unit tests here which reference it directly
|
||||
static EventQueue eq;
|
||||
|
||||
static int callbackCounter = 0;
|
||||
|
@ -114,27 +91,6 @@ static void testSignalExecutor3(void) {
|
|||
eq.executeAll(100);
|
||||
}
|
||||
|
||||
void testApplyPinState(PwmConfig *state, int stateIndex) {
|
||||
|
||||
}
|
||||
|
||||
void testPwmGenerator() {
|
||||
print("*************************************** testPwmGenerator\r\n");
|
||||
|
||||
SimplePwm pwm;
|
||||
|
||||
OutputPin pin;
|
||||
|
||||
//pwm.setFrequency(600);
|
||||
|
||||
startSimplePwm(&pwm, "unit_test",
|
||||
&pin,
|
||||
600 /* frequency */,
|
||||
0.80 /* duty cycle */,
|
||||
&testApplyPinState);
|
||||
|
||||
}
|
||||
|
||||
void testSignalExecutor(void) {
|
||||
testSignalExecutor3();
|
||||
print("*************************************** testSignalExecutor\r\n");
|
||||
|
|
Loading…
Reference in New Issue