2021-11-20 03:59:02 -08:00
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
#include "logicdata_csv_reader.h"
|
|
|
|
|
|
|
|
TEST(crankingGm24x, gmRealCrankingFromFile) {
|
|
|
|
CsvReader reader(1, /* vvtCount */ 0);
|
|
|
|
|
2022-09-24 19:51:12 -07:00
|
|
|
reader.open("tests/trigger/resources/gm_24x_cranking.csv");
|
2021-11-20 03:59:02 -08:00
|
|
|
EngineTestHelper eth(TEST_ENGINE);
|
|
|
|
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
2022-08-19 12:03:20 -07:00
|
|
|
engineConfiguration->alwaysInstantRpm = true;
|
2021-11-20 03:59:02 -08:00
|
|
|
|
2022-05-06 05:25:44 -07:00
|
|
|
eth.setTriggerType(TT_GM_24x);
|
2021-11-20 03:59:02 -08:00
|
|
|
|
2022-09-29 04:15:59 -07:00
|
|
|
int eventCount = 0;
|
|
|
|
bool gotRpm = false;
|
|
|
|
|
2021-11-20 03:59:02 -08:00
|
|
|
while (reader.haveMore()) {
|
|
|
|
reader.processLine(ð);
|
2022-09-29 04:15:59 -07:00
|
|
|
eventCount++;
|
2021-11-20 03:59:02 -08:00
|
|
|
|
|
|
|
engine->rpmCalculator.onSlowCallback();
|
2022-09-29 04:15:59 -07:00
|
|
|
|
|
|
|
auto rpm = Sensor::getOrZero(SensorType::Rpm);
|
|
|
|
if (!gotRpm && rpm) {
|
|
|
|
gotRpm = true;
|
|
|
|
|
|
|
|
// We should get first RPM on exactly the first sync point - this means the instant RPM pre-sync event copy all worked OK
|
|
|
|
EXPECT_EQ(eventCount, 23);
|
|
|
|
EXPECT_NEAR(rpm, 77.0f, 0.1);
|
|
|
|
}
|
2021-11-20 03:59:02 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT_EQ( 0, eth.recentWarnings()->getCount())<< "warningCounter#vwRealCranking";
|
2022-08-19 12:03:20 -07:00
|
|
|
ASSERT_EQ( 139, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
2022-05-06 05:25:44 -07:00
|
|
|
}
|