FruUtils: Fix code formatting
format-code didn't include an invocation of clang-format, and as the
in-repo format-code script overrides the default script in
openbmc-build-scripts there was no code-formatting being applied in CI.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I68bd7d2c930b752da4045412e7e286b303ac8ff6
diff --git a/test/test_fru-utils.cpp b/test/test_fru-utils.cpp
index 2984094..f37da0e 100644
--- a/test/test_fru-utils.cpp
+++ b/test/test_fru-utils.cpp
@@ -1,8 +1,8 @@
#include "FruUtils.hpp"
+#include <algorithm>
#include <array>
-#include<algorithm>
-#include<iterator>
+#include <iterator>
#include "gtest/gtest.h"
@@ -145,12 +145,10 @@
EXPECT_EQ(calculateChecksum(data), 255);
}
-int64_t getDataTempl(
- const std::vector<uint8_t>& data,
- [[maybe_unused]] int flag,
- [[maybe_unused]] int file,
- [[maybe_unused]] uint16_t address,
- uint16_t offset, uint8_t length, uint8_t* outBuf)
+int64_t getDataTempl(const std::vector<uint8_t>& data,
+ [[maybe_unused]] int flag, [[maybe_unused]] int file,
+ [[maybe_unused]] uint16_t address, uint16_t offset,
+ uint8_t length, uint8_t* outBuf)
{
if (offset >= data.size())
{
@@ -158,8 +156,7 @@
}
uint16_t idx;
- for (idx = offset;
- idx < data.size() && idx < offset + length;
+ for (idx = offset; idx < data.size() && idx < offset + length;
++idx, ++outBuf)
{
*outBuf = data[idx];
@@ -173,8 +170,9 @@
const std::vector<uint8_t> data = {255, 16};
uint16_t offset = 0;
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
- auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l,
- auto* b) { return getDataTempl(data, fl, fi, a, o, l, b); };
+ auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l, auto* b) {
+ return getDataTempl(data, fl, fi, a, o, l, b);
+ };
EXPECT_FALSE(findFRUHeader(0, 0, 0, getData, "error", blockData, offset));
}
@@ -184,20 +182,22 @@
const std::vector<uint8_t> data = {};
uint16_t offset = 0;
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
- auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l,
- auto* b) { return getDataTempl(data, fl, fi, a, o, l, b); };
+ auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l, auto* b) {
+ return getDataTempl(data, fl, fi, a, o, l, b);
+ };
EXPECT_FALSE(findFRUHeader(0, 0, 0, getData, "error", blockData, offset));
}
TEST(FindFRUHeaderTest, ValidHeader)
{
- const std::vector<uint8_t> data = {
- 0x01, 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0xf5};
+ const std::vector<uint8_t> data = {0x01, 0x00, 0x01, 0x02,
+ 0x03, 0x04, 0x00, 0xf5};
uint16_t offset = 0;
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
- auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l,
- auto* b) { return getDataTempl(data, fl, fi, a, o, l, b); };
+ auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l, auto* b) {
+ return getDataTempl(data, fl, fi, a, o, l, b);
+ };
EXPECT_TRUE(findFRUHeader(0, 0, 0, getData, "error", blockData, offset));
EXPECT_EQ(0, offset);
@@ -209,8 +209,9 @@
data.resize(0x6000 + I2C_SMBUS_BLOCK_MAX);
uint16_t offset = 0;
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
- auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l,
- auto* b) { return getDataTempl(data, fl, fi, a, o, l, b); };
+ auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l, auto* b) {
+ return getDataTempl(data, fl, fi, a, o, l, b);
+ };
EXPECT_FALSE(findFRUHeader(0, 0, 0, getData, "error", blockData, offset));
}
@@ -220,8 +221,9 @@
const std::vector<uint8_t> data = {'$', 'T', 'Y', 'A', 'N', '$', 0, 0};
uint16_t offset = 0;
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
- auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l,
- auto* b) { return getDataTempl(data, fl, fi, a, o, l, b); };
+ auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l, auto* b) {
+ return getDataTempl(data, fl, fi, a, o, l, b);
+ };
EXPECT_FALSE(findFRUHeader(0, 0, 0, getData, "error", blockData, offset));
}
@@ -236,8 +238,9 @@
uint16_t offset = 0;
std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
- auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l,
- auto* b) { return getDataTempl(data, fl, fi, a, o, l, b); };
+ auto getData = [&data](auto fl, auto fi, auto a, auto o, auto l, auto* b) {
+ return getDataTempl(data, fl, fi, a, o, l, b);
+ };
EXPECT_TRUE(findFRUHeader(0, 0, 0, getData, "error", blockData, offset));
EXPECT_EQ(0x6000, offset);