only:reusing existing API

This commit is contained in:
rusefillc 2024-12-23 20:42:26 -05:00
parent b99e025e3c
commit 2ececd0f84
5 changed files with 12 additions and 19 deletions

View File

@ -16,12 +16,11 @@ TEST(real4b11, running) {
eth.setTriggerType(trigger_type_e::TT_36_2_1);
int eventCount = 0;
bool gotRpm = false;
while (reader.haveMore()) {
reader.processLine(&eth);
eventCount++;
engine->rpmCalculator.onSlowCallback();
// Expect that all teeth are in the correct spot
@ -33,7 +32,7 @@ TEST(real4b11, running) {
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, 30);
EXPECT_EQ(reader.lineIndex(), 30);
EXPECT_NEAR(rpm, 1436.23f, 0.1);
}
}
@ -52,12 +51,12 @@ TEST(real4b11, runningDoubledEdge) {
eth.setTriggerType(trigger_type_e::TT_36_2_1);
int eventCount = 0;
bool gotRpm = false;
while (reader.haveMore()) {
reader.processLine(&eth);
eventCount++;
engine->rpmCalculator.onSlowCallback();
auto rpm = Sensor::getOrZero(SensorType::Rpm);
@ -65,7 +64,7 @@ TEST(real4b11, runningDoubledEdge) {
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, 30);
EXPECT_EQ(reader.lineIndex(), 30);
EXPECT_NEAR(rpm, 1436.23f, 0.1);
}
}

View File

@ -1,3 +1,4 @@
// file test_real_4b11.cpp
// Mitsubishi 4G93 trigger pattern
// Crank: 2 teeth per rev (4 teeth per cycle)
// Cam: 4G92/93/94 pattern (big tooth - small tooth)

View File

@ -9,18 +9,16 @@ TEST(realBQS, readAsPrimarySensor) {
EngineTestHelper eth(engine_type_e::ET_BOSCH_QUICK_START);
int eventCount = 0;
bool gotRpm = false;
while (reader.haveMore()) {
reader.processLine(&eth);
eventCount++;
engine->rpmCalculator.onSlowCallback();
auto rpm = Sensor::getOrZero(SensorType::Rpm);
if (!gotRpm && rpm) {
gotRpm = true;
EXPECT_EQ(eventCount, 13);
EXPECT_EQ(reader.lineIndex(), 13);
EXPECT_NEAR(rpm, 2035.53466f, 0.1);
break;
}
@ -40,7 +38,6 @@ TEST(realBQS, readAsCam) {
hwHandleShaftSignal(0, false, 3000000);
eth.assertRpm(3000);
int eventCount = 0;
CsvReader reader(/*triggerCount*/0, /* vvtCount */ 1);
reader.open("tests/trigger/resources/BQS-longer.csv");
reader.flipVvtOnRead = true;
@ -52,11 +49,10 @@ TEST(realBQS, readAsCam) {
bool gotVvt = false;
while (reader.haveMore()) {
reader.processLine(&eth);
eventCount++;
if (!gotVvt && vvtDecoder.getShaftSynchronized()) {
gotVvt = true;
EXPECT_EQ(eventCount, 13);
EXPECT_EQ(reader.lineIndex(), 13);
}
}
ASSERT_DOUBLE_EQ(-247.03125, tc->getVVTPosition(0, 0));

View File

@ -22,13 +22,12 @@ TEST(realCas24Plus1, spinningOnBench) {
engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
eth.setTriggerType(trigger_type_e::TT_12_TOOTH_CRANK);
int eventCount = 0;
bool gotRpm = false;
bool gotFullSync = false;
while (reader.haveMore()) {
reader.processLine(&eth);
eventCount++;
engine->rpmCalculator.onSlowCallback();
// Expect that all teeth are in the correct spot
@ -40,7 +39,7 @@ TEST(realCas24Plus1, spinningOnBench) {
gotRpm = true;
// We should get first RPM on exactly the first (primary) sync point - this means the instant RPM pre-sync event copy all worked OK
EXPECT_EQ(eventCount, 7);
EXPECT_EQ(reader.lineIndex(), 7);
EXPECT_NEAR(rpm, 808.32f, 0.1);
}
@ -49,7 +48,7 @@ TEST(realCas24Plus1, spinningOnBench) {
gotFullSync = true;
// Should get full sync on the first cam tooth
EXPECT_EQ(eventCount, 40);
EXPECT_EQ(reader.lineIndex(), 40);
EXPECT_NEAR(rpm, 915.08f, 0.1);
}

View File

@ -12,12 +12,10 @@ TEST(crankingGm24x_5, gmRealCrankingFromFile) {
eth.setTriggerType(trigger_type_e::TT_GM_24x_5);
int eventCount = 0;
bool gotRpm = false;
while (reader.haveMore()) {
reader.processLine(&eth);
eventCount++;
engine->rpmCalculator.onSlowCallback();
@ -30,7 +28,7 @@ TEST(crankingGm24x_5, gmRealCrankingFromFile) {
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_EQ(reader.lineIndex(), 23);
EXPECT_NEAR(rpm, 77.0f, 0.1);
}
}