This commit is contained in:
rusefillc 2024-05-10 00:13:32 +03:00 committed by GitHub
commit fb0f224342
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 5 deletions

View File

@ -336,18 +336,19 @@ TEST(etb, setpointSecondThrottleTrim) {
return y;
});
// Should get called with the un-adjusted setpoint
StrictMock<MockVp3d> throttleTrimTable;
EXPECT_CALL(throttleTrimTable, getValue(0, 47))
.WillOnce(Return(4));
struct MockEtb2 : EtbController2 {
MOCK_METHOD(percent_t, getThrottleTrim, (float rpm, percent_t targetPosition), (const, override));
};
// Must have TPS & PPS initialized for ETB setup
Sensor::setMockValue(SensorType::Tps1Primary, 0);
Sensor::setMockValue(SensorType::Tps1, 0.0f, true);
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController2 etb(throttleTrimTable);
StrictMock<MockEtb2> etb;
etb.init(DC_Throttle1, nullptr, nullptr, &pedalMap, true);
// Should get called with the un-adjusted setpoint
EXPECT_CALL(etb, getThrottleTrim(0, 47)).WillOnce(Return(4));
Sensor::setMockValue(SensorType::AcceleratorPedal, 47, true);
EXPECT_EQ(51, etb.getSetpoint().value_or(-1));