always harley

This commit is contained in:
rusefillc 2024-12-29 15:15:40 -05:00
parent da8f5144c3
commit a6f46fe0a0
2 changed files with 53 additions and 12 deletions

View File

@ -29,6 +29,7 @@ void createUnitTestLog() {
// fun fact: ASAN says not to extracjsonTracet 'fileName' into a variable, we must be doing something a bit not right?
mslFile = fopen(filePath.str().c_str(), "wb");
if (mslFile != nullptr) {
printf("Writing [%s]\n", filePath.str().c_str());
resetFileLogging();
writeSdLogLine(unitTestLogWriter);
}

View File

@ -3,30 +3,70 @@
#include "pch.h"
#include "engine_csv_reader.h"
TEST(harley, hdCrankingWithCam) {
EngineCsvReader reader(1, /* vvtCount */ 1);
reader.open("tests/ignition_injection/resources/hd-req-sync_3.csv");
class HdCranking {
public:
HdCranking(const char *fileName) :
reader(1, /* vvtCount */1), eth(engine_type_e::HARLEY) {
engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START;
eth.applyTriggerWaveform();
reader.open(fileName);
}
EngineTestHelper eth(engine_type_e::HARLEY);
engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START;
eth.applyTriggerWaveform();
EngineCsvReader reader;
EngineTestHelper eth;
};
static void runTest(const char *fileName) {
HdCranking test(fileName);
EngineCsvReader &reader = test.reader;
while (reader.haveMore()) {
reader.processLine(&eth);
reader.processLine(&test.eth);
}
}
reader.assertFirstRpm(184, 60);
auto rpm = Sensor::getOrZero(SensorType::Rpm);
TEST(harley, hdCrankingWithCam1) {
runTest("tests/ignition_injection/resources/hd-req-sync_1.csv");
}
TEST(harley, hdCrankingWithCam3) {
HdCranking test("tests/ignition_injection/resources/hd-req-sync_3.csv");
EngineCsvReader &reader = test.reader;
while (reader.haveMore()) {
reader.processLine(&test.eth);
reader.assertFirstRpm(184, 60);
auto rpm = Sensor::getOrZero(SensorType::Rpm);
if (!reader.gotSync && engine->triggerCentral.triggerState.hasSynchronizedPhase()) {
EXPECT_EQ(reader.lineIndex(), 269);
reader.gotSync = true;
EXPECT_EQ(reader.lineIndex(), 269);
reader.gotSync = true;
}
if (reader.gotSync) {
// we have loss of sync, interesting!
// we have loss of sync, interesting!
// EXPECT_TRUE(engine->triggerCentral.triggerState.hasSynchronizedPhase()) << "Loss " << reader.lineIndex();
}
}
ASSERT_EQ(2, engine->triggerCentral.triggerState.camResyncCounter); // interesting!
}
TEST(harley, hdCrankingWithCam4) {
runTest("tests/ignition_injection/resources/hd-req-sync_4.csv");
}
TEST(harley, hdCrankingWithCamAnother) {
runTest("tests/ignition_injection/resources/hd-req-sync-another-one_1.csv");
}
TEST(harley, hdCrankingWithCamAnother2) {
runTest("tests/ignition_injection/resources/hd-req-sync-another-one_2.csv");
}
TEST(harley, hdCrankingWithCamAnother3) {
runTest("tests/ignition_injection/resources/hd-req-sync-another-one_3.csv");
}