GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/ignition_injection/test_hd_cranking.cpp
Date: 2025-10-03 00:57:22
Warnings: 2 unchecked decisions!
Coverage Exec Excl Total
Lines: 100.0% 52 0 52
Functions: 100.0% 20 0 20
Branches: 74.3% 26 0 35
Decisions: 33.3% 2 - 6

Line Branch Decision Exec Source
1 // file test_hd_cranking.cpp
2
3 #include "pch.h"
4 #include "engine_csv_reader.h"
5
6 class HdCranking {
7 public:
8 6 HdCranking(const char *fileName) :
9
1/1
✓ Branch 2 taken 6 times.
6 reader(1, /* vvtCount */1), eth(engine_type_e::HARLEY) {
10 6 engineConfiguration->vvtMode[0] = VVT_BOSCH_QUICK_START;
11
1/1
✓ Branch 1 taken 6 times.
6 eth.applyTriggerWaveform();
12
1/1
✓ Branch 1 taken 6 times.
6 reader.open(fileName);
13 6 }
14
15 EngineCsvReader reader;
16 EngineTestHelper eth;
17 };
18
19 5 static void runTest(const char *fileName) {
20
1/1
✓ Branch 2 taken 5 times.
5 HdCranking test(fileName);
21
22 5 EngineCsvReader &reader = test.reader;
23
24
3/3
✓ Branch 1 taken 4895 times.
✓ Branch 3 taken 4890 times.
✓ Branch 4 taken 5 times.
0/1
? Decision couldn't be analyzed.
4895 while (reader.haveMore()) {
25
1/1
✓ Branch 1 taken 4890 times.
4890 reader.processLine(&test.eth);
26 }
27 10 }
28
29 4 TEST(harley, hdCrankingWithCam1) {
30 1 runTest("tests/ignition_injection/resources/hd-req-sync_1.csv");
31 1 }
32
33 4 TEST(harley, hdCrankingWithCam3) {
34
1/1
✓ Branch 2 taken 1 time.
1 HdCranking test("tests/ignition_injection/resources/hd-req-sync_3.csv");
35
36 1 EngineCsvReader &reader = test.reader;
37
38
3/3
✓ Branch 1 taken 977 times.
✓ Branch 3 taken 976 times.
✓ Branch 4 taken 1 time.
0/1
? Decision couldn't be analyzed.
977 while (reader.haveMore()) {
39
1/1
✓ Branch 1 taken 976 times.
976 reader.processLine(&test.eth);
40
41
1/1
✓ Branch 1 taken 976 times.
976 reader.assertFirstRpm(184, 60);
42
1/1
✓ Branch 1 taken 976 times.
976 auto rpm = Sensor::getOrZero(SensorType::Rpm);
43
44
6/6
✓ Branch 0 taken 269 times.
✓ Branch 1 taken 707 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 268 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 975 times.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 975 times.
976 if (!reader.gotSync && engine->triggerCentral.triggerState.hasSynchronizedPhase()) {
45
2/6
✓ Branch 5 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
✗ Branch 14 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(reader.lineIndex(), 269);
46 1 reader.gotSync = true;
47 }
48
49 976 if (reader.gotSync) {
50 // we have loss of sync, interesting!
51 // EXPECT_TRUE(engine->triggerCentral.triggerState.hasSynchronizedPhase()) << "Loss " << reader.lineIndex();
52 }
53 }
54
55
3/8
✓ Branch 3 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
✗ Branch 11 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✓ Branch 26 taken 1 time.
✗ Branch 27 not taken.
1 ASSERT_EQ(2, engine->triggerCentral.triggerState.camResyncCounter); // interesting!
56 1 }
57
58 4 TEST(harley, hdCrankingWithCam4) {
59 1 runTest("tests/ignition_injection/resources/hd-req-sync_4.csv");
60 1 }
61
62 4 TEST(harley, hdCrankingWithCamAnother) {
63 1 runTest("tests/ignition_injection/resources/hd-req-sync-another-one_1.csv");
64 1 }
65
66 4 TEST(harley, hdCrankingWithCamAnother2) {
67 1 runTest("tests/ignition_injection/resources/hd-req-sync-another-one_2.csv");
68 1 }
69
70 4 TEST(harley, hdCrankingWithCamAnother3) {
71 1 runTest("tests/ignition_injection/resources/hd-req-sync-another-one_3.csv");
72 1 }
73