| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | // | |||
| 2 | // Created by kifir on 12/2/24. | |||
| 3 | // | |||
| 4 | ||||
| 5 | #include "pch.h" | |||
| 6 | ||||
| 7 | #include "nitrous_test_base.h" | |||
| 8 | ||||
| 9 | namespace { | |||
| 10 | class NitrousConditionTest : public NitrousTestBase { | |||
| 11 | protected: | |||
| 12 | void SetUp() override; | |||
| 13 | }; | |||
| 14 | ||||
| 15 | 7 | void NitrousConditionTest::SetUp() { | ||
| 16 | 7 | TestBase::SetUp(); | ||
| 17 | ||||
| 18 |
1/1✓ Branch 5 taken 7 times.
|
7 | setUpTestConfiguration(); | |
| 19 | ||||
| 20 |
2/7✓ Branch 3 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
7 | EXPECT_FALSE(getModule<NitrousController>().isNitrousArmed); | |
| 21 |
2/7✓ Branch 3 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
7 | EXPECT_FALSE(getModule<NitrousController>().isNitrousSpeedCondition); | |
| 22 |
2/7✓ Branch 3 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
7 | EXPECT_FALSE(getModule<NitrousController>().isNitrousTpsCondition); | |
| 23 |
2/7✓ Branch 3 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
7 | EXPECT_FALSE(getModule<NitrousController>().isNitrousCltCondition); | |
| 24 |
2/7✓ Branch 3 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
7 | EXPECT_FALSE(getModule<NitrousController>().isNitrousMapCondition); | |
| 25 |
2/7✓ Branch 3 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
7 | EXPECT_FALSE(getModule<NitrousController>().isNitrousAfrCondition); | |
| 26 |
2/7✓ Branch 3 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 7 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
7 | EXPECT_FALSE(getModule<NitrousController>().isNitrousRpmCondition); | |
| 27 | ||||
| 28 | 7 | checkNitrousCondition(false, "No conditions are satisfied"); | ||
| 29 | ||||
| 30 | 7 | armNitrousControl(); | ||
| 31 | 7 | checkNitrousCondition(false, "Armed condition is satisfied"); | ||
| 32 | ||||
| 33 | 7 | satisfySpeedCondition(); | ||
| 34 | 7 | checkNitrousCondition(false, "Armed + Speed conditions are satisfied"); | ||
| 35 | ||||
| 36 | 7 | satisfyTpsCondition(); | ||
| 37 | 7 | checkNitrousCondition(false, "Armed + Speed + TPS conditions are satisfied"); | ||
| 38 | ||||
| 39 | 7 | satisfyCltCondition(); | ||
| 40 | 7 | checkNitrousCondition(false, "Armed + Speed + TPS + CLT conditions are satisfied"); | ||
| 41 | ||||
| 42 | 7 | satisfyMapCondition(); | ||
| 43 | 7 | checkNitrousCondition(false, "Armed + Speed + TPS + CLT + MAP conditions are satisfied"); | ||
| 44 | ||||
| 45 | 7 | satisfyAfrCondition(); | ||
| 46 | 7 | checkNitrousCondition(false, "Armed + Speed + TPS + CLT + MAP + AFR conditions are satisfied"); | ||
| 47 | ||||
| 48 | 7 | satisfyRpmCondition(); | ||
| 49 | 7 | checkNitrousCondition( | ||
| 50 | true, | |||
| 51 | "Armed + Speed + TPS + CLT + MAP + AFR + RPM conditions are satisfied" | |||
| 52 | ); | |||
| 53 | 7 | } | ||
| 54 | ||||
| 55 | 4 | TEST_F(NitrousConditionTest, checkWithoutArmedNitrousControl) { | ||
| 56 | 1 | unarmNitrousControl(); | ||
| 57 | 1 | checkNitrousCondition(false, "Without armed condition"); | ||
| 58 | 1 | } | ||
| 59 | ||||
| 60 | 4 | TEST_F(NitrousConditionTest, checkWithoutSatisfiedSpeedCondition) { | ||
| 61 | 1 | unsatisfySpeedCondition(); | ||
| 62 | 1 | checkNitrousCondition(false, "Without speed condition"); | ||
| 63 | 1 | } | ||
| 64 | ||||
| 65 | 4 | TEST_F(NitrousConditionTest, checkWithoutSatisfiedTpsCondition) { | ||
| 66 | 1 | unsatisfyTpsCondition(); | ||
| 67 | 1 | checkNitrousCondition(false, "Without TPS condition"); | ||
| 68 | 1 | } | ||
| 69 | ||||
| 70 | 4 | TEST_F(NitrousConditionTest, checkWithoutSatisfiedCltCondition) { | ||
| 71 | 1 | unsatisfyCltCondition(); | ||
| 72 | 1 | checkNitrousCondition(false, "Without CLT condition"); | ||
| 73 | 1 | } | ||
| 74 | ||||
| 75 | 4 | TEST_F(NitrousConditionTest, checkWithoutSatisfiedMapCondition) { | ||
| 76 | 1 | unsatisfyMapCondition(); | ||
| 77 | 1 | checkNitrousCondition(false, "Without MAP condition"); | ||
| 78 | 1 | } | ||
| 79 | ||||
| 80 | 4 | TEST_F(NitrousConditionTest, checkWithoutSatisfiedAfrCondition) { | ||
| 81 | 1 | unsatisfyAfrCondition(); | ||
| 82 | 1 | checkNitrousCondition(false, "Without AFR condition"); | ||
| 83 | 1 | } | ||
| 84 | ||||
| 85 | 4 | TEST_F(NitrousConditionTest, checkWithoutSatisfiedRpmCondition) { | ||
| 86 | 1 | unsatisfyRpmCondition(); | ||
| 87 | 1 | checkNitrousCondition(false, "Without RPM condition"); | ||
| 88 | 1 | } | ||
| 89 | } | |||
| 90 |