| 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 | 21 | EngineCsvReader(size_t triggerCount, size_t vvtCount) : cvsReader(triggerCount, vvtCount) { | ||
| 10 | 21 | } | ||
| 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 | 21 | void open(const char *fileName, const int* triggerColumnIndexes = NORMAL_ORDER, const int *vvtColumnIndexes = NORMAL_ORDER) { | ||
| 23 | 21 | cvsReader.open(fileName, triggerColumnIndexes, vvtColumnIndexes); | ||
| 24 | 21 | } | ||
| 25 | 21186 | bool haveMore() { | ||
| 26 | 21186 | return cvsReader.haveMore(); | ||
| 27 | } | |||
| 28 | ||||
| 29 | 20 | int lineIndex() const { | ||
| 30 | 20 | 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 | 21165 | void processLine(EngineTestHelper *eth) { | ||
| 45 | 21165 | cvsReader.processLine(eth); | ||
| 46 | 21165 | } | ||
| 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 |