diff --git a/unit_tests/tests/tests.mk b/unit_tests/tests/tests.mk index a869c13903..cb32a93306 100644 --- a/unit_tests/tests/tests.mk +++ b/unit_tests/tests/tests.mk @@ -9,6 +9,7 @@ TESTS_SRC_CPP = \ tests/trigger/test_real_cranking_miata_NA.cpp \ tests/trigger/test_real_cranking_miata_na6.cpp \ tests/trigger/test_real_volkswagen.cpp \ + tests/trigger/test_rpm_multiplier.cpp \ tests/trigger/test_quad_cam.cpp \ tests/trigger/test_override_gaps.cpp \ tests/trigger/test_injection_scheduling.cpp \ diff --git a/unit_tests/tests/trigger/test_rpm_multiplier.cpp b/unit_tests/tests/trigger/test_rpm_multiplier.cpp new file mode 100644 index 0000000000..817a030625 --- /dev/null +++ b/unit_tests/tests/trigger/test_rpm_multiplier.cpp @@ -0,0 +1,41 @@ +/* + * @file test_rpm_multiplier.cpp + * + * Four different cases of operation_mode_e and getRpmMultiplier + * + * @date Jun 26, 2021 + * @author Andrey Belomutskiy, (c) 2012-2021 + */ + +#include "engine_test_helper.h" + +static void runRpmTest(operation_mode_e mode, int expected) { + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); + engineConfiguration->ambiguousOperationMode = mode; + eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX); + + eth.smartFireTriggerEvents2(/*count*/200, /*delay*/ 40); + ASSERT_EQ(expected, GET_RPM()); +} + +// todo: google test profiles one day? + +TEST(engine, testRpmOfCamSensor) { + runRpmTest(FOUR_STROKE_CAM_SENSOR, 1500); +} + +TEST(engine, testRpmOfSymmetricalCrank) { + runRpmTest(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR, 375); +} + +TEST(engine, testRpmOfTwoStroke) { + runRpmTest(TWO_STROKE, 750); +} + +TEST(engine, testRpmOfCrankOnly) { + runRpmTest(FOUR_STROKE_CRANK_SENSOR, 750); +} + +TEST(engine, testRpmOfThreeTimesCrank) { + runRpmTest(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR, 375); +}