2021-10-30 17:31:09 -07:00
|
|
|
#include "pch.h"
|
2019-09-21 11:33:38 -07:00
|
|
|
|
2021-10-30 17:31:09 -07:00
|
|
|
#include "function_pointer_sensor.h"
|
2019-09-21 11:33:38 -07:00
|
|
|
|
|
|
|
class SensorFunctionPointer : public ::testing::Test {
|
|
|
|
protected:
|
|
|
|
void SetUp() override {
|
|
|
|
Sensor::resetRegistry();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TearDown() override {
|
|
|
|
Sensor::resetRegistry();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
float testFunc() {
|
|
|
|
return 23;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(SensorFunctionPointer, TestValue) {
|
|
|
|
FunctionPointerSensor dut(SensorType::Clt, testFunc);
|
|
|
|
ASSERT_TRUE(dut.Register());
|
|
|
|
|
|
|
|
auto result = Sensor::get(SensorType::Clt);
|
|
|
|
EXPECT_TRUE(result.Valid);
|
|
|
|
EXPECT_FLOAT_EQ(result.Value, 23);
|
|
|
|
}
|