@@ -23,7 +23,8 @@ namespace {
23
23
24
24
void SetUp () override ;
25
25
26
- void satisfyAllConditions ();
26
+ void checkNitrousCondition (bool expected, const char * context);
27
+
27
28
private:
28
29
void armNitrousControl ();
29
30
void satisfyTpsCondition ();
@@ -49,18 +50,38 @@ namespace {
49
50
.setNitrousDeactivationRpmWindow ({ TEST_DEACTIVATION_RPM_WINDOW })
50
51
);
51
52
52
- satisfyAllConditions ();
53
- }
54
53
55
- void NitrousConditionTest::satisfyAllConditions () {
54
+ EXPECT_FALSE (getModule<NitrousController>().isArmed );
55
+ EXPECT_FALSE (getModule<NitrousController>().isTpsConditionSatisfied );
56
+ EXPECT_FALSE (getModule<NitrousController>().isCltConditionSatisfied );
57
+ EXPECT_FALSE (getModule<NitrousController>().isMapConditionSatisfied );
58
+ EXPECT_FALSE (getModule<NitrousController>().isAfrConditionSatisfied );
59
+ EXPECT_FALSE (getModule<NitrousController>().isNitrousRpmConditionSatisfied );
60
+
61
+ checkNitrousCondition (false , " No conditions are satisfied" );
62
+
56
63
armNitrousControl ();
64
+ checkNitrousCondition (false , " Armed condition is satisfied" );
65
+
57
66
satisfyTpsCondition ();
67
+ checkNitrousCondition (false , " Armed + TPS conditions are satisfied" );
68
+
58
69
satisfyCltCondition ();
70
+ checkNitrousCondition (false , " Armed + TPS + CLT conditions are satisfied" );
71
+
59
72
satisfyMapCondition ();
73
+ checkNitrousCondition (false , " Armed + TPS + CLT + MAP conditions are satisfied" );
74
+
60
75
satisfyAfrCondition ();
76
+ checkNitrousCondition (false , " Armed + TPS + CLT + MAP + AFR conditions are satisfied" );
77
+
61
78
satisfyRpmCondition ();
79
+ checkNitrousCondition (true , " Armed + TPS + CLT + MAP + AFR + RPM conditions are satisfied" );
80
+ }
62
81
63
- EXPECT_TRUE (getModule<NitrousController>().isNitrousRpmConditionSatisfied );
82
+ void NitrousConditionTest::checkNitrousCondition (const bool expected, const char * const context) {
83
+ EXPECT_EQ (getModule<NitrousController>().isNitrousConditionSatisfied , expected) << context;
84
+ EXPECT_EQ (enginePins.nitrousRelay .getLogicValue (), expected) << context;
64
85
}
65
86
66
87
void NitrousConditionTest::armNitrousControl () {
@@ -105,41 +126,41 @@ namespace {
105
126
periodicSlowCallback ();
106
127
107
128
EXPECT_FALSE (getModule<NitrousController>().isArmed );
108
- EXPECT_FALSE (getModule<NitrousController>(). isNitrousConditionSatisfied );
129
+ checkNitrousCondition ( false , " Without armed condition " );
109
130
}
110
131
111
132
TEST_F (NitrousConditionTest, checkWithoutSatisfiedTpsCondition) {
112
133
updateApp (TEST_MIN_TPS - EPS5D, &TestBase::periodicSlowCallback);
113
134
114
135
EXPECT_FALSE (getModule<NitrousController>().isTpsConditionSatisfied );
115
- EXPECT_FALSE (getModule<NitrousController>(). isNitrousConditionSatisfied );
136
+ checkNitrousCondition ( false , " Without TPS condition " );
116
137
}
117
138
118
139
TEST_F (NitrousConditionTest, checkWithoutSatisfiedCltCondition) {
119
140
updateClt (TEST_MIN_CLT - EPS5D, &TestBase::periodicSlowCallback);
120
141
121
142
EXPECT_FALSE (getModule<NitrousController>().isCltConditionSatisfied );
122
- EXPECT_FALSE (getModule<NitrousController>(). isNitrousConditionSatisfied );
143
+ checkNitrousCondition ( false , " Without CLT condition " );
123
144
}
124
145
125
146
TEST_F (NitrousConditionTest, checkWithoutSatisfiedMapCondition) {
126
147
updateMap (TEST_MAX_MAP + EPS5D, &TestBase::periodicSlowCallback);
127
148
128
149
EXPECT_FALSE (getModule<NitrousController>().isMapConditionSatisfied );
129
- EXPECT_FALSE (getModule<NitrousController>(). isNitrousConditionSatisfied );
150
+ checkNitrousCondition ( false , " Without MAP condition " );
130
151
}
131
152
132
153
TEST_F (NitrousConditionTest, checkWithoutSatisfiedAfrCondition) {
133
154
updateLambda1 (TEST_LAMBDA1 + EPS5D, &TestBase::periodicSlowCallback);
134
155
135
156
EXPECT_FALSE (getModule<NitrousController>().isAfrConditionSatisfied );
136
- EXPECT_FALSE (getModule<NitrousController>(). isNitrousConditionSatisfied );
157
+ checkNitrousCondition ( false , " Without AFR condition " );
137
158
}
138
159
139
160
TEST_F (NitrousConditionTest, checkWithoutSatisfiedRpmCondition) {
140
161
updateRpm (TEST_ACTIVATION_RPM - EPS5D, &TestBase::periodicSlowCallback);
141
162
142
163
EXPECT_FALSE (getModule<NitrousController>().isNitrousRpmConditionSatisfied );
143
- EXPECT_FALSE (getModule<NitrousController>(). isNitrousConditionSatisfied );
164
+ checkNitrousCondition ( false , " Without RPM condition " );
144
165
}
145
166
}
0 commit comments