forked from Kistler-Group/sdbus-cpp
refactor: improve and make more efficient some Message API (#432)
This commit is contained in:
@@ -44,6 +44,7 @@ using ::testing::ElementsAre;
|
||||
using ::testing::Eq;
|
||||
using namespace std::chrono_literals;
|
||||
using namespace sdbus::test;
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
using ADirectConnection = TestFixtureWithDirectConnection;
|
||||
|
||||
@@ -157,7 +158,7 @@ TYPED_TEST(AConnection, WillNotPassToMatchCallbackMessagesThatDoNotMatchTheRule)
|
||||
std::atomic<size_t> numberOfMatchingMessages{};
|
||||
auto slot = this->s_proxyConnection->addMatch(matchRule, [&](sdbus::Message msg)
|
||||
{
|
||||
if(msg.getMemberName() == "simpleSignal")
|
||||
if(msg.getMemberName() == "simpleSignal"sv)
|
||||
numberOfMatchingMessages++;
|
||||
});
|
||||
auto adaptor2 = std::make_unique<TestAdaptor>(*this->s_adaptorConnection, OBJECT_PATH_2);
|
||||
|
||||
@@ -32,8 +32,10 @@
|
||||
#include <list>
|
||||
|
||||
using ::testing::Eq;
|
||||
using ::testing::StrEq;
|
||||
using ::testing::Gt;
|
||||
using ::testing::DoubleEq;
|
||||
using ::testing::IsNull;
|
||||
using namespace std::string_literals;
|
||||
|
||||
namespace
|
||||
@@ -465,11 +467,10 @@ TEST(AMessage, CanPeekASimpleType)
|
||||
msg << 123;
|
||||
msg.seal();
|
||||
|
||||
std::string type;
|
||||
std::string contents;
|
||||
msg.peekType(type, contents);
|
||||
ASSERT_THAT(type, "i");
|
||||
ASSERT_THAT(contents, "");
|
||||
auto [type, contents] = msg.peekType();
|
||||
|
||||
ASSERT_THAT(type, Eq('i'));
|
||||
ASSERT_THAT(contents, IsNull());
|
||||
}
|
||||
|
||||
TEST(AMessage, CanPeekContainerContents)
|
||||
@@ -478,11 +479,10 @@ TEST(AMessage, CanPeekContainerContents)
|
||||
msg << std::map<int, std::string>{{1, "one"}, {2, "two"}};
|
||||
msg.seal();
|
||||
|
||||
std::string type;
|
||||
std::string contents;
|
||||
msg.peekType(type, contents);
|
||||
ASSERT_THAT(type, "a");
|
||||
ASSERT_THAT(contents, "{is}");
|
||||
auto [type, contents] = msg.peekType();
|
||||
|
||||
ASSERT_THAT(type, Eq('a'));
|
||||
ASSERT_THAT(contents, StrEq("{is}"));
|
||||
}
|
||||
|
||||
TEST(AMessage, CanCarryDBusArrayGivenAsCustomType)
|
||||
|
||||
Reference in New Issue
Block a user