forked from FOME-Tech/fome-fw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmocks.h
146 lines (117 loc) · 4.76 KB
/
mocks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#pragma once
#include "electronic_throttle.h"
#include "dc_motor.h"
#include "table_helper.h"
#include "pwm_generator_logic.h"
#include "airmass.h"
#include "injector_model.h"
#include "stepper.h"
#include "tunerstudio_io.h"
#include "idle_thread.h"
#include "global_execution_queue.h"
#include "gmock/gmock.h"
class MockEtb : public IEtbController {
public:
MockEtb();
virtual ~MockEtb();
// IEtbController mocks
MOCK_METHOD(void, reset, (), (override));
MOCK_METHOD(bool, isEtbMode, (), (const, override));
MOCK_METHOD(void, update, (), (override));
MOCK_METHOD(bool, init, (dc_function_e function, DcMotor* motor, pid_s* pidParameters, const ValueProvider3D* pedalMap, bool initializeThrottles), (override));
MOCK_METHOD(void, setIdlePosition, (percent_t pos), (override));
MOCK_METHOD(void, setWastegatePosition, (percent_t pos), (override));
MOCK_METHOD(void, autoCalibrateTps, (), (override));
MOCK_METHOD(const pid_state_s&, getPidState, (), (const, override));
MOCK_METHOD(void, setLuaAdjustment, (percent_t adjustment), (override));
// ClosedLoopController mocks
MOCK_METHOD(expected<percent_t>, getSetpoint, (), (override));
MOCK_METHOD(expected<percent_t>, observePlant, (), (const, override));
MOCK_METHOD(expected<percent_t>, getOpenLoop, (percent_t setpoint), (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:
MockMotor();
virtual ~MockMotor();
MOCK_METHOD(bool, set, (float duty), (override));
MOCK_METHOD(float, get, (), (const, override));
MOCK_METHOD(void, enable, (), (override));
MOCK_METHOD(void, disable, (const char *msg), (override));
MOCK_METHOD(bool, isOpenDirection, (), (const, override));
};
class MockVp3d : public ValueProvider3D {
public:
MockVp3d();
virtual ~MockVp3d();
MOCK_METHOD(float, getValue, (float xColumn, float yRow), (const, override));
};
class MockPwm : public IPwm {
public:
MockPwm();
virtual ~MockPwm();
MOCK_METHOD(void, setSimplePwmDutyCycle, (float dutyCycle), (override));
};
class MockOutputPin : public OutputPin {
public:
MockOutputPin();
virtual ~MockOutputPin();
MOCK_METHOD(void, setValue, (int value), (override));
};
class MockExecutor : public TestExecutor {
public:
MockExecutor();
virtual ~MockExecutor();
MOCK_METHOD(void, schedule, (const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action), (override));
MOCK_METHOD(void, cancel, (scheduling_s*), (override));
};
class MockAirmass : public AirmassVeModelBase {
public:
MockAirmass();
virtual ~MockAirmass();
MockVp3d veTable;
MOCK_METHOD(AirmassResult, getAirmass, (float rpm, bool postState), (override));
};
class MockInjectorModel2 : public IInjectorModel {
public:
MockInjectorModel2();
virtual ~MockInjectorModel2();
MOCK_METHOD(void, prepare, (), (override));
MOCK_METHOD(floatms_t, getInjectionDuration, (float fuelMassGram), (const, override));
MOCK_METHOD(float, getFuelMassForDuration, (floatms_t duration), (const, override));
MOCK_METHOD(floatms_t, getDeadtime, (), (const, override));
};
class MockStepperHardware : public StepperHw {
public:
MockStepperHardware();
virtual ~MockStepperHardware();
MOCK_METHOD(bool, step, (bool positive), (override));
};
class MockTsChannel : public TsChannelBase {
public:
MockTsChannel();
virtual ~MockTsChannel();
MOCK_METHOD(void, write, (const uint8_t* buffer, size_t size, bool isEndOfPacket), (override));
MOCK_METHOD(size_t, readTimeout, (uint8_t* buffer, size_t size, int timeout), (override));
};
class MockIdleController : public IIdleController {
public:
MockIdleController();
virtual ~MockIdleController();
MOCK_METHOD(IIdleController::Phase, determinePhase, (float rpm, IIdleController::TargetInfo targetRpm, SensorResult tps, float vss, float crankingTaperFraction), (override));
MOCK_METHOD(IIdleController::TargetInfo, getTargetRpm, (float clt), (override));
MOCK_METHOD(float, getCrankingOpenLoop, (float clt), (const, override));
MOCK_METHOD(float, getRunningOpenLoop, (float rpm, float clt, SensorResult tps), (override));
MOCK_METHOD(float, getOpenLoop, (IIdleController::Phase phase, float rpm, float clt, SensorResult tps, float crankingTaperFraction), (override));
MOCK_METHOD(float, getClosedLoop, (IIdleController::Phase phase, float tps, float rpm, float target), (override));
MOCK_METHOD(float, getCrankingTaperFraction, (float clt), (const, override));
MOCK_METHOD(bool, isIdlingOrTaper, (), (const, override));
MOCK_METHOD(float, getIdleTimingAdjustment, (float rpm), (override));
};
class MockIgnitionController : public IgnitionController {
public:
MockIgnitionController();
virtual ~MockIgnitionController();
MOCK_METHOD(bool, getIgnState, (), (const, override));
};