diff --git a/unit_tests/tests/launch/launch_test_base.cpp b/unit_tests/tests/launch/launch_test_base.cpp index 3facb6c563..58baef1590 100644 --- a/unit_tests/tests/launch/launch_test_base.cpp +++ b/unit_tests/tests/launch/launch_test_base.cpp @@ -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(); } diff --git a/unit_tests/tests/launch/launch_test_base.h b/unit_tests/tests/launch/launch_test_base.h index 3adad8ec0d..cf7fd611fe 100644 --- a/unit_tests/tests/launch/launch_test_base.h +++ b/unit_tests/tests/launch/launch_test_base.h @@ -6,58 +6,16 @@ #include "util/test_base.h" -class LaunchTestConfig { +class LaunchTestConfig : public EngineConfig { public: - std::optional getLaunchControlEnabled() const { return m_launchControlEnabled; } - - std::optional getLaunchRpm() const { return m_launchRpm; } - std::optional getLaunchRpmWindow() const { return m_launchRpmWindow; } - std::optional getLaunchCorrectionsEndRpm() const { return m_launchCorrectionsEndRpm; } - - std::optional getIgnitionRetardEnable() const { return m_ignitionRetardEnable; } - std::optional getIgnitionRetard() const { return m_ignitionRetard; } - std::optional getSmoothRetardMode() const { return m_smoothRetardMode; } - - std::optional getEnableIgnitionCut() const { return m_enableIgnitionCut; } - std::optional getInitialIgnitionCut() const { return m_initialIgnitionCut; } - std::optional getFinalIgnitionCutBeforeLaunch() const { return m_finalIgnitionCutBeforeLaunch; } - bool getSatisfyActivationSwithSpeedAndTpsConditions() const { return m_satisfyActivationSwithSpeedAndTpsConditions; } protected: - void setLaunchControlEnabled(const std::optional value) { m_launchControlEnabled = value; } - - void setLaunchRpm(const std::optional value) { m_launchRpm = value; } - void setLaunchRpmWindow(const std::optional value) { m_launchRpmWindow = value; } - void setLaunchCorrectionsEndRpm(const std::optional value) { m_launchCorrectionsEndRpm = value; } - - void setIgnitionRetardEnable(const std::optional value) { m_ignitionRetardEnable = value; } - void setIgnitionRetard(const std::optional value) { m_ignitionRetard = value; } - void setSmoothRetardMode(const std::optional value) { m_smoothRetardMode = value; } - - void setEnableIgnitionCut(const std::optional value) { m_enableIgnitionCut = value; } - void setInitialIgnitionCut(const std::optional value) { m_initialIgnitionCut = value; } - void setFinalIgnitionCutBeforeLaunch(const std::optional value) { m_finalIgnitionCutBeforeLaunch = value; } - void setSatisfyActivationSwithSpeedAndTpsConditions(const bool value) { m_satisfyActivationSwithSpeedAndTpsConditions = value; } private: - std::optional m_launchControlEnabled; - - std::optional m_launchRpm; - std::optional m_launchRpmWindow; - std::optional m_launchCorrectionsEndRpm; - - std::optional m_ignitionRetardEnable; - std::optional m_ignitionRetard; - std::optional m_smoothRetardMode; - - std::optional m_enableIgnitionCut; - std::optional m_initialIgnitionCut; - std::optional m_finalIgnitionCutBeforeLaunch; - bool m_satisfyActivationSwithSpeedAndTpsConditions { false }; }; diff --git a/unit_tests/tests/util/engine_config.cpp b/unit_tests/tests/util/engine_config.cpp index 4f03cc4dbe..e27edd7e4d 100644 --- a/unit_tests/tests/util/engine_config.cpp +++ b/unit_tests/tests/util/engine_config.cpp @@ -20,6 +20,56 @@ EngineConfig EngineConfig::setLaunchActivateInverted(const std::optional v return *this; } +EngineConfig EngineConfig::setLaunchControlEnabled(const std::optional value) { + m_launchControlEnabled = value; + return *this; +} + +EngineConfig EngineConfig::setLaunchRpm(const std::optional value) { + m_launchRpm = value; + return *this; +} + +EngineConfig EngineConfig::setLaunchRpmWindow(const std::optional value) { + m_launchRpmWindow = value; + return *this; +} + +EngineConfig EngineConfig::setLaunchCorrectionsEndRpm(const std::optional value) { + m_launchCorrectionsEndRpm = value; + return *this; +} + +EngineConfig EngineConfig::setIgnitionRetardEnable(const std::optional value) { + m_ignitionRetardEnable = value; + return *this; +} + +EngineConfig EngineConfig::setIgnitionRetard(const std::optional value) { + m_ignitionRetard = value; + return *this; +} + +EngineConfig EngineConfig::setSmoothRetardMode(const std::optional value) { + m_smoothRetardMode = value; + return *this; +} + +EngineConfig EngineConfig::setEnableIgnitionCut(const std::optional value) { + m_enableIgnitionCut = value; + return *this; +} + +EngineConfig EngineConfig::setInitialIgnitionCut(const std::optional value) { + m_initialIgnitionCut = value; + return *this; +} + +EngineConfig EngineConfig::setFinalIgnitionCutBeforeLaunch(const std::optional value) { + m_finalIgnitionCutBeforeLaunch = value; + return *this; +} + EngineConfig EngineConfig::setTorqueReductionEnabled(const std::optional value) { m_isTorqueReductionEnabled = value; return *this; diff --git a/unit_tests/tests/util/engine_config.h b/unit_tests/tests/util/engine_config.h index 47065f5870..546ea723b2 100644 --- a/unit_tests/tests/util/engine_config.h +++ b/unit_tests/tests/util/engine_config.h @@ -13,6 +13,19 @@ public: // Launch Control std::optional getLaunchActivatePin() const { return m_launchActivatePin; } std::optional getLaunchActivateInverted() const { return m_launchActivateInverted; } + std::optional getLaunchControlEnabled() const { return m_launchControlEnabled; } + + std::optional getLaunchRpm() const { return m_launchRpm; } + std::optional getLaunchRpmWindow() const { return m_launchRpmWindow; } + std::optional getLaunchCorrectionsEndRpm() const { return m_launchCorrectionsEndRpm; } + + std::optional getIgnitionRetardEnable() const { return m_ignitionRetardEnable; } + std::optional getIgnitionRetard() const { return m_ignitionRetard; } + std::optional getSmoothRetardMode() const { return m_smoothRetardMode; } + + std::optional getEnableIgnitionCut() const { return m_enableIgnitionCut; } + std::optional getInitialIgnitionCut() const { return m_initialIgnitionCut; } + std::optional getFinalIgnitionCutBeforeLaunch() const { return m_finalIgnitionCutBeforeLaunch; } // Shift Torque Reduction (Flat Shift) std::optional getTorqueReductionEnabled() const { return m_isTorqueReductionEnabled; } @@ -46,6 +59,16 @@ public: // Launch Control EngineConfig setLaunchActivatePin(std::optional value); EngineConfig setLaunchActivateInverted(std::optional value); + EngineConfig setLaunchControlEnabled(std::optional value); + EngineConfig setLaunchRpm(std::optional value); + EngineConfig setLaunchRpmWindow(std::optional value); + EngineConfig setLaunchCorrectionsEndRpm(std::optional value); + EngineConfig setIgnitionRetardEnable(std::optional value); + EngineConfig setIgnitionRetard(std::optional value); + EngineConfig setSmoothRetardMode(std::optional value); + EngineConfig setEnableIgnitionCut(std::optional value); + EngineConfig setInitialIgnitionCut(std::optional value); + EngineConfig setFinalIgnitionCutBeforeLaunch(std::optional value); // Shift Torque Reduction (Flat Shift) EngineConfig setTorqueReductionEnabled(std::optional value); @@ -74,6 +97,16 @@ private: // Launch Control std::optional m_launchActivatePin; std::optional m_launchActivateInverted; + std::optional m_launchControlEnabled; + std::optional m_launchRpm; + std::optional m_launchRpmWindow; + std::optional m_launchCorrectionsEndRpm; + std::optional m_ignitionRetardEnable; + std::optional m_ignitionRetard; + std::optional m_smoothRetardMode; + std::optional m_enableIgnitionCut; + std::optional m_initialIgnitionCut; + std::optional m_finalIgnitionCutBeforeLaunch; // Shift Torque Reduction (Flat Shift) std::optional m_isTorqueReductionEnabled; diff --git a/unit_tests/tests/util/test_base.cpp b/unit_tests/tests/util/test_base.cpp index 65d995c977..4812d5a452 100644 --- a/unit_tests/tests/util/test_base.cpp +++ b/unit_tests/tests/util/test_base.cpp @@ -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()); diff --git a/unit_tests/tests/util/test_engine_configuration.cpp b/unit_tests/tests/util/test_engine_configuration.cpp index 812a0ea9b7..ab9168bf4e 100644 --- a/unit_tests/tests/util/test_engine_configuration.cpp +++ b/unit_tests/tests/util/test_engine_configuration.cpp @@ -48,7 +48,7 @@ void TestEngineConfiguration::configureLaunchRpm(const std::optional 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 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 } }