refactoring around GET_RPM

This commit is contained in:
rusefi 2019-01-21 22:32:30 -05:00
parent 53b5c08c0a
commit d15399bba4
3 changed files with 8 additions and 7 deletions

View File

@ -176,13 +176,14 @@ void EngineTestHelper::applyTriggerShape() {
Engine *engine = &this->engine;
EXPAND_Engine
ENGINE(initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX));
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
}
void assertRpm(const char *msg, int expectedRpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
void EngineTestHelper::assertRpm(int expectedRpm, const char *msg) {
Engine *engine = &this->engine;
EXPAND_Engine
EXPECT_EQ(expectedRpm, GET_RPM()) << msg;
}

View File

@ -48,6 +48,7 @@ public:
void assertEvent(TestExecutor *executor, const char *msg, int index, void *callback, efitime_t start, efitime_t momentX, long param);
void assertInjectorUpEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex);
void assertInjectorDownEvent(const char *msg, int eventIndex, efitime_t momentX, long injectorIndex);
void assertRpm(int expectedRpm, const char *msg);
int executeActions();
void moveTimeForwardUs(int deltaTimeUs);
@ -57,7 +58,6 @@ public:
persistent_config_s persistentConfig;
};
void assertRpm(const char *msg, int expectedRpm DECLARE_ENGINE_PARAMETER_SUFFIX);
void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, injection_mode_e injMode = IM_BATCH);
void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e injectionMode,

View File

@ -172,7 +172,7 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
eth.fireTriggerEvents(48);
assertRpm("rpm", 2000 PASS_ENGINE_PARAMETER_SUFFIX);
eth.assertRpm(2000, "rpm");
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
eth.fireTriggerEvents(48);
@ -575,14 +575,14 @@ static void setTestBug299(EngineTestHelper *eth) {
EXPAND_Engine
assertRpm("RPM=0", 0 PASS_ENGINE_PARAMETER_SUFFIX);
eth->assertRpm(0, "RPM=0");
ASSERT_EQ( 0, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE)) << "setTestBug299 EL";
ASSERT_NEAR( 30, engine->sensors.iat, EPS4D) << "setTestBug299 IAT";
eth->fireTriggerEventsWithDuration(20);
// still no RPM since need to cycles measure cycle duration
assertRpm("setTestBug299: RPM#1", 0 PASS_ENGINE_PARAMETER_SUFFIX);
eth->assertRpm(0, "setTestBug299: RPM#1");
eth->fireTriggerEventsWithDuration(20);
assertRpm("setTestBug299: RPM#2", 3000 PASS_ENGINE_PARAMETER_SUFFIX);
eth->assertRpm(3000, "setTestBug299: RPM#2");
eth->clearQueue();