GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/util/test_persistent_configuration.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 64.7% 22 0 34
Functions: 60.0% 6 0 10
Branches: 100.0% 10 0 10
Decisions: 100.0% 10 - 10

Line Branch Decision Exec Source
1 //
2 // Created by kifir on 11/5/24.
3 //
4
5 #include "pch.h"
6
7 #include "test_persistent_configuration.h"
8
9 18 TestPersistentConfiguration& TestPersistentConfiguration::getInstance() {
10 18 return instance;
11 }
12
13 void TestPersistentConfiguration::setIgnitionLoadBins(const IgnitionLoadBins& bins) {
14 copyArray(config->ignitionLoadBins, bins);
15 }
16
17 void TestPersistentConfiguration::setIgnitionRpmBins(const IgnitionRpmBins& bins) {
18 copyArray(config->ignitionRpmBins, bins);
19 }
20
21 11 void TestPersistentConfiguration::setIgnitionTable(const IgnitionTable& ignitions) {
22
2/2
✓ Branch 0 taken 176 times.
✓ Branch 1 taken 11 times.
2/2
✓ Decision 'true' taken 176 times.
✓ Decision 'false' taken 11 times.
187 for (int i = 0; i < IGN_LOAD_COUNT; i++) {
23
2/2
✓ Branch 0 taken 2816 times.
✓ Branch 1 taken 176 times.
2/2
✓ Decision 'true' taken 2816 times.
✓ Decision 'false' taken 176 times.
2992 for (int j = 0; j < IGN_RPM_COUNT; j++) {
24 2816 config->ignitionTable[i][j] = ignitions[i][j];
25 }
26 }
27 11 }
28
29 2 void TestPersistentConfiguration::setInjectorStagingTable(const InjectorStagingTable& injectorStaging) {
30
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 2 times.
2/2
✓ Decision 'true' taken 12 times.
✓ Decision 'false' taken 2 times.
14 for (int i = 0; i < INJ_STAGING_COUNT; i++) {
31
2/2
✓ Branch 0 taken 72 times.
✓ Branch 1 taken 12 times.
2/2
✓ Decision 'true' taken 72 times.
✓ Decision 'false' taken 12 times.
84 for (int j = 0; j < INJ_STAGING_COUNT; j++) {
32 72 config->injectorStagingTable[i][j] = injectorStaging[i][j];
33 }
34 }
35 2 }
36
37 1 void TestPersistentConfiguration::setCltFuelCorrCurve(const CltFuelCorrCurve& cltFuelCorr) {
38 4 std::copy(std::begin(cltFuelCorr), std::end(cltFuelCorr), std::begin(config->cltFuelCorr));
39 1 }
40
41 2 void TestPersistentConfiguration::setFuelLevelBinsCurve(const FuelLevelBinsCurve& fuelLevelBins) {
42
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 2 times.
2/2
✓ Decision 'true' taken 16 times.
✓ Decision 'false' taken 2 times.
36 for (size_t i = 0; i < fuelLevelBins.size(); i++) {
43 16 config->fuelLevelBins[i] = fuelLevelBins[i];
44 }
45 2 }
46
47 2 void TestPersistentConfiguration::setFuelLevelValuesCurve(const FuelLevelValuesCurve& fuelLevelValues) {
48 8 std::copy(std::begin(fuelLevelValues), std::end(fuelLevelValues), std::begin(config->fuelLevelValues));
49 2 }
50
51 void TestPersistentConfiguration::setIgnTrimLoadBins(const IgnTrimLoadBins& bins) {
52 copyArray(config->ignTrimLoadBins, bins);
53 }
54
55 void TestPersistentConfiguration::setIgnTrimRpmBins(const IgnTrimRpmBins& bins) {
56 copyArray(config->ignTrimRpmBins, bins);
57 }
58
59 TestPersistentConfiguration TestPersistentConfiguration::instance;
60