forked from rusefi/rusefi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_nitrous_ignition_retard.cpp
More file actions
64 lines (50 loc) · 2.32 KB
/
Copy pathtest_nitrous_ignition_retard.cpp
File metadata and controls
64 lines (50 loc) · 2.32 KB
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
//
// Created by kifir on 12/6/24.
//
#include "pch.h"
#include "nitrous_test_base.h"
namespace {
class NitrousIgnitionRetardTest : public NitrousTestBase {
protected:
static constexpr float EXPECTED_BASE_IGNITION_ADVANCE = 10.5f;
static constexpr float TEST_NITROUS_IGNITION_RETARD = 1.78f;
void checkBaseIgnitionAdvance(float expectedBaseIgnitionAdvance, const char* context);
};
void NitrousIgnitionRetardTest::checkBaseIgnitionAdvance(
const float expectedBaseIgnitionAdvance,
const char* const context
) {
periodicFastCallback();
EXPECT_NEAR(expectedBaseIgnitionAdvance, engine->ignitionState.baseIgnitionAdvance, EPS5D) << context;
}
TEST_F(NitrousIgnitionRetardTest, checkDefaultIgnitionRetardCorrection) {
setUpTestConfiguration();
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "Default");
activateNitrousControl();
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "All conditions are satisfied");
deactivateNitrousControl();
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "No conditions are satisfied");
}
TEST_F(NitrousIgnitionRetardTest, checkZeroIgnitionRetardCorrection) {
setUpTestConfiguration(/* nitrousFuelAdderPercent = */ {}, /* nitrousIgnitionRetard = */ { 0.0f });
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "Default");
activateNitrousControl();
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "All conditions are satisfied");
deactivateNitrousControl();
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "No conditions are satisfied");
}
TEST_F(NitrousIgnitionRetardTest, checkIgnitionRetardCorrection) {
setUpTestConfiguration(
/* nitrousFuelAdderPercent = */ {},
/* nitrousIgnitionRetard = */ { TEST_NITROUS_IGNITION_RETARD }
);
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "Default");
activateNitrousControl();
checkBaseIgnitionAdvance(
EXPECTED_BASE_IGNITION_ADVANCE - TEST_NITROUS_IGNITION_RETARD,
"All conditions are satisfied"
);
deactivateNitrousControl();
checkBaseIgnitionAdvance(EXPECTED_BASE_IGNITION_ADVANCE, "No conditions are satisfied");
}
}