GCC Code Coverage Report


Directory: ./
File: firmware/controllers/sensors/core/fallback_sensor.h
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 10 0 10
Functions: 100.0% 2 0 2
Branches: 100.0% 4 0 4
Decisions: 100.0% 2 - 2

Line Branch Decision Exec Source
1 #pragma once
2
3 #include "sensor.h"
4
5 class FallbackSensor final : public Sensor {
6 public:
7 2 FallbackSensor(SensorType outputType, SensorType primarySensor, SensorType fallbackSensor)
8 2 : Sensor(outputType)
9 2 , m_primary(primarySensor)
10 2 , m_fallback(fallbackSensor)
11 {
12 2 }
13
14 2 SensorResult get() const override {
15
1/1
✓ Branch 2 taken 2 times.
2 auto primary = Sensor::get(m_primary);
16
17
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
2/2
✓ Decision 'true' taken 1 time.
✓ Decision 'false' taken 1 time.
2 if (primary) {
18 1 return primary;
19 }
20
21
1/1
✓ Branch 1 taken 1 time.
1 return Sensor::get(m_fallback);
22 }
23
24 void showInfo(const char* sensorName) const override;
25
26 private:
27 const SensorType m_primary;
28 const SensorType m_fallback;
29 };
30