GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 15 / 0 / 15
Functions: 100.0% 4 / 0 / 4
Branches: 19.2% 5 / 0 / 26
Decisions: 50.0% 1 / - / 2

firmware/libfirmware/util/include/rusefi/manifest.h
Line Branch Decision Exec Source
1 #pragma once
2
3 // https://stackoverflow.com/questions/46899202/how-to-split-date-and-time-macros-into-individual-components-for-variabl
4 1202 constexpr int compilationDatePortion(const int startIndex, const int totalChars) {
5
6 1202 int result = 0;
7 1202 for (int i = startIndex + totalChars - 1, multiplier = 1;
8
2/2
✓ Branch 0 taken 3606 times.
✓ Branch 1 taken 1202 times.
4808 i >= startIndex;
9 3606 i--, multiplier *= 10) {
10 3606 const char c = __DATE__[i];
11
1/2
✓ Branch 0 taken 3606 times.
✗ Branch 1 not taken.
1/2
✓ Decision 'true' taken 3606 times.
✗ Decision 'false' not taken.
3606 if (c != ' ') {
12 3606 result += (c - '0') * multiplier;
13 }
14 }
15
16 1202 return result;
17 }
18
19 601 constexpr int compilationYear() {
20 601 return compilationDatePortion(7, 4);
21 }
22
23 601 constexpr int compilationDay() {
24 601 return compilationDatePortion(4, 2);
25 }
26
27 // https://stackoverflow.com/questions/19760221/c-get-the-month-as-number-at-compile-time
28
29 #define __COMPILATION_MONTH__ (\
30 __DATE__ [2] == 'n' ? (__DATE__ [1] == 'a' ? 1 : 6) \
31 : __DATE__ [2] == 'b' ? 2 \
32 : __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? 3 : 4) \
33 : __DATE__ [2] == 'y' ? 5 \
34 : __DATE__ [2] == 'l' ? 7 \
35 : __DATE__ [2] == 'g' ? 8 \
36 : __DATE__ [2] == 'p' ? 9 \
37 : __DATE__ [2] == 't' ? 10 \
38 : __DATE__ [2] == 'v' ? 11 \
39 : 12)
40
41 601 constexpr int compilationMonth() {
42
2/22
✓ Branch 0 taken 601 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 601 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
601 return __COMPILATION_MONTH__;
43 }
44