refactoring unit test
This commit is contained in:
parent
0a28bb20dc
commit
4e61505620
|
@ -676,7 +676,7 @@ bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool readIfTriggerConfigChangedForUnitTest(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
bool isTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
return engine->isTriggerConfigChanged;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,6 @@ void resetMaxValues();
|
|||
|
||||
void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool readIfTriggerConfigChangedForUnitTest(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool isTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
#endif /* TRIGGER_CENTRAL_H_ */
|
||||
|
|
|
@ -214,13 +214,17 @@ void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e inject
|
|||
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT";
|
||||
ASSERT_EQ( 0, readIfTriggerConfigChangedForUnitTest(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #1";
|
||||
|
||||
|
||||
ASSERT_EQ( 0, isTriggerConfigChanged(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #1";
|
||||
eth->setTriggerType(trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
void EngineTestHelper::setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
engineConfiguration->trigger.type = trigger;
|
||||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
ASSERT_EQ( 1, readIfTriggerConfigChangedForUnitTest(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #2";
|
||||
|
||||
eth->applyTriggerShape();
|
||||
ASSERT_EQ( 1, isTriggerConfigChanged(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #2";
|
||||
applyTriggerShape();
|
||||
}
|
||||
|
||||
void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, injection_mode_e injectionMode) {
|
||||
|
|
|
@ -28,6 +28,7 @@ class EngineTestHelper : public EngineTestHelperBase {
|
|||
public:
|
||||
EngineTestHelper(engine_type_e engineType);
|
||||
void applyTriggerShape();
|
||||
void setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void fireRise(int delayMs);
|
||||
void fireFall(int delayMs);
|
||||
|
||||
|
|
|
@ -1108,10 +1108,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
|
||||
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT";
|
||||
|
||||
engineConfiguration->trigger.type = TT_ONE;
|
||||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
eth.applyTriggerShape();
|
||||
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
setWholeTimingTable(0);
|
||||
|
|
|
@ -175,9 +175,7 @@ TEST(big, testNoiselessDecoder) {
|
|||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
|
||||
// we'll test on 60-2 wheel
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
||||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
eth.applyTriggerShape();
|
||||
eth.setTriggerType(TT_TOOTHED_WHEEL_60_2 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
ASSERT_EQ(0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testNoiselessDecoder RPM";
|
||||
|
|
Loading…
Reference in New Issue