GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/shift_torque_reduction/test_shift_torque_reduction_inverted_switch.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 13 0 13
Functions: 100.0% 5 0 5
Branches: 54.3% 25 0 46
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 //
2 // Created by kifir on 12/17/24.
3 //
4
5 #include "pch.h"
6
7 #include "shift_torque_reduction_switch_test_base.h"
8
9 namespace {
10 class ShiftTorqueReductionInvertedSwitchTest : public ShiftTorqueReductionSwitchTestBase {
11 };
12
13
6/8
✓ Branch 6 taken 1 time.
✓ Branch 12 taken 1 time.
✓ Branch 15 taken 1 time.
✓ Branch 21 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 29 taken 1 time.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
15 TEST_P(ShiftTorqueReductionInvertedSwitchTest, checkTorqueReductionTriggerPinSwitch) {
14 4 setUpEngineConfiguration(GetParam().config);
15
16 4 const bool expectedIsTorqueReductionTriggerPinValid = GetParam().expectedIsTorqueReductionTriggerPinValid;
17
18 4 checkShiftTorqueReductionState("default", expectedIsTorqueReductionTriggerPinValid, true);
19
20 4 setPinState(GetParam().inputPin, false);
21 4 checkShiftTorqueReductionState(
22 "Torque reduction trigger pin is on",
23 expectedIsTorqueReductionTriggerPinValid,
24 true
25 );
26
27 4 setPinState(GetParam().inputPin, false);
28 4 checkShiftTorqueReductionState(
29 "Torque reduction trigger pin is off",
30 expectedIsTorqueReductionTriggerPinValid,
31 true
32 );
33 4 }
34
35
19/38
(anonymous namespace)::gtest_ShiftTorqueReductionInvertedSwitchTestForVariousInputPinsShiftTorqueReductionInvertedSwitchTest_EvalGenerateName_(testing::TestParamInfo<ShiftTorqueReductionSwitchParams> const&):
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 10 not taken.
✗ Branch 16 not taken.
✗ Branch 22 not taken.
✗ Branch 26 not taken.
✗ Branch 32 not taken.
✗ Branch 38 not taken.
✗ Branch 44 not taken.
✗ Branch 48 not taken.
✗ Branch 54 not taken.
✗ Branch 60 not taken.
✗ Branch 66 not taken.
✗ Branch 70 not taken.
✗ Branch 76 not taken.
✗ Branch 82 not taken.
✗ Branch 88 not taken.
✗ Branch 92 not taken.
✗ Branch 95 not taken.
✗ Branch 98 not taken.
(anonymous namespace)::gtest_ShiftTorqueReductionInvertedSwitchTestForVariousInputPinsShiftTorqueReductionInvertedSwitchTest_EvalGenerator_():
✓ Branch 5 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 21 taken 1 time.
✓ Branch 27 taken 1 time.
✓ Branch 33 taken 1 time.
✓ Branch 39 taken 1 time.
✓ Branch 43 taken 1 time.
✓ Branch 49 taken 1 time.
✓ Branch 55 taken 1 time.
✓ Branch 61 taken 1 time.
✓ Branch 65 taken 1 time.
✓ Branch 71 taken 1 time.
✓ Branch 77 taken 1 time.
✓ Branch 83 taken 1 time.
✓ Branch 87 taken 1 time.
✓ Branch 90 taken 1 time.
✓ Branch 93 taken 1 time.
14 INSTANTIATE_TEST_SUITE_P(
36 ShiftTorqueReductionInvertedSwitchTestForVariousInputPins,
37 ShiftTorqueReductionInvertedSwitchTest,
38 testing::Values(
39 ShiftTorqueReductionSwitchParams {
40 /* inputPin = */ TestSwitchPin::TORQUE_REDUCTION,
41 /* config = */ ShiftTorqueReductionSwitchTestBase::TEST_ENGINE_CONFIG.clone()
42 .setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
43 .setTorqueReductionTriggerPinMode(PI_INVERTED_DEFAULT),
44 /* expectedIsTorqueReductionTriggerPinValid = */ true,
45 /* description = */ "TORQUE_REDUCTION"
46 },
47 ShiftTorqueReductionSwitchParams {
48 /* inputPin = */ TestSwitchPin::LAUNCH,
49 /* config = */ ShiftTorqueReductionSwitchTestBase::TEST_ENGINE_CONFIG.clone()
50 .setTorqueReductionActivationMode(torqueReductionActivationMode_e::LAUNCH_BUTTON)
51 .setLaunchActivatePinMode(PI_INVERTED_DEFAULT),
52 /* expectedIsTorqueReductionTriggerPinValid = */ true,
53 /* description = */ "LAUNCH"
54 },
55 ShiftTorqueReductionSwitchParams {
56 /* inputPin = */ TestSwitchPin::CLUTCH_DOWN,
57 /* config = */ ShiftTorqueReductionSwitchTestBase::TEST_ENGINE_CONFIG.clone()
58 .setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_CLUTCH_DOWN_SWITCH)
59 .setClutchDownPinMode(PI_INVERTED_DEFAULT),
60 /* expectedIsTorqueReductionTriggerPinValid = */ true,
61 /* description = */ "CLUTCH_DOWN"
62 },
63 ShiftTorqueReductionSwitchParams {
64 /* inputPin = */ TestSwitchPin::CLUTCH_UP,
65 /* config = */ ShiftTorqueReductionSwitchTestBase::TEST_ENGINE_CONFIG.clone()
66 .setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_CLUTCH_UP_SWITCH)
67 .setClutchUpPinMode(PI_INVERTED_DEFAULT),
68 /* expectedIsTorqueReductionTriggerPinValid = */ true,
69 /* description = */ "CLUTCH_UP"
70 }
71 )
72 );
73 }
74