GCC Code Coverage Report


Directory: ./
File: unit_tests/test-framework/engine_csv_reader.h
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 25 0 25
Functions: 100.0% 8 0 8
Branches: 50.0% 8 0 16
Decisions: 100.0% 2 - 2

Line Branch Decision Exec Source
1 // file engine_csv_reader.h
2
3 #pragma once
4
5 #include "logicdata_csv_reader.h"
6
7 class EngineCsvReader {
8 public:
9 20 EngineCsvReader(size_t triggerCount, size_t vvtCount) : cvsReader(triggerCount, vvtCount) {
10 20 }
11
12 bool gotRpm = false;
13 bool gotSync = false;
14 bool prevSync = false;
15
16 int expectedFirstRpm = -1;
17 int expectedFirstRpmAtIndex = -1;
18
19 // composition good, inheritance less good?
20 CsvReader cvsReader;
21
22 20 void open(const char *fileName, const int* triggerColumnIndexes = NORMAL_ORDER, const int *vvtColumnIndexes = NORMAL_ORDER) {
23 20 cvsReader.open(fileName, triggerColumnIndexes, vvtColumnIndexes);
24 20 }
25 13487 bool haveMore() {
26 13487 return cvsReader.haveMore();
27 }
28
29 19 int lineIndex() const {
30 19 return cvsReader.lineIndex();
31 }
32
33 1 void setReadingOffset(int offset) {
34 1 cvsReader.readingOffset = offset;
35 1 }
36
37 2 void setFlipOnRead(bool v) {
38 2 cvsReader.flipOnRead = v;
39 2 }
40 void setFlipVvtOnRead(bool v) {
41 cvsReader.flipVvtOnRead = v;
42 }
43
44 13467 void processLine(EngineTestHelper *eth) {
45 13467 cvsReader.processLine(eth);
46 13467 }
47
48 8384 void assertFirstRpm(int expectedFirstRpm, int expectedFirstRpmAtIndex) {
49 8384 auto rpm = Sensor::getOrZero(SensorType::Rpm);
50
51
4/4
✓ Branch 0 taken 659 times.
✓ Branch 1 taken 7725 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 646 times.
2/2
✓ Decision 'true' taken 13 times.
✓ Decision 'false' taken 8371 times.
8384 if (!gotRpm && rpm) {
52 13 gotRpm = true;
53
54
2/6
✓ Branch 2 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13 times.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
13 EXPECT_NEAR(rpm, expectedFirstRpm, 1);
55
2/6
✓ Branch 4 taken 13 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 13 times.
✗ Branch 12 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
13 EXPECT_EQ(lineIndex(), expectedFirstRpmAtIndex);
56 }
57 8384 }
58
59 };
60