only:refactoring: extract part of functionality into `TestEngineConfiguration` class
This commit is contained in:
parent
bfebc60d7e
commit
5c6ee81352
|
@ -25,4 +25,6 @@ namespace engine_configuration_defaults {
|
|||
/* Launch Control: */
|
||||
constexpr switch_input_pin_e LAUNCH_ACTIVATE_PIN = Gpio::Unassigned;
|
||||
constexpr bool LAUNCH_ACTIVATE_PIN_INVERTED = false;
|
||||
constexpr launchActivationMode_e LAUNCH_ACTIVATION_MODE = SWITCH_INPUT_LAUNCH;
|
||||
constexpr int LAUNCH_SPEED_THRESHOLD = 0;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ void LaunchTestBase::setUpTestConfig(const LaunchTestConfig& config) {
|
|||
}
|
||||
|
||||
void LaunchTestBase::configureSatisfiedActivationSwithSpeedAndTpsConditions() {
|
||||
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH; // to satisfy activateSwitchCondition
|
||||
engineConfiguration->launchSpeedThreshold = 0; // to satisfy speedCondition
|
||||
getTestEngineConfiguration()
|
||||
.configureLaunchActivationMode(ALWAYS_ACTIVE_LAUNCH); // to satisfy activateSwitchCondition
|
||||
getTestEngineConfiguration().configureLaunchSpeedThreshold(0); // to satisfy speedCondition
|
||||
Sensor::setMockValue(SensorType::DriverThrottleIntent, 1.7); // to satisfy tpsCondition
|
||||
}
|
||||
|
|
|
@ -20,6 +20,30 @@ void TestEngineConfiguration::configureLaunchControlEnabled(const std::optional<
|
|||
}
|
||||
}
|
||||
|
||||
void TestEngineConfiguration::configureLaunchActivationMode(
|
||||
const std::optional<launchActivationMode_e> launchActivationMode
|
||||
) {
|
||||
if (launchActivationMode.has_value()) {
|
||||
engineConfiguration->launchActivationMode = launchActivationMode.value();
|
||||
} else {
|
||||
ASSERT_EQ(
|
||||
engineConfiguration->launchActivationMode,
|
||||
engine_configuration_defaults::LAUNCH_ACTIVATION_MODE
|
||||
); // check default value
|
||||
}
|
||||
}
|
||||
|
||||
void TestEngineConfiguration::configureLaunchSpeedThreshold(const std::optional<int> launchSpeedThreshold) {
|
||||
if (launchSpeedThreshold.has_value()) {
|
||||
engineConfiguration->launchSpeedThreshold = launchSpeedThreshold.value();
|
||||
} else {
|
||||
ASSERT_EQ(
|
||||
engineConfiguration->launchSpeedThreshold,
|
||||
engine_configuration_defaults::LAUNCH_SPEED_THRESHOLD
|
||||
); // check default value
|
||||
}
|
||||
}
|
||||
|
||||
void TestEngineConfiguration::configureLaunchRpm(const std::optional<int> launchRpm) {
|
||||
if (launchRpm.has_value()) {
|
||||
engineConfiguration->launchRpm = launchRpm.value();
|
||||
|
|
|
@ -13,6 +13,9 @@ public:
|
|||
// Launch Control Settings
|
||||
void configureLaunchControlEnabled(std::optional<bool> launchControlEnabled);
|
||||
|
||||
void configureLaunchActivationMode(std::optional<launchActivationMode_e> launchActivationMode);
|
||||
void configureLaunchSpeedThreshold(std::optional<int> launchSpeedThreshold);
|
||||
|
||||
void configureLaunchRpm(std::optional<int> launchRpm);
|
||||
void configureLaunchRpmWindow(std::optional<int> launchRpmWindow);
|
||||
void configureLaunchCorrectionsEndRpm(std::optional<int> launchCorrectionsEndRpm);
|
||||
|
|
Loading…
Reference in New Issue