GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/shift_torque_reduction/test_shift_torque_reduction_inverted_switch.cpp
Date: 2025-10-24 14:26:41
Coverage Exec Excl Total
Lines: 100.0% 13 0 13
Functions: 100.0% 5 0 5
Branches: 53.8% 28 0 52
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.
17 TEST_P(ShiftTorqueReductionInvertedSwitchTest, checkTorqueReductionTriggerPinSwitch) {
14 5 setUpEngineConfiguration(GetParam().config);
15
16 5 const bool expectedIsTorqueReductionTriggerPinValid = GetParam().expectedIsTorqueReductionTriggerPinValid;
17
18 5 checkShiftTorqueReductionState("default", expectedIsTorqueReductionTriggerPinValid, true);
19
20 5 setPinState(GetParam().inputPin, false);
21 5 checkShiftTorqueReductionState(
22 "Torque reduction trigger pin is on",
23 expectedIsTorqueReductionTriggerPinValid,
24 true
25 );
26
27 5 setPinState(GetParam().inputPin, false);
28 5 checkShiftTorqueReductionState(
29 "Torque reduction trigger pin is off",
30 expectedIsTorqueReductionTriggerPinValid,
31 true
32 );
33 5 }
34
35
22/44
(anonymous namespace)::gtest_ShiftTorqueReductionInvertedSwitchTestForVariousInputPinsShiftTorqueReductionInvertedSwitchTest_EvalGenerateName_(testing::TestParamInfo<ShiftTorqueReductionSwitchParams> const&):
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 10 not taken.
✗ Branch 16 not taken.
✗ Branch 22 not taken.
✗ Branch 26 not taken.
✗ Branch 31 not taken.
✗ Branch 37 not taken.
✗ Branch 41 not taken.
✗ Branch 47 not taken.
✗ Branch 53 not taken.
✗ Branch 59 not taken.
✗ Branch 63 not taken.
✗ Branch 69 not taken.
✗ Branch 75 not taken.
✗ Branch 81 not taken.
✗ Branch 85 not taken.
✗ Branch 91 not taken.
✗ Branch 97 not taken.
✗ Branch 103 not taken.
✗ Branch 107 not taken.
✗ Branch 110 not taken.
✗ Branch 113 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 26 taken 1 time.
✓ Branch 32 taken 1 time.
✓ Branch 36 taken 1 time.
✓ Branch 42 taken 1 time.
✓ Branch 48 taken 1 time.
✓ Branch 54 taken 1 time.
✓ Branch 58 taken 1 time.
✓ Branch 64 taken 1 time.
✓ Branch 70 taken 1 time.
✓ Branch 76 taken 1 time.
✓ Branch 80 taken 1 time.
✓ Branch 86 taken 1 time.
✓ Branch 92 taken 1 time.
✓ Branch 98 taken 1 time.
✓ Branch 102 taken 1 time.
✓ Branch 105 taken 1 time.
✓ Branch 108 taken 1 time.
17 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 /* expectedIsTorqueReductionTriggerPinValid = */ true,
68 /* description = */ "CLUTCH_UP"
69 },
70 ShiftTorqueReductionSwitchParams {
71 /* inputPin = */ TestSwitchPin::CLUTCH_UP,
72 /* config = */ ShiftTorqueReductionSwitchTestBase::TEST_ENGINE_CONFIG.clone()
73 .setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_CLUTCH_UP_SWITCH)
74 .setClutchUpPinMode(PI_DEFAULT),
75 /* expectedIsTorqueReductionTriggerPinValid = */ true,
76 /* description = */ "CLUTCH_UP (pinMode = PI_DEFAULT)"
77 }
78 )
79 );
80 }
81