From 5904d68e9831adf87fb03eaeef41463b4ae27da5 Mon Sep 17 00:00:00 2001 From: Lawrence Stanton <52958935+LawrenceStanton@users.noreply.github.com> Date: Sun, 26 Nov 2023 23:12:28 +0200 Subject: [PATCH] Formatting --- Inc/HDC1080.hpp | 78 +++++++++++++++++++----------- Src/HDC1080.cpp | 68 ++++++++++++++++++-------- Test/HDC1080.test.cpp | 108 ++++++++++++++++++++++++++++++------------ 3 files changed, 176 insertions(+), 78 deletions(-) diff --git a/Inc/HDC1080.hpp b/Inc/HDC1080.hpp index 9b476a8..6fafbab 100644 --- a/Inc/HDC1080.hpp +++ b/Inc/HDC1080.hpp @@ -40,9 +40,10 @@ class HDC1080 { * This interface is used to abstract the I2C communication from the HDC1080 class. * A concrete implementation is then aggregated by the HDC1080 class. * The concrete implementation of this interface should be provided by the user. - * This also allows for the HDC1080 class to be tested without the need for a real I2C bus. - * The concrete implementation's lifetime must be managed by the user and must outlive the HDC1080 class. - * It is recommended that the concrete implementation be a static object. + * This also allows for the HDC1080 class to be tested without the need for a real I2C + * bus. The concrete implementation's lifetime must be managed by the user and must + * outlive the HDC1080 class. It is recommended that the concrete implementation be a + * static object. */ class I2C { public: @@ -52,38 +53,47 @@ class HDC1080 { /** * @brief Read a register from the HDC1080. * - * @param memoryAddress The HDC1080 internal memory address of the register to read. - * @return std::optional The value of the register if the read was successful. + * @param memoryAddress The HDC1080 internal memory address of the register to + * read. + * @return std::optional The value of the register if the read was + * successful. */ virtual std::optional read(MemoryAddress memoryAddress) noexcept = 0; /** * @brief Write a register to the HDC1080. * - * @param memoryAddress The HDC1080 internal memory address of the register to write. + * @param memoryAddress The HDC1080 internal memory address of the register to + * write. * @param data The data to write to the register. - * @return std::optional The value written to the register if the write was successful. + * @return std::optional The value written to the register if the write + * was successful. */ - virtual std::optional write(MemoryAddress memoryAddress, Register data) noexcept = 0; + virtual std::optional + write(MemoryAddress memoryAddress, Register data) noexcept = 0; /** * @brief Transmit a byte of data to the HDC1080. * * @param data The byte of data to transmit. - * @return std::optional The byte of data transmitted to the HDC1080 if successful. + * @return std::optional The byte of data transmitted to the HDC1080 if + * successful. * - * @note This function is normally used to get measurement data from the HDC1080, where some measurement - * delays are necessary, and therefore this driver will assume implementation of the I2C protocol. + * @note This function is normally used to get measurement data from the HDC1080, + * where some measurement delays are necessary, and therefore this driver will + * assume implementation of the I2C protocol. */ virtual std::optional transmit(uint8_t data) noexcept = 0; /** * @brief Receive a byte of data from the HDC1080. * - * @return std::optional The byte of data received from the HDC1080 if successful. + * @return std::optional The byte of data received from the HDC1080 if + * successful. * - * @note This function is normally used to get measurement data from the HDC1080, where some measurement - * delays are necessary, and therefore this driver will assume implementation of the I2C protocol. + * @note This function is normally used to get measurement data from the HDC1080, + * where some measurement delays are necessary, and therefore this driver will + * assume implementation of the I2C protocol. */ virtual std::optional receive(void) noexcept = 0; @@ -143,14 +153,16 @@ class HDC1080 { /** * @brief Get the Temperature Register * - * @return std::optional The fetched value of the temperature register if successful. + * @return std::optional The fetched value of the temperature register if + * successful. */ std::optional getTemperatureRegister(void) const; /** * @brief Get the Humidity Register * - * @return std::optional The fetched value of the humidity register if successful. + * @return std::optional The fetched value of the humidity register if + * successful. */ std::optional getHumidityRegister(void) const; @@ -174,8 +186,8 @@ class HDC1080 { * * @return std::optional The 41-bit serial ID if successful. * - * @note The serial ID is a 41-bit number by the register map, but the HDC1080 datasheet states "40-bit". - * This driver will assume the register map is correct. + * @note The serial ID is a 41-bit number by the register map, but the HDC1080 + * datasheet states "40-bit". This driver will assume the register map is correct. * @note Unused bits are set to 0. */ std::optional getSerialID(void) const; @@ -183,7 +195,8 @@ class HDC1080 { /** * @brief Get the Battery Status of the HDC1080. * - * @return std::optional True if the supply voltage greater than 2V8, false if less than 2V8. + * @return std::optional True if the supply voltage greater than 2V8, false if + * less than 2V8. */ std::optional getBatteryStatus(void) const; @@ -195,11 +208,14 @@ class HDC1080 { * @param hRes The resolution of the humidity measurement (8, 11, or 14 bit). * @param heater The heater setting (on or off). * - * @note The heater should only be turned on if necessary for saturated conditions. Refer to the datasheet §8.3.3. - * @note If only a single measurement is desired, the other measurement's resolution may be set to any valid value. - * @note All arguments are optional. Unspecified arguments will remain unchanged. If all arguments are specified, - * the config register is not read before being written. - * @note If no arguments are specified the function short circuits and returns an empty optional. + * @note The heater should only be turned on if necessary for saturated conditions. + * Refer to the datasheet §8.3.3. + * @note If only a single measurement is desired, the other measurement's resolution + * may be set to any valid value. + * @note All arguments are optional. Unspecified arguments will remain unchanged. If + * all arguments are specified, the config register is not read before being written. + * @note If no arguments are specified the function short circuits and returns an + * empty optional. */ std::optional setConfig( std::optional acqMode, // @@ -211,7 +227,8 @@ class HDC1080 { /** * @brief Performs a software reset of the HDC1080. * - * @return std::optional The written value of the configuration register if successful. + * @return std::optional The written value of the configuration register if + * successful. * @note The written value shall always be 0x8000. */ std::optional softReset(void) const; @@ -222,9 +239,11 @@ class HDC1080 { * * @param memAddr The memory address of the register to fetch. * @param waitTime The measurement conversion delay time in milliseconds. - * @return std::optional The fetched value of the measurement register if successful. + * @return std::optional The fetched value of the measurement register if + * successful. */ - std::optional getMeasurementRegister(MemoryAddress memAddr, Duration waitTime = 0ms) const; + std::optional + getMeasurementRegister(MemoryAddress memAddr, Duration waitTime = 0ms) const; /* Registration for Private Member Testing Purposes Only */ #ifdef HDC1080_GTEST_TESTING @@ -239,7 +258,10 @@ class HDC1080 { FRIEND_TEST(HDC1080_Test, getHumidityRegisterReturnsEmptyOptionalWhenI2CReceiveFails); FRIEND_TEST(HDC1080_Test, getMeasurementRegisterNormallyReturnsValue); - FRIEND_TEST(HDC1080_Test, getMeasurementRegisterReturnsEmptyOptionalWhenI2CReceiveFails); + FRIEND_TEST( + HDC1080_Test, + getMeasurementRegisterReturnsEmptyOptionalWhenI2CReceiveFails + ); #endif }; diff --git a/Src/HDC1080.cpp b/Src/HDC1080.cpp index 80b25f1..8a9e84c 100644 --- a/Src/HDC1080.cpp +++ b/Src/HDC1080.cpp @@ -55,12 +55,13 @@ using namespace units::literals; #define HDC1080_CONFIG_HUMIDITY_RESOLUTION_MASK 0x0300u /** - * @note The below values are given a wide margin above the maximum conversion time specifications - * to allow for a imprecise delay timer method. + * @note The below values are given a wide margin above the maximum conversion time + * specifications to allow for a imprecise delay timer method. * - * @note As of current in this source, the conversion time does not consider the resolution of the measurement. - * It is possible to reduce the delay time by defining shorter conversion times for lower resolution measurements - * and amending the measurement register getter methods to use these shorter delay times. + * @note As of current in this source, the conversion time does not consider the + * resolution of the measurement. It is possible to reduce the delay time by defining + * shorter conversion times for lower resolution measurements and amending the measurement + * register getter methods to use these shorter delay times. */ #define HDC1080_CONVERSION_TIME_TEMPERATURE 15ms #define HDC1080_CONVERSION_TIME_HUMIDITY 15ms @@ -72,11 +73,17 @@ using MemoryAddress = HDC1080::I2C::MemoryAddress; HDC1080::HDC1080(I2C &i2c) : i2c{i2c} {} std::optional HDC1080::getTemperatureRegister(void) const { - return getMeasurementRegister(HDC1080_TEMPERATURE_ADDR, HDC1080_CONVERSION_TIME_TEMPERATURE); + return getMeasurementRegister( + HDC1080_TEMPERATURE_ADDR, + HDC1080_CONVERSION_TIME_TEMPERATURE + ); } std::optional HDC1080::getHumidityRegister(void) const { - return getMeasurementRegister(HDC1080_HUMIDITY_ADDR, HDC1080_CONVERSION_TIME_HUMIDITY); + return getMeasurementRegister( + HDC1080_HUMIDITY_ADDR, + HDC1080_CONVERSION_TIME_HUMIDITY + ); } std::optional HDC1080::getDeviceID(void) const { @@ -94,9 +101,10 @@ std::optional HDC1080::getSerialID(void) const { if (transmission.has_value()) serialID[i] = transmission.value(); else return std::nullopt; } - const uint64_t serialIdValue = (((uint64_t)serialID[0] & 0xFFFF) << 25) // SERIAL_ID[40:25], register bits [15:0] - | (((uint64_t)serialID[1] & 0xFFFF) << 9) // SERIAL_ID[24:9], register bits [15:0] - | (((uint64_t)serialID[2] & 0xFF80) >> 7); // SERIAL_ID[8:0], register bits [15:7] + const uint64_t serialIdValue = + (((uint64_t)serialID[0] & 0xFFFF) << 25) // SERIAL_ID[40:25], register bits [15:0] + | (((uint64_t)serialID[1] & 0xFFFF) << 9) // SERIAL_ID[24:9], register bits [15:0] + | (((uint64_t)serialID[2] & 0xFF80) >> 7); // SERIAL_ID[8:0], register bits [15:7] return serialIdValue; } @@ -105,12 +113,16 @@ std::optional HDC1080::getBatteryStatus(void) const { auto transmission = this->i2c.read(HDC1080_CONFIG_ADDR); if (transmission.has_value()) - return static_cast(!(transmission.value() & HDC1080_CONFIG_BATTERY_STATUS_MASK)); + return static_cast( + !(transmission.value() & HDC1080_CONFIG_BATTERY_STATUS_MASK) + ); else return std::nullopt; } -std::optional -HDC1080::getMeasurementRegister(HDC1080::I2C::MemoryAddress memAddr, Duration waitTime) const { +std::optional HDC1080::getMeasurementRegister( + HDC1080::I2C::MemoryAddress memAddr, + Duration waitTime +) const { if (!this->i2c.transmit(static_cast(memAddr))) return {}; this->i2c.delay(waitTime); @@ -121,7 +133,9 @@ HDC1080::getMeasurementRegister(HDC1080::I2C::MemoryAddress memAddr, Duration wa if (!data) return {}; } - return static_cast(transmissionData[0].value() << 8 | transmissionData[1].value()); + return static_cast( + transmissionData[0].value() << 8 | transmissionData[1].value() + ); } struct Config { @@ -144,9 +158,15 @@ static Register constructConfigRegister(Config config) { static Config decodeConfigRegister(Register configRegister) { return Config{ - static_cast(configRegister & HDC1080_CONFIG_ACQUISITION_MODE_MASK), - static_cast(configRegister & HDC1080_CONFIG_TEMPERATURE_RESOLUTION_MASK), - static_cast(configRegister & HDC1080_CONFIG_HUMIDITY_RESOLUTION_MASK), + static_cast( + configRegister & HDC1080_CONFIG_ACQUISITION_MODE_MASK + ), + static_cast( + configRegister & HDC1080_CONFIG_TEMPERATURE_RESOLUTION_MASK + ), + static_cast( + configRegister & HDC1080_CONFIG_HUMIDITY_RESOLUTION_MASK + ), static_cast(configRegister & HDC1080_CONFIG_HEATER_MASK), }; } @@ -196,7 +216,9 @@ std::optional HDC1080::softReset(void) const { * @return The temperature measurement in degrees Celsius. */ static Celsius constexpr convertTemperature(Register temperatureRegister) { - return Celsius(temperatureRegister * (165.0f / 65536.0f) - 40.0f); // Refer to HDC1080 datasheet for formula + return Celsius( + temperatureRegister * (165.0f / 65536.0f) - 40.0f + ); // Refer to HDC1080 datasheet for formula } /** @@ -205,13 +227,16 @@ static Celsius constexpr convertTemperature(Register temperatureRegister) { * @return The percent relative humidity. */ static RelativeHumidity convertHumidity(Register humidityRegister) { - return RelativeHumidity(humidityRegister * (25.0f / 16384.0f) * 100); // Refer to HDC1080 datasheet for formula + return RelativeHumidity( + humidityRegister * (25.0f / 16384.0f) * 100 + ); // Refer to HDC1080 datasheet for formula } Celsius HDC1080_X::getTemperature(void) const { auto temperatureRegister = getTemperatureRegister(); - if (temperatureRegister.has_value()) return convertTemperature(temperatureRegister.value()); + if (temperatureRegister.has_value()) + return convertTemperature(temperatureRegister.value()); return -40.0_degC; } @@ -228,7 +253,8 @@ std::optional HDC1080_X::setAcquisitionMode(AcquisitionMode acqMode) c return setConfig(acqMode, std::nullopt, std::nullopt, std::nullopt); } -std::optional HDC1080_X::setTemperatureResolution(TemperatureResolution tRes) const { +std::optional HDC1080_X::setTemperatureResolution(TemperatureResolution tRes +) const { return setConfig(std::nullopt, tRes, std::nullopt, std::nullopt); } diff --git a/Test/HDC1080.test.cpp b/Test/HDC1080.test.cpp index 52515b5..7932fb6 100644 --- a/Test/HDC1080.test.cpp +++ b/Test/HDC1080.test.cpp @@ -46,7 +46,8 @@ TEST(HDC1080_TestStatic, constructConfigRegisterRandomChecks) { HDC1080::AcquisitionMode::DUAL, HDC1080::TemperatureResolution::A_11BIT, HDC1080::HumidityResolution::A_11BIT, - HDC1080::Heater::ON}), + HDC1080::Heater::ON + }), 0b0011'0101'0000'0000u ); EXPECT_EQ( @@ -54,7 +55,8 @@ TEST(HDC1080_TestStatic, constructConfigRegisterRandomChecks) { HDC1080::AcquisitionMode::SINGLE, HDC1080::TemperatureResolution::A_14BIT, HDC1080::HumidityResolution::A_14BIT, - HDC1080::Heater::OFF}), + HDC1080::Heater::OFF + }), 0b0000'0000'0000'0000u ); EXPECT_EQ( @@ -62,7 +64,8 @@ TEST(HDC1080_TestStatic, constructConfigRegisterRandomChecks) { HDC1080::AcquisitionMode::SINGLE, HDC1080::TemperatureResolution::A_14BIT, HDC1080::HumidityResolution::A_8BIT, - HDC1080::Heater::ON}), + HDC1080::Heater::ON + }), 0b0010'0010'0000'0000u ); } @@ -74,7 +77,8 @@ TEST(HDC1080_TestStatic, decodeConfigRegisterRandomChecks) { HDC1080::AcquisitionMode::DUAL, HDC1080::TemperatureResolution::A_11BIT, HDC1080::HumidityResolution::A_11BIT, - HDC1080::Heater::ON}) + HDC1080::Heater::ON + }) ); EXPECT_EQ( decodeConfigRegister(0b0000'0000'0000'0000u), @@ -82,7 +86,8 @@ TEST(HDC1080_TestStatic, decodeConfigRegisterRandomChecks) { HDC1080::AcquisitionMode::SINGLE, HDC1080::TemperatureResolution::A_14BIT, HDC1080::HumidityResolution::A_14BIT, - HDC1080::Heater::OFF}) + HDC1080::Heater::OFF + }) ); EXPECT_EQ( decodeConfigRegister(0b0010'0010'0000'0000u), @@ -90,15 +95,31 @@ TEST(HDC1080_TestStatic, decodeConfigRegisterRandomChecks) { HDC1080::AcquisitionMode::SINGLE, HDC1080::TemperatureResolution::A_14BIT, HDC1080::HumidityResolution::A_8BIT, - HDC1080::Heater::ON}) + HDC1080::Heater::ON + }) ); } class MockedI2C : public HDC1080::I2C { public: - MOCK_METHOD(std::optional, read, (MemoryAddress addr), (noexcept, override, final)); - MOCK_METHOD(std::optional, write, (MemoryAddress addr, Register data), (noexcept, override, final)); - MOCK_METHOD(std::optional, transmit, (uint8_t data), (noexcept, override, final)); + MOCK_METHOD( + std::optional, + read, + (MemoryAddress addr), + (noexcept, override, final) + ); + MOCK_METHOD( + std::optional, + write, + (MemoryAddress addr, Register data), + (noexcept, override, final) + ); + MOCK_METHOD( + std::optional, + transmit, + (uint8_t data), + (noexcept, override, final) + ); MOCK_METHOD(std::optional, receive, (), (override, final, noexcept)); virtual void delay(Duration ms) const noexcept override final {} @@ -172,7 +193,8 @@ TEST_F(HDC1080_Test, getDeviceIDReturnsEmptyOptionalWhenI2CReadFails) { TEST_F(HDC1080_Test, getManufacturerIDNormallyReturnsValue) { const MemoryAddress manufacturerIDRegister = 0xFEu; const Register manufacturerID = 0x5449u; - EXPECT_CALL(this->i2c, read(Eq(manufacturerIDRegister))).WillOnce(Return(manufacturerID)); + EXPECT_CALL(this->i2c, read(Eq(manufacturerIDRegister))) + .WillOnce(Return(manufacturerID)); EXPECT_EQ(this->hdc1080.getManufacturerID().value(), manufacturerID); } @@ -183,11 +205,14 @@ TEST_F(HDC1080_Test, getManufacturerIDReturnsEmptyOptionalWhenI2CReadFails) { TEST_F(HDC1080_Test, getSerialIDNormallyReturnsValue) { const MemoryAddress serialIDRegisters[] = {0xFBu, 0xFCu, 0xFDu}; - const Register serialIDValues[] = {0xFFFFu, 0xFFFFu, 0xFF80u}; // 1 in every bit that 41-bit Serial ID has - // Note: In reality the serial ID can be any 41-bit value, but we're only testing that the bits are read correctly. + const Register serialIDValues[] = + {0xFFFFu, 0xFFFFu, 0xFF80u}; // 1 in every bit that 41-bit Serial ID has + // Note: In reality the serial ID can be any 41-bit value, but we're only testing that + // the bits are read correctly. for (uint8_t i = 0; i < 3; i++) { - EXPECT_CALL(this->i2c, read(Eq(serialIDRegisters[i]))).WillOnce(Return(serialIDValues[i])); + EXPECT_CALL(this->i2c, read(Eq(serialIDRegisters[i]))) + .WillOnce(Return(serialIDValues[i])); } EXPECT_EQ(this->hdc1080.getSerialID().value(), 0x1FFFFFFFFFFu); @@ -217,7 +242,8 @@ TEST_F(HDC1080_Test, getBatteryStatusReturnsEmptyOptionalWhenI2CReadFails) { } TEST_F(HDC1080_Test, setConfigNormallyWritesValueWithoutReadingIfGivenAllArguments) { - // Note: Constructing the register value to write is tested in the constructConfigRegisterRandomChecks test. + // Note: Constructing the register value to write is tested in the + // constructConfigRegisterRandomChecks test. const MemoryAddress configRegister = 0x02u; const Register configInitialValue = 0x1000u; @@ -240,8 +266,8 @@ TEST_F(HDC1080_Test, setConfigReturnsEmptyOptionalWhenGivenNoArguments) { } TEST_F(HDC1080_Test, setConfigNormallyReadsCurrentConfigAndWritesBackNewValues) { - const MemoryAddress configRegister = 0x02u; - const Register configInitialValue = 0x1100u; // Humidity 11-bit, Dual Acquisition + const MemoryAddress configRegister = 0x02u; + const Register configInitialValue = 0x1100u; // Humidity 11-bit, Dual Acquisition const Register configExpectedWrittenValue = 0b0001'0101'0000'0000u; EXPECT_CALL(this->i2c, read(Eq(configRegister))).WillOnce(Return(configInitialValue)); @@ -256,12 +282,17 @@ TEST_F(HDC1080_Test, setConfigNormallyReadsCurrentConfigAndWritesBackNewValues) EXPECT_EQ(write.value(), configExpectedWrittenValue); } -TEST_F(HDC1080_Test, setConfigShortCircuitsWhenConfigUnchangedAndReturnsCurrentConfigRegisterValue) { - const MemoryAddress configRegister = 0x02u; - const Register configInitialValue = 0x3500u; // Humidity 11-bit, Temperature 11-bit, Heater ON +TEST_F( + HDC1080_Test, + setConfigShortCircuitsWhenConfigUnchangedAndReturnsCurrentConfigRegisterValue +) { + const MemoryAddress configRegister = 0x02u; + const Register configInitialValue = + 0x3500u; // Humidity 11-bit, Temperature 11-bit, Heater ON EXPECT_CALL(this->i2c, read(Eq(configRegister))).WillOnce(Return(configInitialValue)); - EXPECT_CALL(this->i2c, write).Times(0); // Check that function short circuits without writing. + EXPECT_CALL(this->i2c, write) + .Times(0); // Check that function short circuits without writing. auto write = this->hdc1080.setConfig( {}, // @@ -299,7 +330,10 @@ TEST_F(HDC1080_X_Test, getTemperatureNormallyReturnsValue) { EXPECT_CALL(this->i2c, transmit(_)).WillRepeatedly(ReturnArg<0>()); EXPECT_CALL(this->i2c, receive()).WillOnce(Return(0xABu)).WillOnce(Return(0xCDu)); - EXPECT_FLOAT_EQ(this->hdc1080.getTemperature().value(), convertTemperature(0xABCDu).value()); + EXPECT_FLOAT_EQ( + this->hdc1080.getTemperature().value(), + convertTemperature(0xABCDu).value() + ); } TEST_F(HDC1080_X_Test, getTemperatureReturnsMinusFortyWhenGetTemperatureRegisterFails) { @@ -346,7 +380,8 @@ TEST_F(HDC1080_X_Test, setAcquisitionModeReturnsEmptyOptionalWhenI2CFails) { } TEST_F(HDC1080_X_Test, setTemperatureResolutionNormallySetsValue) { - // Mock changing the config value to 14-bit resolution and then back to 11-bit resolution. + // Mock changing the config value to 14-bit resolution and then back to 11-bit + // resolution. const Register configInitialValue14BitResolution = 0x1000u; const Register configInitialValue11BitResolution = 0x1400u; @@ -356,23 +391,29 @@ TEST_F(HDC1080_X_Test, setTemperatureResolutionNormallySetsValue) { EXPECT_CALL(this->i2c, write).WillRepeatedly(ReturnArg<1>()); EXPECT_EQ( - this->hdc1080.setTemperatureResolution(HDC1080::TemperatureResolution::A_11BIT).value(), + this->hdc1080.setTemperatureResolution(HDC1080::TemperatureResolution::A_11BIT) + .value(), configInitialValue11BitResolution ); EXPECT_EQ( - this->hdc1080.setTemperatureResolution(HDC1080::TemperatureResolution::A_14BIT).value(), + this->hdc1080.setTemperatureResolution(HDC1080::TemperatureResolution::A_14BIT) + .value(), configInitialValue14BitResolution ); } TEST_F(HDC1080_X_Test, setTemperatureResolutionReturnsEmptyOptionalWhenI2CFails) { disableI2C(); - EXPECT_EQ(this->hdc1080.setTemperatureResolution(HDC1080::TemperatureResolution::A_11BIT), nullopt); + EXPECT_EQ( + this->hdc1080.setTemperatureResolution(HDC1080::TemperatureResolution::A_11BIT), + nullopt + ); } TEST_F(HDC1080_X_Test, setHumidityResolutionNormallySetsValue) { - // Mock changing the config value to 11-bit resolution, then 8-bit resolution, then 14-bit resolution. + // Mock changing the config value to 11-bit resolution, then 8-bit resolution, then + // 14-bit resolution. const Register configInitialValue14BitResolution = 0x1000u; const Register configInitialValue11BitResolution = 0x1100u; const Register configInitialValue8BitResolution = 0x1200u; @@ -399,7 +440,10 @@ TEST_F(HDC1080_X_Test, setHumidityResolutionNormallySetsValue) { TEST_F(HDC1080_X_Test, setHumidityResolutionReturnsEmptyOptionalWhenI2CFails) { disableI2C(); - EXPECT_EQ(this->hdc1080.setHumidityResolution(HDC1080::HumidityResolution::A_11BIT), nullopt); + EXPECT_EQ( + this->hdc1080.setHumidityResolution(HDC1080::HumidityResolution::A_11BIT), + nullopt + ); } TEST_F(HDC1080_X_Test, setHeaterNormallySetsValue) { @@ -412,8 +456,14 @@ TEST_F(HDC1080_X_Test, setHeaterNormallySetsValue) { .WillOnce(Return(configInitialValueHeaterOff)); EXPECT_CALL(this->i2c, write).WillRepeatedly(ReturnArg<1>()); - EXPECT_EQ(this->hdc1080.setHeater(HDC1080::Heater::ON).value(), configInitialValueHeaterOn); - EXPECT_EQ(this->hdc1080.setHeater(HDC1080::Heater::OFF).value(), configInitialValueHeaterOff); + EXPECT_EQ( + this->hdc1080.setHeater(HDC1080::Heater::ON).value(), + configInitialValueHeaterOn + ); + EXPECT_EQ( + this->hdc1080.setHeater(HDC1080::Heater::OFF).value(), + configInitialValueHeaterOff + ); } TEST_F(HDC1080_X_Test, setHeaterReturnsEmptyOptionalWhenI2CFails) {