2021-06-26 21:51:14 -07:00
|
|
|
/*
|
|
|
|
* @file test_rpm_multiplier.cpp
|
|
|
|
*
|
|
|
|
* Four different cases of operation_mode_e and getRpmMultiplier
|
|
|
|
*
|
|
|
|
* @date Jun 26, 2021
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2021
|
|
|
|
*/
|
|
|
|
|
2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
2021-06-26 21:51:14 -07:00
|
|
|
|
|
|
|
static void runRpmTest(operation_mode_e mode, int expected) {
|
|
|
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
|
|
|
engineConfiguration->ambiguousOperationMode = mode;
|
2021-11-16 01:15:29 -08:00
|
|
|
eth.setTriggerType(TT_ONE);
|
2021-06-26 21:51:14 -07:00
|
|
|
|
|
|
|
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) {
|
2021-07-05 19:50:44 -07:00
|
|
|
runRpmTest(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR, 250);
|
2021-06-26 21:51:14 -07:00
|
|
|
}
|