Trigger: warning code on normal engine start up #669

better TDC unit test approach?
This commit is contained in:
Andrey 2021-06-25 13:02:37 -04:00
parent d4de3a6ebc
commit 2013a496ef
2 changed files with 32 additions and 0 deletions

View File

@ -3,6 +3,7 @@ TESTS_SRC_CPP = \
tests/trigger/test_trigger_decoder.cpp \
tests/trigger/test_trigger_noiseless.cpp \
tests/trigger/test_trigger_multi_sync.cpp \
tests/trigger/test_miata_na_tdc.cpp \
tests/trigger/test_cam_vvt_input.cpp \
tests/trigger/test_2jz_vvt.cpp \
tests/trigger/test_real_cranking_miata_NA.cpp \

View File

@ -0,0 +1,31 @@
#include "engine_test_helper.h"
#include "globalaccess.h"
#include "trigger_simulator.h"
#include "trigger_emulator_algo.h"
TEST(miata, miata_na_tdc) {
WITH_ENGINE_TEST_HELPER(MIATA_NA6_MAP);
#define TEST_REVOLUTIONS 6
TriggerWaveform & shape = engine->triggerCentral.triggerShape;
TriggerEmulatorHelper emulatorHelper;
/**
* let's feed two more cycles to validate shape definition
*/
for (uint32_t i = 0; i <= TEST_REVOLUTIONS * shape.getSize(); i++) {
int time = getSimulatedEventTime(shape, i);
eth.setTimeAndInvokeEventsUs(time);
emulatorHelper.handleEmulatorCallback(shape.getSize(),
shape.wave,
i % shape.getSize() PASS_ENGINE_PARAMETER_SUFFIX);
}
ASSERT_EQ(167, GET_RPM()) << "miata_na_tdc RPM";
ASSERT_EQ(3894000, engine->tdcScheduler[0].momentX); // let's assert TDC position and sync point
ASSERT_EQ(4614000, engine->tdcScheduler[1].momentX); // let's assert TDC position and sync point
}