Update repo to conform to openbmc code standard
Change-Id: If1d6b1f04514367cc544c2507a845b3e9d6d3435
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/test/bus/match.cpp b/test/bus/match.cpp
index c69c76b..80bc259 100644
--- a/test/bus/match.cpp
+++ b/test/bus/match.cpp
@@ -4,41 +4,37 @@
class Match : public ::testing::Test
{
- protected:
- decltype(sdbusplus::bus::new_default()) bus =
- sdbusplus::bus::new_default();
+ protected:
+ decltype(sdbusplus::bus::new_default()) bus = sdbusplus::bus::new_default();
- static constexpr auto busName =
- "xyz.openbmc_project.sdbusplus.test.Match";
+ static constexpr auto busName = "xyz.openbmc_project.sdbusplus.test.Match";
+ static auto matchRule()
+ {
+ using namespace sdbusplus::bus::match::rules;
+ return nameOwnerChanged() + argN(0, busName);
+ }
- static auto matchRule()
+ void waitForIt(bool& triggered)
+ {
+ for (size_t i = 0; (i < 16) && !triggered; ++i)
{
- using namespace sdbusplus::bus::match::rules;
- return nameOwnerChanged() + argN(0, busName);
+ bus.wait(0);
+ bus.process_discard();
}
-
- void waitForIt(bool& triggered)
- {
- for (size_t i = 0; (i < 16) && !triggered; ++i)
- {
- bus.wait(0);
- bus.process_discard();
- }
- }
+ }
};
TEST_F(Match, FunctorIs_sd_bus_message_handler_t)
{
bool triggered = false;
- auto trigger = [](sd_bus_message *m, void* context, sd_bus_error* e)
- {
- *static_cast<bool*>(context) = true;
- return 0;
- };
+ auto trigger = [](sd_bus_message* m, void* context, sd_bus_error* e) {
+ *static_cast<bool*>(context) = true;
+ return 0;
+ };
sdbusplus::bus::match_t m{bus, matchRule(), trigger, &triggered};
- auto m2 = std::move(m); // ensure match is move-safe.
+ auto m2 = std::move(m); // ensure match is move-safe.
waitForIt(triggered);
ASSERT_FALSE(triggered);
@@ -52,13 +48,12 @@
TEST_F(Match, FunctorIs_LambdaTakingMessage)
{
bool triggered = false;
- auto trigger = [&triggered](sdbusplus::message::message& m)
- {
- triggered = true;
- };
+ auto trigger = [&triggered](sdbusplus::message::message& m) {
+ triggered = true;
+ };
sdbusplus::bus::match_t m{bus, matchRule(), trigger};
- auto m2 = std::move(m); // ensure match is move-safe.
+ auto m2 = std::move(m); // ensure match is move-safe.
waitForIt(triggered);
ASSERT_FALSE(triggered);
@@ -74,20 +69,20 @@
class BoolHolder
{
- public:
- bool triggered = false;
+ public:
+ bool triggered = false;
- void callback(sdbusplus::message::message& m)
- {
- triggered = true;
- }
+ void callback(sdbusplus::message::message& m)
+ {
+ triggered = true;
+ }
};
BoolHolder b;
sdbusplus::bus::match_t m{bus, matchRule(),
- std::bind(std::mem_fn(&BoolHolder::callback),
- &b, std::placeholders::_1)};
- auto m2 = std::move(m); // ensure match is move-safe.
+ std::bind(std::mem_fn(&BoolHolder::callback), &b,
+ std::placeholders::_1)};
+ auto m2 = std::move(m); // ensure match is move-safe.
waitForIt(b.triggered);
ASSERT_FALSE(b.triggered);