"rpmAcceleration" in TS doesn't go lower than 0 #5504
only: rpmAcceleration unit test
This commit is contained in:
parent
9f4647a99f
commit
e9e0ef5a89
|
@ -24,6 +24,7 @@ TESTS_SRC_CPP = \
|
||||||
tests/trigger/test_real_k20.cpp \
|
tests/trigger/test_real_k20.cpp \
|
||||||
tests/trigger/test_map_cam.cpp \
|
tests/trigger/test_map_cam.cpp \
|
||||||
tests/trigger/test_rpm_multiplier.cpp \
|
tests/trigger/test_rpm_multiplier.cpp \
|
||||||
|
tests/trigger/test_rpm_acceleration.cpp \
|
||||||
tests/trigger/test_quad_cam.cpp \
|
tests/trigger/test_quad_cam.cpp \
|
||||||
tests/trigger/test_nissan_vq_vvt.cpp \
|
tests/trigger/test_nissan_vq_vvt.cpp \
|
||||||
tests/trigger/test_override_gaps.cpp \
|
tests/trigger/test_override_gaps.cpp \
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
TEST(engine, testRpmAcceleration) {
|
||||||
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
|
eth.setTriggerType(trigger_type_e::TT_HALF_MOON);
|
||||||
|
|
||||||
|
// first revolution
|
||||||
|
eth.smartFireTriggerEvents2(/*count*/1, /*delay*/ 40);
|
||||||
|
ASSERT_EQ(0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||||
|
ASSERT_EQ(1500, Sensor::getOrZero(SensorType::Rpm));
|
||||||
|
// no acceleration info YET, huh?
|
||||||
|
ASSERT_EQ(0, engine->rpmCalculator.getRpmAcceleration());
|
||||||
|
|
||||||
|
// second revolution same speed
|
||||||
|
eth.smartFireTriggerEvents2(/*count*/1, /*delay*/ 40);
|
||||||
|
ASSERT_EQ(0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||||
|
ASSERT_EQ(1500, Sensor::getOrZero(SensorType::Rpm));
|
||||||
|
// we got RPM we got acceleration
|
||||||
|
ASSERT_EQ(9375, engine->rpmCalculator.getRpmAcceleration());
|
||||||
|
|
||||||
|
// third revolution slow down
|
||||||
|
eth.smartFireTriggerEvents2(/*count*/1, /*delay*/ 80);
|
||||||
|
ASSERT_EQ(1000, Sensor::getOrZero(SensorType::Rpm));
|
||||||
|
ASSERT_NEAR(-2083.3335, engine->rpmCalculator.getRpmAcceleration(), EPS3D);
|
||||||
|
ASSERT_EQ(0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||||
|
}
|
Loading…
Reference in New Issue