GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/util/test_engine_configuration.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 98.7% 303 0 307
Functions: 100.0% 62 0 62
Branches: 49.4% 300 0 607
Decisions: 98.4% 124 - 126

Line Branch Decision Exec Source
1 //
2 // Created by kifir on 11/4/24.
3 //
4
5 #include "pch.h"
6
7 #include "test_engine_configuration.h"
8
9 #include "engine_configuration_defaults.h"
10
11 7629 TestEngineConfiguration& TestEngineConfiguration::getInstance() {
12 7629 return instance;
13 }
14
15 129 void TestEngineConfiguration::configureClutchDownPin(const std::optional<switch_input_pin_e> pin) {
16
2/2
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 87 times.
2/2
✓ Decision 'true' taken 42 times.
✓ Decision 'false' taken 87 times.
129 if (pin.has_value()) {
17 42 engineConfiguration->clutchDownPin = pin.value();
18 } else {
19
2/6
✓ Branch 2 taken 87 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 87 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
87 ASSERT_EQ(
20 engineConfiguration->clutchDownPin,
21 engine_configuration_defaults::CLUTCH_DOWN_PIN
22
1/2
✓ Branch 1 taken 87 times.
✗ Branch 2 not taken.
87 ); // check default value
23 }
24 }
25
26 129 void TestEngineConfiguration::configureClutchDownPinMode(const std::optional<pin_input_mode_e> pinMode) {
27
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 125 times.
2/2
✓ Decision 'true' taken 4 times.
✓ Decision 'false' taken 125 times.
129 if (pinMode.has_value()) {
28 4 engineConfiguration->clutchDownPinMode = pinMode.value();
29 } else {
30
2/6
✓ Branch 2 taken 125 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 125 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
125 ASSERT_EQ(
31 engineConfiguration->clutchDownPinMode,
32 engine_configuration_defaults::CLUTCH_DOWN_PIN_MODE
33
1/2
✓ Branch 1 taken 125 times.
✗ Branch 2 not taken.
125 ); // check default value
34 }
35 }
36
37 129 void TestEngineConfiguration::configureClutchUpPin(const std::optional<switch_input_pin_e> pin) {
38
2/2
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 87 times.
2/2
✓ Decision 'true' taken 42 times.
✓ Decision 'false' taken 87 times.
129 if (pin.has_value()) {
39 42 engineConfiguration->clutchUpPin = pin.value();
40 } else {
41
2/6
✓ Branch 2 taken 87 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 87 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
87 ASSERT_EQ(
42 engineConfiguration->clutchUpPin,
43 engine_configuration_defaults::CLUTCH_UP_PIN
44
1/2
✓ Branch 1 taken 87 times.
✗ Branch 2 not taken.
87 ); // check default value
45 }
46 }
47
48 129 void TestEngineConfiguration::configureClutchUpPinMode(const std::optional<pin_input_mode_e> pinMode) {
49
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 125 times.
2/2
✓ Decision 'true' taken 4 times.
✓ Decision 'false' taken 125 times.
129 if (pinMode.has_value()) {
50 4 engineConfiguration->clutchUpPinMode = pinMode.value();
51 } else {
52
2/6
✓ Branch 2 taken 125 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 125 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
125 ASSERT_EQ(
53 engineConfiguration->clutchUpPinMode,
54 engine_configuration_defaults::CLUTCH_UP_PIN_MODE
55
1/2
✓ Branch 1 taken 125 times.
✗ Branch 2 not taken.
125 ); // check default value
56 }
57 }
58
59 129 void TestEngineConfiguration::configureLaunchControlEnabled(const std::optional<bool> launchControlEnabled) {
60
2/2
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 112 times.
2/2
✓ Decision 'true' taken 17 times.
✓ Decision 'false' taken 112 times.
129 if (launchControlEnabled.has_value()) {
61 17 engineConfiguration->launchControlEnabled = launchControlEnabled.value();
62 } else {
63
2/8
✗ Branch 5 not taken.
✓ Branch 6 taken 112 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 30 taken 112 times.
✗ Branch 31 not taken.
112 ASSERT_FALSE(engineConfiguration->launchControlEnabled); // check default value
64 }
65 }
66
67 9 void TestEngineConfiguration::configureLaunchActivationMode(
68 const std::optional<launchActivationMode_e> launchActivationMode
69 ) {
70
1/2
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
1/2
✓ Decision 'true' taken 9 times.
✗ Decision 'false' not taken.
9 if (launchActivationMode.has_value()) {
71 9 engineConfiguration->launchActivationMode = launchActivationMode.value();
72 } else {
73 ASSERT_EQ(
74 engineConfiguration->launchActivationMode,
75 engine_configuration_defaults::LAUNCH_ACTIVATION_MODE
76 ); // check default value
77 }
78 }
79
80 9 void TestEngineConfiguration::configureLaunchSpeedThreshold(const std::optional<int> launchSpeedThreshold) {
81
1/2
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
1/2
✓ Decision 'true' taken 9 times.
✗ Decision 'false' not taken.
9 if (launchSpeedThreshold.has_value()) {
82 9 engineConfiguration->launchSpeedThreshold = launchSpeedThreshold.value();
83 } else {
84 ASSERT_EQ(
85 engineConfiguration->launchSpeedThreshold,
86 engine_configuration_defaults::LAUNCH_SPEED_THRESHOLD
87 ); // check default value
88 }
89 }
90
91 129 void TestEngineConfiguration::configureLaunchRpm(const std::optional<int> launchRpm) {
92
2/2
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 111 times.
2/2
✓ Decision 'true' taken 18 times.
✓ Decision 'false' taken 111 times.
129 if (launchRpm.has_value()) {
93 18 engineConfiguration->launchRpm = launchRpm.value();
94 } else {
95
3/8
✓ Branch 3 taken 111 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 111 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 26 taken 111 times.
✗ Branch 27 not taken.
111 ASSERT_EQ(engineConfiguration->launchRpm, 3000); // check default value
96 }
97 }
98
99 129 void TestEngineConfiguration::configureLaunchRpmWindow(const std::optional<int> launchRpmWindow) {
100
2/2
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 111 times.
2/2
✓ Decision 'true' taken 18 times.
✓ Decision 'false' taken 111 times.
129 if (launchRpmWindow.has_value()) {
101 18 engineConfiguration->launchRpmWindow = launchRpmWindow.value();
102 } else {
103
3/8
✓ Branch 3 taken 111 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 111 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 26 taken 111 times.
✗ Branch 27 not taken.
111 ASSERT_EQ(engineConfiguration->launchRpmWindow, 500); // check default value
104 }
105 }
106
107 129 void TestEngineConfiguration::configureLaunchCorrectionsEndRpm(const std::optional<int> launchCorrectionsEndRpm) {
108
2/2
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 111 times.
2/2
✓ Decision 'true' taken 18 times.
✓ Decision 'false' taken 111 times.
129 if (launchCorrectionsEndRpm.has_value()) {
109 18 engineConfiguration->launchCorrectionsEndRpm = launchCorrectionsEndRpm.value();
110 } else {
111
3/8
✓ Branch 3 taken 111 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 111 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 26 taken 111 times.
✗ Branch 27 not taken.
111 ASSERT_EQ(engineConfiguration->launchCorrectionsEndRpm, 0); // check default value
112 }
113 }
114
115 129 void TestEngineConfiguration::configureIgnitionRetardEnable(std::optional<bool> ignitionRetardEnable) {
116
2/2
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 120 times.
2/2
✓ Decision 'true' taken 9 times.
✓ Decision 'false' taken 120 times.
129 if (ignitionRetardEnable.has_value()) {
117 9 engineConfiguration->enableLaunchRetard = ignitionRetardEnable.value();
118 } else {
119
2/8
✗ Branch 5 not taken.
✓ Branch 6 taken 120 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 30 taken 120 times.
✗ Branch 31 not taken.
120 ASSERT_FALSE(engineConfiguration->enableLaunchRetard); // check default value
120 }
121 }
122
123 129 void TestEngineConfiguration::configureIgnitionRetard(std::optional<float> ignitionRetard) {
124
2/2
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 119 times.
2/2
✓ Decision 'true' taken 10 times.
✓ Decision 'false' taken 119 times.
129 if (ignitionRetard.has_value()) {
125 10 engineConfiguration->launchTimingRetard = ignitionRetard.value();
126 } else {
127
3/8
✓ Branch 3 taken 119 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 119 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 26 taken 119 times.
✗ Branch 27 not taken.
119 ASSERT_EQ(engineConfiguration->launchTimingRetard, 0); // check default value
128 }
129 }
130
131 129 void TestEngineConfiguration::configureSmoothRetardMode(std::optional<bool> smoothRetardMode) {
132
2/2
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 120 times.
2/2
✓ Decision 'true' taken 9 times.
✓ Decision 'false' taken 120 times.
129 if (smoothRetardMode.has_value()) {
133 9 engineConfiguration->launchSmoothRetard = smoothRetardMode.value();
134 } else {
135
2/8
✗ Branch 5 not taken.
✓ Branch 6 taken 120 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 30 taken 120 times.
✗ Branch 31 not taken.
120 ASSERT_FALSE(engineConfiguration->launchSmoothRetard); // check default value
136 }
137 }
138
139 129 void TestEngineConfiguration::configureEnableIgnitionCut(const std::optional<bool> enableIgnitionCut) {
140
2/2
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 111 times.
2/2
✓ Decision 'true' taken 18 times.
✓ Decision 'false' taken 111 times.
129 if (enableIgnitionCut.has_value()) {
141 18 engineConfiguration->launchSparkCutEnable = enableIgnitionCut.value();
142 } else {
143
2/8
✗ Branch 5 not taken.
✓ Branch 6 taken 111 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✓ Branch 30 taken 111 times.
✗ Branch 31 not taken.
111 ASSERT_FALSE(engineConfiguration->launchSparkCutEnable); // check default value
144 }
145 }
146
147 129 void TestEngineConfiguration::configureInitialIgnitionCutPercent(const std::optional<int> initialIgnitionCutPercent) {
148
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 121 times.
2/2
✓ Decision 'true' taken 8 times.
✓ Decision 'false' taken 121 times.
129 if (initialIgnitionCutPercent.has_value()) {
149 8 engineConfiguration->initialIgnitionCutPercent = initialIgnitionCutPercent.value();
150 } else {
151
3/8
✓ Branch 3 taken 121 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 121 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 26 taken 121 times.
✗ Branch 27 not taken.
121 ASSERT_EQ(engineConfiguration->initialIgnitionCutPercent, 0); // check default value
152 }
153 }
154
155 129 void TestEngineConfiguration::configureFinalIgnitionCutPercentBeforeLaunch(
156 const std::optional<int> finalIgnitionCutPercentBeforeLaunch
157 ) {
158
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 121 times.
2/2
✓ Decision 'true' taken 8 times.
✓ Decision 'false' taken 121 times.
129 if (finalIgnitionCutPercentBeforeLaunch.has_value()) {
159 8 engineConfiguration->finalIgnitionCutPercentBeforeLaunch = finalIgnitionCutPercentBeforeLaunch.value();
160 } else {
161
3/8
✓ Branch 3 taken 121 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 121 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 26 taken 121 times.
✗ Branch 27 not taken.
121 ASSERT_EQ(engineConfiguration->finalIgnitionCutPercentBeforeLaunch, 0); // check default value
162 }
163 }
164
165 129 void TestEngineConfiguration::configureTorqueReductionEnabled(const std::optional<bool> torqueReductionEnabled) {
166
2/2
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 69 times.
2/2
✓ Decision 'true' taken 60 times.
✓ Decision 'false' taken 69 times.
129 if (torqueReductionEnabled.has_value()) {
167 60 engineConfiguration->torqueReductionEnabled = torqueReductionEnabled.value();
168 } else {
169
2/6
✓ Branch 3 taken 69 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 69 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
69 ASSERT_EQ(
170 engineConfiguration->torqueReductionEnabled,
171 engine_configuration_defaults::ENABLE_SHIFT_TORQUE_REDUCTION
172
1/2
✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
69 ); // check default value
173 }
174 }
175
176 129 void TestEngineConfiguration::configureTorqueReductionActivationMode(
177 const std::optional<torqueReductionActivationMode_e> activationMode
178 ) {
179
2/2
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 94 times.
2/2
✓ Decision 'true' taken 35 times.
✓ Decision 'false' taken 94 times.
129 if (activationMode.has_value()) {
180 35 engineConfiguration->torqueReductionActivationMode = activationMode.value();
181 } else {
182
2/6
✓ Branch 2 taken 94 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 94 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
94 ASSERT_EQ(
183 engineConfiguration->torqueReductionActivationMode,
184 engine_configuration_defaults::TORQUE_REDUCTION_ACTIVATION_MODE
185
1/2
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
94 ); // check default value
186 }
187 }
188
189 129 void TestEngineConfiguration::configureTorqueReductionTriggerPin(const std::optional<switch_input_pin_e> pin) {
190
2/2
✓ Branch 1 taken 56 times.
✓ Branch 2 taken 73 times.
2/2
✓ Decision 'true' taken 56 times.
✓ Decision 'false' taken 73 times.
129 if (pin.has_value()) {
191 56 engineConfiguration->torqueReductionTriggerPin = pin.value();
192 } else {
193
2/6
✓ Branch 2 taken 73 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 73 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
73 ASSERT_EQ(
194 engineConfiguration->torqueReductionTriggerPin,
195 engine_configuration_defaults::TORQUE_REDUCTION_TRIGGER_PIN
196
1/2
✓ Branch 1 taken 73 times.
✗ Branch 2 not taken.
73 ); // check default value
197 }
198 }
199
200 129 void TestEngineConfiguration::configureTorqueReductionButtonMode(const std::optional<pin_input_mode_e> pinMode) {
201
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 125 times.
2/2
✓ Decision 'true' taken 4 times.
✓ Decision 'false' taken 125 times.
129 if (pinMode.has_value()) {
202 4 engineConfiguration->torqueReductionTriggerPinMode = pinMode.value();
203 } else {
204
2/6
✓ Branch 2 taken 125 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 125 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
125 ASSERT_EQ(
205 engineConfiguration->torqueReductionTriggerPinMode,
206 engine_configuration_defaults::TORQUE_REDUCTION_TRIGGER_PIN_MODE
207
1/2
✓ Branch 1 taken 125 times.
✗ Branch 2 not taken.
125 ); // check default value
208 }
209 }
210
211 129 void TestEngineConfiguration::configureLaunchActivatePin(const std::optional<switch_input_pin_e> pin) {
212
2/2
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 87 times.
2/2
✓ Decision 'true' taken 42 times.
✓ Decision 'false' taken 87 times.
129 if (pin.has_value()) {
213 42 engineConfiguration->launchActivatePin = pin.value();
214 } else {
215
2/6
✓ Branch 2 taken 87 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 87 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
87 ASSERT_EQ(
216 engineConfiguration->launchActivatePin,
217 engine_configuration_defaults::LAUNCH_ACTIVATE_PIN
218
1/2
✓ Branch 1 taken 87 times.
✗ Branch 2 not taken.
87 ); // check default value
219 }
220 }
221
222 129 void TestEngineConfiguration::configureLaunchActivateMode(const std::optional<pin_input_mode_e> pinMode) {
223
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (pinMode.has_value()) {
224 2 engineConfiguration->launchActivatePinMode = pinMode.value();
225 } else {
226
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
227 engineConfiguration->launchActivatePinMode,
228 engine_configuration_defaults::LAUNCH_ACTIVATE_PIN_MODE
229
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
230 }
231 }
232
233 129 void TestEngineConfiguration::configureLimitTorqueReductionTime(std::optional<bool> limitTorqueReductionTime) {
234
2/2
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 115 times.
2/2
✓ Decision 'true' taken 14 times.
✓ Decision 'false' taken 115 times.
129 if (limitTorqueReductionTime.has_value()) {
235 14 engineConfiguration->limitTorqueReductionTime = limitTorqueReductionTime.value();
236 } else {
237
2/6
✓ Branch 3 taken 115 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 115 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
115 ASSERT_EQ(
238 engineConfiguration->limitTorqueReductionTime,
239 engine_configuration_defaults::LIMIT_TORQUE_REDUCTION_TIME
240
1/2
✓ Branch 1 taken 115 times.
✗ Branch 2 not taken.
115 ); // check default value
241 }
242 }
243
244 129 void TestEngineConfiguration::configureTorqueReductionTime(std::optional<float> timeout) {
245
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 117 times.
2/2
✓ Decision 'true' taken 12 times.
✓ Decision 'false' taken 117 times.
129 if (timeout.has_value()) {
246 12 setTable(config->torqueReductionTimeTable, timeout.value());
247 } else {
248 117 const int expected_TORQUE_REDUCTION_TIME[] = { 0, 0, 0, 0, 0, 0 };
249
4/8
✓ Branch 4 taken 117 times.
✓ Branch 7 taken 117 times.
✓ Branch 10 taken 117 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 117 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 29 not taken.
117 EXPECT_THAT(
250 config->torqueReductionTimeTable[0],
251 testing::ElementsAreArray(expected_TORQUE_REDUCTION_TIME)
252 117 ); // check default value
253 }
254 129 }
255
256 129 void TestEngineConfiguration::configureTorqueReductionArmingRpm(const std::optional<float> armingRpm) {
257
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 122 times.
2/2
✓ Decision 'true' taken 7 times.
✓ Decision 'false' taken 122 times.
129 if (armingRpm.has_value()) {
258 7 engineConfiguration->torqueReductionArmingRpm = armingRpm.value();
259 } else {
260
2/6
✓ Branch 2 taken 122 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 122 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
122 ASSERT_EQ(
261 engineConfiguration->torqueReductionArmingRpm,
262 engine_configuration_defaults::TORQUE_REDUCTION_ARMING_RPM
263
1/2
✓ Branch 1 taken 122 times.
✗ Branch 2 not taken.
122 ); // check default value
264 }
265 }
266
267 129 void TestEngineConfiguration::configureTorqueReductionArmingApp(const std::optional<float> armingApp) {
268
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 122 times.
2/2
✓ Decision 'true' taken 7 times.
✓ Decision 'false' taken 122 times.
129 if (armingApp.has_value()) {
269 7 engineConfiguration->torqueReductionArmingApp = armingApp.value();
270 } else {
271
2/6
✓ Branch 2 taken 122 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 122 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
122 ASSERT_EQ(
272 engineConfiguration->torqueReductionArmingApp,
273 engine_configuration_defaults::TORQUE_REDUCTION_ARMING_APP
274
1/2
✓ Branch 1 taken 122 times.
✗ Branch 2 not taken.
122 ); // check default value
275 }
276 }
277
278 129 void TestEngineConfiguration::configureTorqueReductionIgnitionCut(const std::optional<int8_t> ignitionCut) {
279
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (ignitionCut.has_value()) {
280 2 setTable(config->torqueReductionIgnitionCutTable, ignitionCut.value());
281 } else {
282 127 const int expected_TORQUE_REDUCTION_IGNITION_CUT[] = { 0, 0, 0, 0, 0, 0 };
283
4/8
✓ Branch 4 taken 127 times.
✓ Branch 7 taken 127 times.
✓ Branch 10 taken 127 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 127 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 29 not taken.
127 EXPECT_THAT(
284 config->torqueReductionIgnitionCutTable[0],
285 testing::ElementsAreArray(expected_TORQUE_REDUCTION_IGNITION_CUT)
286 127 ); // check default value
287 }
288 129 }
289
290 129 void TestEngineConfiguration::configureTorqueReductionIgnitionRetard(const std::optional<int8_t> ignitionRetard) {
291
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (ignitionRetard.has_value()) {
292 2 setTable(config->torqueReductionIgnitionRetardTable, ignitionRetard.value());
293 } else {
294 127 const int expected_TORQUE_REDUCTION_IGNITION_RETARD[] = { 0, 0, 0, 0, 0, 0 };
295
4/8
✓ Branch 4 taken 127 times.
✓ Branch 7 taken 127 times.
✓ Branch 10 taken 127 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 127 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 29 not taken.
127 EXPECT_THAT(
296 config->torqueReductionIgnitionRetardTable[0],
297 testing::ElementsAreArray(expected_TORQUE_REDUCTION_IGNITION_RETARD)
298 127 ); // check default value
299 }
300 129 }
301
302 129 void TestEngineConfiguration::configureFuelPressureSensorMode(
303 const std::optional<fuel_pressure_sensor_mode_e> fuelPressureSensorMode
304 ) {
305
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 126 times.
2/2
✓ Decision 'true' taken 3 times.
✓ Decision 'false' taken 126 times.
129 if (fuelPressureSensorMode.has_value()) {
306 3 engineConfiguration->fuelPressureSensorMode = fuelPressureSensorMode.value();
307 } else {
308
2/6
✓ Branch 2 taken 126 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 126 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
126 ASSERT_EQ(
309 engineConfiguration->fuelPressureSensorMode,
310 engine_configuration_defaults::FUEL_PRESSURE_SENSOR_MODE
311
1/2
✓ Branch 1 taken 126 times.
✗ Branch 2 not taken.
126 ); // check default value
312 }
313 }
314
315 129 void TestEngineConfiguration::configureInjectorFlowAsMassFlow(const std::optional<bool> injectorFlowAsMassFlow) {
316
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (injectorFlowAsMassFlow.has_value()) {
317 2 engineConfiguration->injectorFlowAsMassFlow = injectorFlowAsMassFlow.value();
318 } else {
319
2/6
✓ Branch 3 taken 127 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 127 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
127 ASSERT_EQ(
320 engineConfiguration->injectorFlowAsMassFlow,
321 engine_configuration_defaults::INJECTOR_FLOW_AS_MASS_FLOW
322
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
323 }
324 }
325
326 129 void TestEngineConfiguration::configureInjectorFlow(const std::optional<float> flow) {
327
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (flow.has_value()) {
328 2 engineConfiguration->injector.flow = flow.value();
329 } else {
330
3/8
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✓ Branch 24 taken 127 times.
✗ Branch 25 not taken.
127 ASSERT_EQ(engineConfiguration->injector.flow, engine_configuration_defaults::INJECTOR_FLOW); // check default value
331 }
332 }
333
334 static_assert(std::tuple_size<BattLagCorrTable> {} == sizeof(engineConfiguration->injector.battLagCorrTable) / sizeof(engineConfiguration->injector.battLagCorrTable[0]));
335
336 129 void TestEngineConfiguration::configureInjectorBattLagCorr(const std::optional<BattLagCorrTable> battLagCorr) {
337
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (battLagCorr.has_value()) {
338 2 copyTable(engineConfiguration->injector.battLagCorrTable, battLagCorr.value());
339 } else {
340
2/2
✓ Branch 3 taken 254 times.
✓ Branch 4 taken 127 times.
2/2
✓ Decision 'true' taken 254 times.
✓ Decision 'false' taken 127 times.
381 for (size_t row = 0; row < std::tuple_size<BattLagCorrTable> {}; ++row) {
341
4/8
✓ Branch 5 taken 254 times.
✓ Branch 8 taken 254 times.
✓ Branch 12 taken 254 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 254 times.
✗ Branch 23 not taken.
✗ Branch 28 not taken.
✗ Branch 31 not taken.
254 EXPECT_THAT(
342 engineConfiguration->injector.battLagCorrTable[row],
343 testing::ElementsAreArray(engine_configuration_defaults::INJECTOR_BATT_LAG_CURR[row])
344 254 );
345 }
346 }
347 129 }
348 129 void TestEngineConfiguration::configureFuelReferencePressure(const std::optional<float> fuelReferencePressure) {
349
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 121 times.
2/2
✓ Decision 'true' taken 8 times.
✓ Decision 'false' taken 121 times.
129 if (fuelReferencePressure.has_value()) {
350 8 engineConfiguration->fuelReferencePressure = fuelReferencePressure.value();
351 } else {
352
2/6
✓ Branch 2 taken 121 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 121 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
121 ASSERT_EQ(
353 engineConfiguration->fuelReferencePressure,
354 engine_configuration_defaults::FUEL_REFERENCE_PRESSURE
355
1/2
✓ Branch 1 taken 121 times.
✗ Branch 2 not taken.
121 ); // check default value
356 }
357 }
358
359 129 void TestEngineConfiguration::configureInjectorCompensationMode(
360 const std::optional<injector_compensation_mode_e> injectorCompensationMode
361 ) {
362
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 122 times.
2/2
✓ Decision 'true' taken 7 times.
✓ Decision 'false' taken 122 times.
129 if (injectorCompensationMode.has_value()) {
363 7 engineConfiguration->injectorCompensationMode = injectorCompensationMode.value();
364 } else {
365
2/6
✓ Branch 2 taken 122 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 122 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
122 ASSERT_EQ(
366 engineConfiguration->injectorCompensationMode,
367 engine_configuration_defaults::INJECTOR_COMPENSATION_MODE
368
1/2
✓ Branch 1 taken 122 times.
✗ Branch 2 not taken.
122 ); // check default value
369 }
370 }
371
372 129 void TestEngineConfiguration::configureInjectorSecondaryFlow(const std::optional<float> flow) {
373
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (flow.has_value()) {
374 2 engineConfiguration->injectorSecondary.flow = flow.value();
375 } else {
376
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
377 engineConfiguration->injectorSecondary.flow,
378 engine_configuration_defaults::INJECTOR_SECONDARY_FLOW
379
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
380 }
381 }
382
383 129 void TestEngineConfiguration::configureInjectorSecondaryBattLagCorr(const std::optional<BattLagCorrTable> battLagCorr) {
384
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (battLagCorr.has_value()) {
385
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
2/2
✓ Decision 'true' taken 4 times.
✓ Decision 'false' taken 2 times.
6 for (size_t i = 0; i < VBAT_INJECTOR_CURVE_PRESSURE_SIZE; i++) {
386 4 std::copy(
387 4 std::begin(battLagCorr.value()[i]),
388 4 std::end(battLagCorr.value()[i]),
389 4 std::begin(engineConfiguration->injectorSecondary.battLagCorrTable[i])
390 );
391 }
392 } else {
393
2/2
✓ Branch 3 taken 254 times.
✓ Branch 4 taken 127 times.
2/2
✓ Decision 'true' taken 254 times.
✓ Decision 'false' taken 127 times.
381 for (size_t row = 0; row < std::tuple_size<BattLagCorrTable> {}; ++row) {
394
4/8
✓ Branch 5 taken 254 times.
✓ Branch 8 taken 254 times.
✓ Branch 12 taken 254 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 254 times.
✗ Branch 23 not taken.
✗ Branch 28 not taken.
✗ Branch 31 not taken.
254 EXPECT_THAT(
395 engineConfiguration->injector.battLagCorrTable[row],
396 testing::ElementsAreArray(engine_configuration_defaults::INJECTOR_SECONDARY_BATT_LAG_CURR[row])
397 254 );
398 }
399 }
400 129 }
401
402 129 void TestEngineConfiguration::configureSecondaryInjectorFuelReferencePressure(
403 const std::optional<float> secondaryInjectorFuelReferencePressure
404 ) {
405
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 121 times.
2/2
✓ Decision 'true' taken 8 times.
✓ Decision 'false' taken 121 times.
129 if (secondaryInjectorFuelReferencePressure.has_value()) {
406 8 engineConfiguration->secondaryInjectorFuelReferencePressure = secondaryInjectorFuelReferencePressure.value();
407 } else {
408
2/6
✓ Branch 2 taken 121 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 121 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
121 ASSERT_EQ(
409 engineConfiguration->secondaryInjectorFuelReferencePressure,
410 engine_configuration_defaults::SECONDARY_INJECTOR_FUEL_REFERENCE_PRESSURE
411
1/2
✓ Branch 1 taken 121 times.
✗ Branch 2 not taken.
121 ); // check default value
412 }
413 }
414
415 129 void TestEngineConfiguration::configureSecondaryInjectorCompensationMode(
416 const std::optional<injector_compensation_mode_e> secondaryInjectorCompensationMode
417 ) {
418
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 122 times.
2/2
✓ Decision 'true' taken 7 times.
✓ Decision 'false' taken 122 times.
129 if (secondaryInjectorCompensationMode.has_value()) {
419 7 engineConfiguration->secondaryInjectorCompensationMode = secondaryInjectorCompensationMode.value();
420 } else {
421
2/6
✓ Branch 2 taken 122 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 122 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
122 ASSERT_EQ(
422 engineConfiguration->secondaryInjectorCompensationMode,
423 engine_configuration_defaults::SECONDARY_INJECTOR_COMPENSATION_MODE
424
1/2
✓ Branch 1 taken 122 times.
✗ Branch 2 not taken.
122 ); // check default value
425 }
426 }
427
428 129 void TestEngineConfiguration::configureEnableStagedInjection(const std::optional<bool> isStagedInjectionEnabled) {
429
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 128 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 128 times.
129 if (isStagedInjectionEnabled.has_value()) {
430 1 engineConfiguration->enableStagedInjection = isStagedInjectionEnabled.value();
431 } else {
432
2/6
✓ Branch 3 taken 128 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 128 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
128 ASSERT_EQ(
433 engineConfiguration->enableStagedInjection,
434 engine_configuration_defaults::ENABLE_STAGED_INJECTION
435
1/2
✓ Branch 1 taken 128 times.
✗ Branch 2 not taken.
128 ); // check default value
436 }
437 }
438
439 129 void TestEngineConfiguration::configureNitrousControlEnabled(const std::optional<bool> nitrousControlEnabled) {
440
2/2
✓ Branch 1 taken 38 times.
✓ Branch 2 taken 91 times.
2/2
✓ Decision 'true' taken 38 times.
✓ Decision 'false' taken 91 times.
129 if (nitrousControlEnabled.has_value()) {
441 38 engineConfiguration->nitrousControlEnabled = nitrousControlEnabled.value();
442 } else {
443
2/6
✓ Branch 3 taken 91 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 91 times.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
91 ASSERT_EQ(
444 engineConfiguration->nitrousControlEnabled,
445 engine_configuration_defaults::NITROUS_CONTROL_ENABLED
446
1/2
✓ Branch 1 taken 91 times.
✗ Branch 2 not taken.
91 ); // check default value
447 }
448 }
449
450 129 void TestEngineConfiguration::configureNitrousControlArmingMethod(
451 const std::optional<nitrous_arming_method_e> armingMethod
452 ) {
453
2/2
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 113 times.
2/2
✓ Decision 'true' taken 16 times.
✓ Decision 'false' taken 113 times.
129 if (armingMethod.has_value()) {
454 16 engineConfiguration->nitrousControlArmingMethod = armingMethod.value();
455 } else {
456
2/6
✓ Branch 2 taken 113 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 113 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
113 ASSERT_EQ(
457 engineConfiguration->nitrousControlArmingMethod,
458 engine_configuration_defaults::NITROUS_CONTROL_ARMING_METHOD
459
1/2
✓ Branch 1 taken 113 times.
✗ Branch 2 not taken.
113 ); // check default value
460 }
461 }
462
463 129 void TestEngineConfiguration::configureNitrousControlTriggerPin(const std::optional<switch_input_pin_e> triggerPin) {
464
2/2
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 113 times.
2/2
✓ Decision 'true' taken 16 times.
✓ Decision 'false' taken 113 times.
129 if (triggerPin.has_value()) {
465 16 engineConfiguration->nitrousControlTriggerPin = triggerPin.value();
466 } else {
467
2/6
✓ Branch 2 taken 113 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 113 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
113 ASSERT_EQ(
468 engineConfiguration->nitrousControlTriggerPin,
469 engine_configuration_defaults::NITROUS_CONTROL_TRIGGER_PIN
470
1/2
✓ Branch 1 taken 113 times.
✗ Branch 2 not taken.
113 ); // check default value
471 }
472 }
473 258 void TestEngineConfiguration::configureNitrousControlTriggerPinMode(const std::optional<pin_input_mode_e> pinMode) {
474
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 256 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 256 times.
258 if (pinMode.has_value()) {
475 2 engineConfiguration->nitrousControlTriggerPinMode = pinMode.value();
476 } else {
477
2/6
✓ Branch 2 taken 256 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 256 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
256 ASSERT_EQ(
478 engineConfiguration->nitrousControlTriggerPinMode,
479 engine_configuration_defaults::NITROUS_CONTROL_TRIGGER_PIN_MODE
480
1/2
✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
256 ); // check default value
481 }
482 }
483
484 129 void TestEngineConfiguration::configureNitrousLuaGauge(const std::optional<lua_gauge_e> luaGauge) {
485
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 124 times.
2/2
✓ Decision 'true' taken 5 times.
✓ Decision 'false' taken 124 times.
129 if (luaGauge.has_value()) {
486 5 engineConfiguration->nitrousLuaGauge = luaGauge.value();
487 } else {
488
2/6
✓ Branch 2 taken 124 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 124 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
124 ASSERT_EQ(
489 engineConfiguration->nitrousLuaGauge,
490 engine_configuration_defaults::NITROUS_LUA_GAUGE
491
1/2
✓ Branch 1 taken 124 times.
✗ Branch 2 not taken.
124 ); // check default value
492 }
493 }
494
495 129 void TestEngineConfiguration::configureNitrousLuaGaugeMeaning(const std::optional<lua_gauge_meaning_e> luaGaugeMeaning) {
496
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (luaGaugeMeaning.has_value()) {
497 2 engineConfiguration->nitrousLuaGaugeMeaning = luaGaugeMeaning.value();
498 } else {
499
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
500 engineConfiguration->nitrousLuaGaugeMeaning,
501 engine_configuration_defaults::NITROUS_LUA_GAUGE_MEANING
502
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
503 }
504 }
505
506 129 void TestEngineConfiguration::configureNitrousLuaGaugeArmingValue(const std::optional<float> luaGaugeArmingValue) {
507
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 124 times.
2/2
✓ Decision 'true' taken 5 times.
✓ Decision 'false' taken 124 times.
129 if (luaGaugeArmingValue.has_value()) {
508 5 engineConfiguration->nitrousLuaGaugeArmingValue = luaGaugeArmingValue.value();
509 } else {
510
2/6
✓ Branch 2 taken 124 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 124 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
124 ASSERT_EQ(
511 engineConfiguration->nitrousLuaGaugeArmingValue,
512 engine_configuration_defaults::NITROUS_LUA_GAUGE_ARMING_VALUE
513
1/2
✓ Branch 1 taken 124 times.
✗ Branch 2 not taken.
124 ); // check default value
514 }
515 }
516
517 129 void TestEngineConfiguration::configureNitrousMinimumVehicleSpeed(
518 const std::optional<uint16_t> nitrousMinimumVehicleSpeed
519 ) {
520
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 116 times.
2/2
✓ Decision 'true' taken 13 times.
✓ Decision 'false' taken 116 times.
129 if (nitrousMinimumVehicleSpeed.has_value()) {
521 13 engineConfiguration->nitrousMinimumVehicleSpeed = nitrousMinimumVehicleSpeed.value();
522 } else {
523
2/6
✓ Branch 2 taken 116 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
116 ASSERT_EQ(
524 engineConfiguration->nitrousMinimumVehicleSpeed,
525 engine_configuration_defaults::NITROUS_MINIMUM_VEHICLE_SPEED
526
1/2
✓ Branch 1 taken 116 times.
✗ Branch 2 not taken.
116 ); // check default value
527 }
528 }
529
530 129 void TestEngineConfiguration::configureNitrousMinimumTps(const std::optional<int> nitrousMinimumTps) {
531
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 116 times.
2/2
✓ Decision 'true' taken 13 times.
✓ Decision 'false' taken 116 times.
129 if (nitrousMinimumTps.has_value()) {
532 13 engineConfiguration->nitrousMinimumTps = nitrousMinimumTps.value();
533 } else {
534
2/6
✓ Branch 2 taken 116 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
116 ASSERT_EQ(
535 engineConfiguration->nitrousMinimumTps,
536 engine_configuration_defaults::NITROUS_MINIMUM_TPS
537
1/2
✓ Branch 1 taken 116 times.
✗ Branch 2 not taken.
116 ); // check default value
538 }
539 }
540
541 129 void TestEngineConfiguration::configureNitrousMinimumClt(const std::optional<uint8_t> nitrousMinimumClt) {
542
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 116 times.
2/2
✓ Decision 'true' taken 13 times.
✓ Decision 'false' taken 116 times.
129 if (nitrousMinimumClt.has_value()) {
543 13 engineConfiguration->nitrousMinimumClt = nitrousMinimumClt.value();
544 } else {
545
2/6
✓ Branch 2 taken 116 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
116 ASSERT_EQ(
546 engineConfiguration->nitrousMinimumClt,
547 engine_configuration_defaults::NITROUS_MINIMUM_CLT
548
1/2
✓ Branch 1 taken 116 times.
✗ Branch 2 not taken.
116 ); // check default value
549 }
550 }
551
552 129 void TestEngineConfiguration::configureNitrousMaximumMap(const std::optional<uint16_t> nitrousMaximumMap) {
553
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 116 times.
2/2
✓ Decision 'true' taken 13 times.
✓ Decision 'false' taken 116 times.
129 if (nitrousMaximumMap.has_value()) {
554 13 engineConfiguration->nitrousMaximumMap = nitrousMaximumMap.value();
555 } else {
556
2/6
✓ Branch 2 taken 116 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
116 ASSERT_EQ(
557 engineConfiguration->nitrousMaximumMap,
558 engine_configuration_defaults::NITROUS_MAXIMUM_MAP
559
1/2
✓ Branch 1 taken 116 times.
✗ Branch 2 not taken.
116 ); // check default value
560 }
561 }
562
563 129 void TestEngineConfiguration::configureNitrousMaximumAfr(const std::optional<float> nitrousMaximumAfr) {
564
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 116 times.
2/2
✓ Decision 'true' taken 13 times.
✓ Decision 'false' taken 116 times.
129 if (nitrousMaximumAfr.has_value()) {
565
1/1
✓ Branch 2 taken 13 times.
13 engineConfiguration->nitrousMaximumAfr = nitrousMaximumAfr.value();
566 } else {
567
2/6
✓ Branch 2 taken 116 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
116 ASSERT_EQ(
568 engineConfiguration->nitrousMaximumAfr,
569 engine_configuration_defaults::NITROUS_MAXIMUM_AFR
570
1/2
✓ Branch 1 taken 116 times.
✗ Branch 2 not taken.
116 ); // check default value
571 }
572 }
573
574 129 void TestEngineConfiguration::configureNitrousActivationRpm(const std::optional<uint16_t> nitrousActivationRpm) {
575
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 117 times.
2/2
✓ Decision 'true' taken 12 times.
✓ Decision 'false' taken 117 times.
129 if (nitrousActivationRpm.has_value()) {
576 12 engineConfiguration->nitrousActivationRpm = nitrousActivationRpm.value();
577 } else {
578
2/6
✓ Branch 2 taken 117 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 117 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
117 ASSERT_EQ(
579 engineConfiguration->nitrousActivationRpm,
580 engine_configuration_defaults::NITROUS_ACTIVATION_RPM
581
1/2
✓ Branch 1 taken 117 times.
✗ Branch 2 not taken.
117 ); // check default value
582 }
583 }
584
585 129 void TestEngineConfiguration::configureNitrousDeactivationRpm(const std::optional<uint16_t> nitrousDeactivationRpm) {
586
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 117 times.
2/2
✓ Decision 'true' taken 12 times.
✓ Decision 'false' taken 117 times.
129 if (nitrousDeactivationRpm.has_value()) {
587 12 engineConfiguration->nitrousDeactivationRpm = nitrousDeactivationRpm.value();
588 } else {
589
2/6
✓ Branch 2 taken 117 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 117 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
117 ASSERT_EQ(
590 engineConfiguration->nitrousDeactivationRpm,
591 engine_configuration_defaults::NITROUS_DEACTIVATION_RPM
592
1/2
✓ Branch 1 taken 117 times.
✗ Branch 2 not taken.
117 ); // check default value
593 }
594 }
595
596 129 void TestEngineConfiguration::configureNitrousDeactivationRpmWindow(
597 const std::optional<uint16_t> nitrousDeactivationRpmWindow
598 ) {
599
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 117 times.
2/2
✓ Decision 'true' taken 12 times.
✓ Decision 'false' taken 117 times.
129 if (nitrousDeactivationRpmWindow.has_value()) {
600 12 engineConfiguration->nitrousDeactivationRpmWindow = nitrousDeactivationRpmWindow.value();
601 } else {
602
2/6
✓ Branch 2 taken 117 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 117 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
117 ASSERT_EQ(
603 engineConfiguration->nitrousDeactivationRpmWindow,
604 engine_configuration_defaults::NITROUS_DEACTIVATION_RPM_WINDOW
605
1/2
✓ Branch 1 taken 117 times.
✗ Branch 2 not taken.
117 ); // check default value
606 }
607 }
608
609 129 void TestEngineConfiguration::configureNitrousFuelAdderPercent(const std::optional<int8_t> nitrousFuelAdderPercent) {
610
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 128 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 128 times.
129 if (nitrousFuelAdderPercent.has_value()) {
611 1 engineConfiguration->nitrousFuelAdderPercent = nitrousFuelAdderPercent.value();
612 } else {
613
2/6
✓ Branch 2 taken 128 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 128 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
128 ASSERT_EQ(
614 engineConfiguration->nitrousFuelAdderPercent,
615 engine_configuration_defaults::NITROUS_FUEL_ADDER_PERCENT
616
1/2
✓ Branch 1 taken 128 times.
✗ Branch 2 not taken.
128 ); // check default value
617 }
618 }
619
620 129 void TestEngineConfiguration::configureNitrousIgnitionRetard(const std::optional<float> nitrousIgnitionRetard) {
621
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (nitrousIgnitionRetard.has_value()) {
622 2 engineConfiguration->nitrousIgnitionRetard = nitrousIgnitionRetard.value();
623 } else {
624
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
625 engineConfiguration->nitrousIgnitionRetard,
626 engine_configuration_defaults::NITROUS_IGNITION_RETARD
627
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
628 }
629 }
630
631 129 void TestEngineConfiguration::configureFuelLevelAveragingAlpha(const std::optional<float> alpha) {
632
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (alpha.has_value()) {
633 2 engineConfiguration->fuelLevelAveragingAlpha = alpha.value();
634 } else {
635
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
636 engineConfiguration->fuelLevelAveragingAlpha,
637 engine_configuration_defaults::FUEL_LEVEL_AVERAGING_ALPHA
638
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
639 }
640 }
641
642 129 void TestEngineConfiguration::configureFuelLevelUpdatePeriodSec(const std::optional<float> seconds) {
643
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (seconds.has_value()) {
644 2 engineConfiguration->fuelLevelUpdatePeriodSec = seconds.value();
645 } else {
646
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
647 engineConfiguration->fuelLevelUpdatePeriodSec,
648 engine_configuration_defaults::FUEL_LEVEL_UPDATE_PERIOD_SEC
649
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
650 }
651 }
652
653 129 void TestEngineConfiguration::configureFuelLevelLowThresholdVoltage(const std::optional<float> thresholdVoltage) {
654
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (thresholdVoltage.has_value()) {
655 2 engineConfiguration->fuelLevelLowThresholdVoltage = thresholdVoltage.value();
656 } else {
657
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
658 engineConfiguration->fuelLevelLowThresholdVoltage,
659 engine_configuration_defaults::FUEL_LEVEL_LOW_THRESHOLD_VOLTAGE
660
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
661 }
662 }
663
664 129 void TestEngineConfiguration::configureFuelLevelHighThresholdVoltage(const std::optional<float> thresholdVoltage) {
665
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 127 times.
2/2
✓ Decision 'true' taken 2 times.
✓ Decision 'false' taken 127 times.
129 if (thresholdVoltage.has_value()) {
666 2 engineConfiguration->fuelLevelHighThresholdVoltage = thresholdVoltage.value();
667 } else {
668
2/6
✓ Branch 2 taken 127 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
127 ASSERT_EQ(
669 engineConfiguration->fuelLevelHighThresholdVoltage,
670 engine_configuration_defaults::FUEL_LEVEL_HIGH_THRESHOLD_VOLTAGE
671
1/2
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
127 ); // check default value
672 }
673 }
674
675 1 TestEngineConfiguration::TestEngineConfiguration() {
676 1 }
677
678 TestEngineConfiguration TestEngineConfiguration::instance;
679