engine sniffer into unit tests

This commit is contained in:
rusefillc 2021-04-04 22:48:48 -04:00
parent 41804736e2
commit f877d32be4
3 changed files with 10 additions and 0 deletions

View File

@ -115,6 +115,10 @@ bool WaveChart::isFull() const {
return counter >= CONFIG(engineChartSize);
}
int WaveChart::getSize() {
return counter;
}
#if ! EFI_UNIT_TEST
static void printStatus(void) {
scheduleMsg(&logger, "engine chart: %s", boolToString(engineConfiguration->isEngineChartEnabled));

View File

@ -31,6 +31,7 @@ public:
bool isStartedTooLongAgo() const;
// looks like this is only used by functional tests on real hardware
efitick_t pauseEngineSnifferUntilNt = 0;
int getSize();
private:
Logging logging;

View File

@ -8,6 +8,9 @@
#include "engine_test_helper.h"
extern WarningCodeState unitTestWarningCodeState;
#include "engine_sniffer.h"
extern WaveChart waveChart;
TEST(trigger, testNoStartUpWarningsNoSyncronizationTrigger) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
// one tooth does not need synchronization it just counts tooth
@ -163,4 +166,6 @@ TEST(sensors, testNB2CamInput) {
ASSERT_NEAR(-67.6 - 720 - 720, engine->triggerCentral.getVVTPosition(0, 0), EPS3D);
// actually position based on VVT!
ASSERT_EQ(totalRevolutionCountBeforeVvtSync + 2, engine->triggerCentral.triggerState.getTotalRevolutionCounter());
ASSERT_EQ(28, waveChart.getSize());
}