From 3c090129e6c31a0f548c20ef4c85e9d7088c32d0 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 20 Jul 2023 16:05:16 -0400 Subject: [PATCH] launch control: Speed threshold depends on launch mode, also zero speed limit handling #5419 only:TDD --- unit_tests/tests/test_launch.cpp | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/unit_tests/tests/test_launch.cpp b/unit_tests/tests/test_launch.cpp index 47c0f262cb..41b96c023a 100644 --- a/unit_tests/tests/test_launch.cpp +++ b/unit_tests/tests/test_launch.cpp @@ -40,6 +40,40 @@ TEST(LaunchControl, VSSCondition) { } + +TEST(LaunchControl, ZeroVSSCondition) { + EngineTestHelper eth(engine_type_e::TEST_ENGINE); + + LaunchControlBase dut; + + // Test Speed threshold + engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH; + engineConfiguration->launchSpeedThreshold = 0; + + Sensor::setMockValue(SensorType::VehicleSpeed, 10.0); + EXPECT_FALSE(dut.isInsideSpeedCondition()); + +} + +TEST(LaunchControl, VSSConditionWithSwitch) { + EngineTestHelper eth(engine_type_e::TEST_ENGINE); + + LaunchControlBase dut; + + // Test Speed threshold + engineConfiguration->launchActivationMode = SWITCH_INPUT_LAUNCH; + engineConfiguration->launchActivatePin = Gpio::G1; + setMockState(engineConfiguration->launchActivatePin, true); + engineConfiguration->launchSpeedThreshold = 30; + + Sensor::setMockValue(SensorType::VehicleSpeed, 10.0); + EXPECT_TRUE(dut.isInsideSpeedCondition()); + + Sensor::setMockValue(SensorType::VehicleSpeed, 40.0); + EXPECT_TRUE(dut.isInsideSpeedCondition()); + +} + TEST(LaunchControl, RPMCondition) { EngineTestHelper eth(engine_type_e::TEST_ENGINE);