GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/sensor/function_pointer_sensor.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 14 0 14
Functions: 100.0% 3 0 3
Branches: -% 0 0 0
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 #include "pch.h"
2
3 #include "function_pointer_sensor.h"
4
5 class SensorFunctionPointer : public ::testing::Test {
6 protected:
7 1 void SetUp() override {
8 1 Sensor::resetRegistry();
9 1 }
10
11 1 void TearDown() override {
12 1 Sensor::resetRegistry();
13 1 }
14 };
15
16 1 float testFunc() {
17 1 return 23;
18 }
19
20 4 TEST_F(SensorFunctionPointer, TestValue) {
21 1 FunctionPointerSensor dut(SensorType::Clt, testFunc);
22 1 ASSERT_TRUE(dut.Register());
23
24 1 auto result = Sensor::get(SensorType::Clt);
25 1 EXPECT_TRUE(result.Valid);
26 1 EXPECT_FLOAT_EQ(result.Value, 23);
27 }
28