2020-07-28 12:11:56 -07:00
|
|
|
#pragma once
|
|
|
|
|
2020-04-20 13:26:35 -07:00
|
|
|
#include "electronic_throttle.h"
|
|
|
|
#include "dc_motor.h"
|
|
|
|
#include "table_helper.h"
|
2020-04-26 11:06:28 -07:00
|
|
|
#include "pwm_generator_logic.h"
|
2020-07-28 12:11:56 -07:00
|
|
|
#include "airmass.h"
|
2021-03-03 04:30:56 -08:00
|
|
|
#include "injector_model.h"
|
2020-04-20 13:26:35 -07:00
|
|
|
|
|
|
|
#include "gmock/gmock.h"
|
|
|
|
|
|
|
|
class MockEtb : public IEtbController {
|
|
|
|
public:
|
|
|
|
// IEtbController mocks
|
2020-12-11 07:33:00 -08:00
|
|
|
MOCK_METHOD(void, reset, (), (override));
|
2020-09-18 10:47:49 -07:00
|
|
|
MOCK_METHOD(void, update, (), (override));
|
2020-12-08 03:24:20 -08:00
|
|
|
MOCK_METHOD(bool, init, (etb_function_e function, DcMotor* motor, pid_s* pidParameters, const ValueProvider3D* pedalMap, bool initializeThrottles), (override));
|
2020-04-20 13:26:35 -07:00
|
|
|
MOCK_METHOD(void, setIdlePosition, (percent_t pos), (override));
|
2020-10-18 18:57:04 -07:00
|
|
|
MOCK_METHOD(void, setWastegatePosition, (percent_t pos), (override));
|
2020-04-28 16:31:41 -07:00
|
|
|
MOCK_METHOD(void, autoCalibrateTps, (), (override));
|
2020-12-06 22:27:27 -08:00
|
|
|
MOCK_METHOD(const pid_state_s*, getPidState, (), (const, override));
|
2020-04-20 13:26:35 -07:00
|
|
|
|
|
|
|
// ClosedLoopController mocks
|
|
|
|
MOCK_METHOD(expected<percent_t>, getSetpoint, (), (const, override));
|
|
|
|
MOCK_METHOD(expected<percent_t>, observePlant, (), (const, override));
|
|
|
|
MOCK_METHOD(expected<percent_t>, getOpenLoop, (percent_t setpoint), (const, override));
|
|
|
|
MOCK_METHOD(expected<percent_t>, getClosedLoop, (percent_t setpoint, percent_t observation), (override));
|
|
|
|
MOCK_METHOD(void, setOutput, (expected<percent_t> outputValue), (override));
|
|
|
|
};
|
|
|
|
|
|
|
|
class MockMotor : public DcMotor {
|
|
|
|
public:
|
|
|
|
MOCK_METHOD(bool, set, (float duty), (override));
|
|
|
|
MOCK_METHOD(float, get, (), (const, override));
|
|
|
|
MOCK_METHOD(void, enable, (), (override));
|
|
|
|
MOCK_METHOD(void, disable, (), (override));
|
|
|
|
MOCK_METHOD(bool, isOpenDirection, (), (const, override));
|
|
|
|
};
|
|
|
|
|
|
|
|
class MockVp3d : public ValueProvider3D {
|
|
|
|
public:
|
2021-05-20 12:31:16 -07:00
|
|
|
MOCK_METHOD(float, getValue, (float xColumn, float yRow), (const, override));
|
2020-04-20 13:26:35 -07:00
|
|
|
};
|
2020-04-26 11:06:28 -07:00
|
|
|
|
2021-07-01 06:21:18 -07:00
|
|
|
class MockPwm : public IPwm {
|
2020-04-26 11:06:28 -07:00
|
|
|
public:
|
|
|
|
MOCK_METHOD(void, setSimplePwmDutyCycle, (float dutyCycle), (override));
|
|
|
|
};
|
2020-05-14 04:44:32 -07:00
|
|
|
|
2020-06-11 17:43:26 -07:00
|
|
|
class MockOutputPin : public OutputPin {
|
|
|
|
public:
|
|
|
|
MOCK_METHOD(void, setValue, (int value), (override));
|
|
|
|
};
|
|
|
|
|
2020-05-14 04:44:32 -07:00
|
|
|
class MockExecutor : public TestExecutor {
|
|
|
|
public:
|
2021-07-14 13:03:00 -07:00
|
|
|
MOCK_METHOD(void, scheduleByTimestamp, (const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action), (override));
|
|
|
|
MOCK_METHOD(void, scheduleByTimestampNt, (const char *msg, scheduling_s *scheduling, efitime_t timeUs, action_s action), (override));
|
2020-05-14 04:44:32 -07:00
|
|
|
MOCK_METHOD(void, scheduleForLater, (scheduling_s *scheduling, int delayUs, action_s action), (override));
|
|
|
|
};
|
2020-07-26 20:35:36 -07:00
|
|
|
|
2021-05-14 04:17:22 -07:00
|
|
|
class MockAirmass : public AirmassVeModelBase {
|
2020-07-26 20:35:36 -07:00
|
|
|
public:
|
2021-05-14 04:17:22 -07:00
|
|
|
MockAirmass() : AirmassVeModelBase(veTable) {}
|
2020-07-28 12:11:56 -07:00
|
|
|
|
|
|
|
MockVp3d veTable;
|
|
|
|
|
2021-06-30 21:05:42 -07:00
|
|
|
MOCK_METHOD(AirmassResult, getAirmass, (int rpm), (override));
|
2020-07-26 20:35:36 -07:00
|
|
|
};
|
2021-03-03 04:30:56 -08:00
|
|
|
|
|
|
|
class MockInjectorModel2 : public IInjectorModel {
|
|
|
|
public:
|
|
|
|
MOCK_METHOD(void, prepare, (), (override));
|
|
|
|
MOCK_METHOD(floatms_t, getInjectionDuration, (float fuelMassGram), (const, override));
|
|
|
|
MOCK_METHOD(float, getFuelMassForDuration, (floatms_t duration), (const, override));
|
|
|
|
};
|