only:reordering: move part of functionality from `LaunchTestConfig` and `LaunchTestBase` classes to `TestBase` and `EngineConfig`
This commit is contained in:
parent
8873f2d784
commit
e99bf20960
|
@ -7,20 +7,7 @@
|
|||
#include "launch_test_base.h"
|
||||
|
||||
void LaunchTestBase::setUpTestConfig(const LaunchTestConfig& config) {
|
||||
getTestEngineConfiguration().configureLaunchControlEnabled(config.getLaunchControlEnabled());
|
||||
|
||||
getTestEngineConfiguration().configureLaunchRpm(config.getLaunchRpm());
|
||||
getTestEngineConfiguration().configureLaunchRpmWindow(config.getLaunchRpmWindow());
|
||||
getTestEngineConfiguration().configureLaunchCorrectionsEndRpm(config.getLaunchCorrectionsEndRpm());
|
||||
|
||||
getTestEngineConfiguration().configureIgnitionRetardEnable(config.getIgnitionRetardEnable());
|
||||
getTestEngineConfiguration().configureIgnitionRetard(config.getIgnitionRetard());
|
||||
getTestEngineConfiguration().configureSmoothRetardMode(config.getSmoothRetardMode());
|
||||
|
||||
getTestEngineConfiguration().configureEnableIgnitionCut(config.getEnableIgnitionCut());
|
||||
getTestEngineConfiguration().configureInitialIgnitionCutPercent(config.getInitialIgnitionCut());
|
||||
getTestEngineConfiguration().configureFinalIgnitionCutPercentBeforeLaunch(config.getFinalIgnitionCutBeforeLaunch());
|
||||
|
||||
setUpEngineConfiguration(config);
|
||||
if (config.getSatisfyActivationSwithSpeedAndTpsConditions()) {
|
||||
configureSatisfiedActivationSwithSpeedAndTpsConditions();
|
||||
}
|
||||
|
|
|
@ -6,58 +6,16 @@
|
|||
|
||||
#include "util/test_base.h"
|
||||
|
||||
class LaunchTestConfig {
|
||||
class LaunchTestConfig : public EngineConfig {
|
||||
public:
|
||||
std::optional<bool> getLaunchControlEnabled() const { return m_launchControlEnabled; }
|
||||
|
||||
std::optional<int> getLaunchRpm() const { return m_launchRpm; }
|
||||
std::optional<int> getLaunchRpmWindow() const { return m_launchRpmWindow; }
|
||||
std::optional<int> getLaunchCorrectionsEndRpm() const { return m_launchCorrectionsEndRpm; }
|
||||
|
||||
std::optional<bool> getIgnitionRetardEnable() const { return m_ignitionRetardEnable; }
|
||||
std::optional<float> getIgnitionRetard() const { return m_ignitionRetard; }
|
||||
std::optional<bool> getSmoothRetardMode() const { return m_smoothRetardMode; }
|
||||
|
||||
std::optional<bool> getEnableIgnitionCut() const { return m_enableIgnitionCut; }
|
||||
std::optional<int> getInitialIgnitionCut() const { return m_initialIgnitionCut; }
|
||||
std::optional<int> getFinalIgnitionCutBeforeLaunch() const { return m_finalIgnitionCutBeforeLaunch; }
|
||||
|
||||
bool getSatisfyActivationSwithSpeedAndTpsConditions() const {
|
||||
return m_satisfyActivationSwithSpeedAndTpsConditions;
|
||||
}
|
||||
protected:
|
||||
void setLaunchControlEnabled(const std::optional<bool> value) { m_launchControlEnabled = value; }
|
||||
|
||||
void setLaunchRpm(const std::optional<int> value) { m_launchRpm = value; }
|
||||
void setLaunchRpmWindow(const std::optional<int> value) { m_launchRpmWindow = value; }
|
||||
void setLaunchCorrectionsEndRpm(const std::optional<int> value) { m_launchCorrectionsEndRpm = value; }
|
||||
|
||||
void setIgnitionRetardEnable(const std::optional<bool> value) { m_ignitionRetardEnable = value; }
|
||||
void setIgnitionRetard(const std::optional<float> value) { m_ignitionRetard = value; }
|
||||
void setSmoothRetardMode(const std::optional<bool> value) { m_smoothRetardMode = value; }
|
||||
|
||||
void setEnableIgnitionCut(const std::optional<bool> value) { m_enableIgnitionCut = value; }
|
||||
void setInitialIgnitionCut(const std::optional<int> value) { m_initialIgnitionCut = value; }
|
||||
void setFinalIgnitionCutBeforeLaunch(const std::optional<int> value) { m_finalIgnitionCutBeforeLaunch = value; }
|
||||
|
||||
void setSatisfyActivationSwithSpeedAndTpsConditions(const bool value) {
|
||||
m_satisfyActivationSwithSpeedAndTpsConditions = value;
|
||||
}
|
||||
private:
|
||||
std::optional<bool> m_launchControlEnabled;
|
||||
|
||||
std::optional<int> m_launchRpm;
|
||||
std::optional<int> m_launchRpmWindow;
|
||||
std::optional<int> m_launchCorrectionsEndRpm;
|
||||
|
||||
std::optional<bool> m_ignitionRetardEnable;
|
||||
std::optional<float> m_ignitionRetard;
|
||||
std::optional<bool> m_smoothRetardMode;
|
||||
|
||||
std::optional<bool> m_enableIgnitionCut;
|
||||
std::optional<int> m_initialIgnitionCut;
|
||||
std::optional<int> m_finalIgnitionCutBeforeLaunch;
|
||||
|
||||
bool m_satisfyActivationSwithSpeedAndTpsConditions { false };
|
||||
};
|
||||
|
||||
|
|
|
@ -20,6 +20,56 @@ EngineConfig EngineConfig::setLaunchActivateInverted(const std::optional<bool> v
|
|||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setLaunchControlEnabled(const std::optional<bool> value) {
|
||||
m_launchControlEnabled = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setLaunchRpm(const std::optional<int> value) {
|
||||
m_launchRpm = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setLaunchRpmWindow(const std::optional<int> value) {
|
||||
m_launchRpmWindow = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setLaunchCorrectionsEndRpm(const std::optional<int> value) {
|
||||
m_launchCorrectionsEndRpm = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setIgnitionRetardEnable(const std::optional<bool> value) {
|
||||
m_ignitionRetardEnable = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setIgnitionRetard(const std::optional<float> value) {
|
||||
m_ignitionRetard = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setSmoothRetardMode(const std::optional<bool> value) {
|
||||
m_smoothRetardMode = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setEnableIgnitionCut(const std::optional<bool> value) {
|
||||
m_enableIgnitionCut = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setInitialIgnitionCut(const std::optional<int> value) {
|
||||
m_initialIgnitionCut = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setFinalIgnitionCutBeforeLaunch(const std::optional<int> value) {
|
||||
m_finalIgnitionCutBeforeLaunch = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
EngineConfig EngineConfig::setTorqueReductionEnabled(const std::optional<bool> value) {
|
||||
m_isTorqueReductionEnabled = value;
|
||||
return *this;
|
||||
|
|
|
@ -13,6 +13,19 @@ public:
|
|||
// Launch Control
|
||||
std::optional<switch_input_pin_e> getLaunchActivatePin() const { return m_launchActivatePin; }
|
||||
std::optional<bool> getLaunchActivateInverted() const { return m_launchActivateInverted; }
|
||||
std::optional<bool> getLaunchControlEnabled() const { return m_launchControlEnabled; }
|
||||
|
||||
std::optional<int> getLaunchRpm() const { return m_launchRpm; }
|
||||
std::optional<int> getLaunchRpmWindow() const { return m_launchRpmWindow; }
|
||||
std::optional<int> getLaunchCorrectionsEndRpm() const { return m_launchCorrectionsEndRpm; }
|
||||
|
||||
std::optional<bool> getIgnitionRetardEnable() const { return m_ignitionRetardEnable; }
|
||||
std::optional<float> getIgnitionRetard() const { return m_ignitionRetard; }
|
||||
std::optional<bool> getSmoothRetardMode() const { return m_smoothRetardMode; }
|
||||
|
||||
std::optional<bool> getEnableIgnitionCut() const { return m_enableIgnitionCut; }
|
||||
std::optional<int> getInitialIgnitionCut() const { return m_initialIgnitionCut; }
|
||||
std::optional<int> getFinalIgnitionCutBeforeLaunch() const { return m_finalIgnitionCutBeforeLaunch; }
|
||||
|
||||
// Shift Torque Reduction (Flat Shift)
|
||||
std::optional<bool> getTorqueReductionEnabled() const { return m_isTorqueReductionEnabled; }
|
||||
|
@ -46,6 +59,16 @@ public:
|
|||
// Launch Control
|
||||
EngineConfig setLaunchActivatePin(std::optional<switch_input_pin_e> value);
|
||||
EngineConfig setLaunchActivateInverted(std::optional<bool> value);
|
||||
EngineConfig setLaunchControlEnabled(std::optional<bool> value);
|
||||
EngineConfig setLaunchRpm(std::optional<int> value);
|
||||
EngineConfig setLaunchRpmWindow(std::optional<int> value);
|
||||
EngineConfig setLaunchCorrectionsEndRpm(std::optional<int> value);
|
||||
EngineConfig setIgnitionRetardEnable(std::optional<bool> value);
|
||||
EngineConfig setIgnitionRetard(std::optional<float> value);
|
||||
EngineConfig setSmoothRetardMode(std::optional<bool> value);
|
||||
EngineConfig setEnableIgnitionCut(std::optional<bool> value);
|
||||
EngineConfig setInitialIgnitionCut(std::optional<int> value);
|
||||
EngineConfig setFinalIgnitionCutBeforeLaunch(std::optional<int> value);
|
||||
|
||||
// Shift Torque Reduction (Flat Shift)
|
||||
EngineConfig setTorqueReductionEnabled(std::optional<bool> value);
|
||||
|
@ -74,6 +97,16 @@ private:
|
|||
// Launch Control
|
||||
std::optional<switch_input_pin_e> m_launchActivatePin;
|
||||
std::optional<bool> m_launchActivateInverted;
|
||||
std::optional<bool> m_launchControlEnabled;
|
||||
std::optional<int> m_launchRpm;
|
||||
std::optional<int> m_launchRpmWindow;
|
||||
std::optional<int> m_launchCorrectionsEndRpm;
|
||||
std::optional<bool> m_ignitionRetardEnable;
|
||||
std::optional<float> m_ignitionRetard;
|
||||
std::optional<bool> m_smoothRetardMode;
|
||||
std::optional<bool> m_enableIgnitionCut;
|
||||
std::optional<int> m_initialIgnitionCut;
|
||||
std::optional<int> m_finalIgnitionCutBeforeLaunch;
|
||||
|
||||
// Shift Torque Reduction (Flat Shift)
|
||||
std::optional<bool> m_isTorqueReductionEnabled;
|
||||
|
|
|
@ -30,6 +30,16 @@ void TestBase::setUpEngineConfiguration(const EngineConfig& config) {
|
|||
// Launch Control
|
||||
getTestEngineConfiguration().configureLaunchActivatePin(config.getLaunchActivatePin());
|
||||
getTestEngineConfiguration().configureLaunchActivateInverted(config.getLaunchActivateInverted());
|
||||
getTestEngineConfiguration().configureLaunchControlEnabled(config.getLaunchControlEnabled());
|
||||
getTestEngineConfiguration().configureLaunchRpm(config.getLaunchRpm());
|
||||
getTestEngineConfiguration().configureLaunchRpmWindow(config.getLaunchRpmWindow());
|
||||
getTestEngineConfiguration().configureLaunchCorrectionsEndRpm(config.getLaunchCorrectionsEndRpm());
|
||||
getTestEngineConfiguration().configureIgnitionRetardEnable(config.getIgnitionRetardEnable());
|
||||
getTestEngineConfiguration().configureIgnitionRetard(config.getIgnitionRetard());
|
||||
getTestEngineConfiguration().configureSmoothRetardMode(config.getSmoothRetardMode());
|
||||
getTestEngineConfiguration().configureEnableIgnitionCut(config.getEnableIgnitionCut());
|
||||
getTestEngineConfiguration().configureInitialIgnitionCutPercent(config.getInitialIgnitionCut());
|
||||
getTestEngineConfiguration().configureFinalIgnitionCutPercentBeforeLaunch(config.getFinalIgnitionCutBeforeLaunch());
|
||||
|
||||
// Shift Torque Reduction (Flat Shift)
|
||||
getTestEngineConfiguration().configureTorqueReductionEnabled(config.getTorqueReductionEnabled());
|
||||
|
|
|
@ -48,7 +48,7 @@ void TestEngineConfiguration::configureLaunchRpm(const std::optional<int> launch
|
|||
if (launchRpm.has_value()) {
|
||||
engineConfiguration->launchRpm = launchRpm.value();
|
||||
} else {
|
||||
ASSERT_EQ(engineConfiguration->launchRpm, 0); // check default value
|
||||
ASSERT_EQ(engineConfiguration->launchRpm, 3000); // check default value
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ void TestEngineConfiguration::configureLaunchRpmWindow(const std::optional<int>
|
|||
if (launchRpmWindow.has_value()) {
|
||||
engineConfiguration->launchRpmWindow = launchRpmWindow.value();
|
||||
} else {
|
||||
ASSERT_EQ(engineConfiguration->launchRpmWindow, 0); // check default value
|
||||
ASSERT_EQ(engineConfiguration->launchRpmWindow, 500); // check default value
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue