summaryrefslogtreecommitdiffstats
path: root/src/test/propertywatchtest.cpp
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-29 10:34:05 -0400
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-29 10:34:46 -0400
commitd1eac88d18ae7dd11033dba87b6aebb220da9064 (patch)
tree9744e38138ff853c53868d847f86e9ad58e9ac66 /src/test/propertywatchtest.cpp
parent1abcb06bedadfbd40b4ec6f7e5f6a95021df3c96 (diff)
downloadphosphor-dbus-monitor-d1eac88d18ae7dd11033dba87b6aebb220da9064.tar.gz
phosphor-dbus-monitor-d1eac88d18ae7dd11033dba87b6aebb220da9064.zip
Enable clang-format
Fix up errors and enable clang-format during CI builds. Change-Id: I4176b81f8b85a287af9354165e09ff66aeb9fb29 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'src/test/propertywatchtest.cpp')
-rw-r--r--src/test/propertywatchtest.cpp134
1 files changed, 49 insertions, 85 deletions
diff --git a/src/test/propertywatchtest.cpp b/src/test/propertywatchtest.cpp
index c97e8d3..6576bfd 100644
--- a/src/test/propertywatchtest.cpp
+++ b/src/test/propertywatchtest.cpp
@@ -5,75 +5,56 @@
using namespace std::string_literals;
using namespace phosphor::dbus::monitoring;
-const std::array<std::string, 4> paths =
-{
+const std::array<std::string, 4> paths = {
"/xyz/openbmc_project/testing/inst1"s,
"/xyz/openbmc_project/testing/inst2"s,
"/xyz/openbmc_project/testing/inst3"s,
"/xyz/openbmc_project/testing/inst4"s,
};
-const std::array<std::string, 2> interfaces =
-{
+const std::array<std::string, 2> interfaces = {
"xyz.openbmc_project.Iface1"s,
"xyz.openbmc_project.Iface2"s,
};
-const std::array<std::string, 2> properties =
-{
+const std::array<std::string, 2> properties = {
"Value1"s,
"Value2"s,
};
const std::string meta;
-std::array<std::tuple<any_ns::any, any_ns::any>, 8> storage = { };
+std::array<std::tuple<any_ns::any, any_ns::any>, 8> storage = {};
-const PropertyIndex watchIndex =
-{
+const PropertyIndex watchIndex = {
{
- {
- PropertyIndex::key_type{paths[0], interfaces[0], properties[0]},
- PropertyIndex::mapped_type{meta, meta, storage[0]}
- },
- {
- PropertyIndex::key_type{paths[0], interfaces[1], properties[1]},
- PropertyIndex::mapped_type{meta, meta, storage[1]}
- },
- {
- PropertyIndex::key_type{paths[1], interfaces[0], properties[0]},
- PropertyIndex::mapped_type{meta, meta, storage[2]}
- },
- {
- PropertyIndex::key_type{paths[1], interfaces[1], properties[1]},
- PropertyIndex::mapped_type{meta, meta, storage[3]}
- },
- {
- PropertyIndex::key_type{paths[2], interfaces[0], properties[0]},
- PropertyIndex::mapped_type{meta, meta, storage[4]}
- },
- {
- PropertyIndex::key_type{paths[2], interfaces[1], properties[1]},
- PropertyIndex::mapped_type{meta, meta, storage[5]}
- },
- {
- PropertyIndex::key_type{paths[3], interfaces[0], properties[0]},
- PropertyIndex::mapped_type{meta, meta, storage[6]}
- },
- {
- PropertyIndex::key_type{paths[3], interfaces[1], properties[1]},
- PropertyIndex::mapped_type{meta, meta, storage[7]}
- },
+ {PropertyIndex::key_type{paths[0], interfaces[0], properties[0]},
+ PropertyIndex::mapped_type{meta, meta, storage[0]}},
+ {PropertyIndex::key_type{paths[0], interfaces[1], properties[1]},
+ PropertyIndex::mapped_type{meta, meta, storage[1]}},
+ {PropertyIndex::key_type{paths[1], interfaces[0], properties[0]},
+ PropertyIndex::mapped_type{meta, meta, storage[2]}},
+ {PropertyIndex::key_type{paths[1], interfaces[1], properties[1]},
+ PropertyIndex::mapped_type{meta, meta, storage[3]}},
+ {PropertyIndex::key_type{paths[2], interfaces[0], properties[0]},
+ PropertyIndex::mapped_type{meta, meta, storage[4]}},
+ {PropertyIndex::key_type{paths[2], interfaces[1], properties[1]},
+ PropertyIndex::mapped_type{meta, meta, storage[5]}},
+ {PropertyIndex::key_type{paths[3], interfaces[0], properties[0]},
+ PropertyIndex::mapped_type{meta, meta, storage[6]}},
+ {PropertyIndex::key_type{paths[3], interfaces[1], properties[1]},
+ PropertyIndex::mapped_type{meta, meta, storage[7]}},
},
};
-template <typename T> struct ExpectedValues {};
+template <typename T> struct ExpectedValues
+{
+};
template <> struct ExpectedValues<uint8_t>
{
static auto& get(size_t i)
{
- static const std::array<uint8_t, 8> values =
- {
+ static const std::array<uint8_t, 8> values = {
{0, 1, 2, 3, 4, 5, 6, 7},
};
return values[i];
@@ -84,8 +65,7 @@ template <> struct ExpectedValues<uint16_t>
{
static auto& get(size_t i)
{
- static const std::array<uint16_t, 8> values =
- {
+ static const std::array<uint16_t, 8> values = {
{88, 77, 66, 55, 44, 33, 22, 11},
};
return values[i];
@@ -96,8 +76,7 @@ template <> struct ExpectedValues<uint32_t>
{
static auto& get(size_t i)
{
- static const std::array<uint32_t, 8> values =
- {
+ static const std::array<uint32_t, 8> values = {
{0xffffffff, 1, 3, 0, 5, 7, 9, 0xffffffff},
};
return values[i];
@@ -108,8 +87,7 @@ template <> struct ExpectedValues<uint64_t>
{
static auto& get(size_t i)
{
- static const std::array<uint64_t, 8> values =
- {
+ static const std::array<uint64_t, 8> values = {
{0xffffffffffffffff, 3, 7, 12234, 0, 3, 9, 0xffffffff},
};
return values[i];
@@ -120,16 +98,14 @@ template <> struct ExpectedValues<std::string>
{
static auto& get(size_t i)
{
- static const std::array<std::string, 8> values =
- {
+ static const std::array<std::string, 8> values = {
{""s, "foo"s, "bar"s, "baz"s, "hello"s, "string", "\x2\x3", "\\"},
};
return values[i];
}
};
-template <typename T>
-void testStart()
+template <typename T> void testStart()
{
using ::testing::Return;
using ::testing::_;
@@ -146,34 +122,22 @@ void testStart()
const auto& path = o.first.get();
const auto& interfaces = o.second;
std::vector<std::string> mapperResponse;
- std::transform(
- interfaces.begin(),
- interfaces.end(),
- std::back_inserter(mapperResponse),
- // *INDENT-OFF*
- [](const auto & item)
- {
- return item.first;
- });
+ std::transform(interfaces.begin(), interfaces.end(),
+ std::back_inserter(mapperResponse),
+ // *INDENT-OFF*
+ [](const auto& item) { return item.first; });
// *INDENT-ON*
+ EXPECT_CALL(dbus, mapperGetObject(MAPPER_BUSNAME, MAPPER_PATH,
+ MAPPER_INTERFACE, "GetObject", path,
+ expectedMapperInterfaces))
+ .WillOnce(Return(GetObject({{"", mapperResponse}})));
EXPECT_CALL(
- dbus,
- mapperGetObject(
- MAPPER_BUSNAME,
- MAPPER_PATH,
- MAPPER_INTERFACE,
- "GetObject",
- path,
- expectedMapperInterfaces))
- .WillOnce(Return(GetObject({{"", mapperResponse}})));
- EXPECT_CALL(
- dbus,
- fwdAddMatch(
- sdbusplus::bus::match::rules::member("InterfacesAdded") +
- sdbusplus::bus::match::rules::path(path) +
- sdbusplus::bus::match::rules::interface(
- "org.freedesktop.DBus.ObjectManager"),
- _));
+ dbus, fwdAddMatch(
+ sdbusplus::bus::match::rules::member("InterfacesAdded") +
+ sdbusplus::bus::match::rules::path(path) +
+ sdbusplus::bus::match::rules::interface(
+ "org.freedesktop.DBus.ObjectManager"),
+ _));
for (const auto& i : interfaces)
{
const auto& interface = i.first.get();
@@ -182,10 +146,10 @@ void testStart()
dbus,
fwdAddMatch(
sdbusplus::bus::match::rules::member("PropertiesChanged") +
- sdbusplus::bus::match::rules::path(path) +
- sdbusplus::bus::match::rules::argN(0, interface) +
- sdbusplus::bus::match::rules::interface(
- "org.freedesktop.DBus.Properties"),
+ sdbusplus::bus::match::rules::path(path) +
+ sdbusplus::bus::match::rules::argN(0, interface) +
+ sdbusplus::bus::match::rules::interface(
+ "org.freedesktop.DBus.Properties"),
_));
PropertiesChanged<T> serviceResponse;
@@ -195,7 +159,7 @@ void testStart()
++ndx;
}
Expect<T>::getProperties(dbus, path, interface)
- .WillOnce(Return(serviceResponse));
+ .WillOnce(Return(serviceResponse));
}
}
OpenPOWER on IntegriCloud