diff options
Diffstat (limited to 'messagebus/src/tests/simpleprotocol/simpleprotocol.cpp')
-rw-r--r-- | messagebus/src/tests/simpleprotocol/simpleprotocol.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp b/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp index 715ef597767..bc4fc80abad 100644 --- a/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp +++ b/messagebus/src/tests/simpleprotocol/simpleprotocol.cpp @@ -6,9 +6,7 @@ #include <vespa/messagebus/testlib/simplereply.h> #include <vespa/messagebus/testlib/slobrok.h> #include <vespa/messagebus/testlib/testserver.h> -#include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/ireplyhandler.h> -#include <vespa/messagebus/network/identity.h> #include <vespa/messagebus/routing/routingcontext.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/component/vtag.h> @@ -29,12 +27,15 @@ Test::Main() { // test protocol IRoutingPolicy::UP bogus = protocol.createPolicy("bogus", ""); - EXPECT_TRUE(bogus.get() == 0); + EXPECT_FALSE(bogus); } TEST_FLUSH(); { // test SimpleMessage - Message::UP msg(new SimpleMessage("test")); + EXPECT_EQUAL(56u, sizeof(Routable)); + EXPECT_EQUAL(104u, sizeof(Message)); + EXPECT_EQUAL(184u, sizeof(SimpleMessage)); + auto msg = std::make_unique<SimpleMessage>("test"); EXPECT_TRUE(!msg->isReply()); EXPECT_TRUE(msg->getProtocol() == SimpleProtocol::NAME); EXPECT_TRUE(msg->getType() == SimpleProtocol::MESSAGE); @@ -42,7 +43,7 @@ Test::Main() Blob b = protocol.encode(version, *msg); EXPECT_TRUE(b.size() > 0); Routable::UP tmp = protocol.decode(version, BlobRef(b)); - ASSERT_TRUE(tmp.get() != 0); + ASSERT_TRUE(tmp); EXPECT_TRUE(!tmp->isReply()); EXPECT_TRUE(tmp->getProtocol() == SimpleProtocol::NAME); EXPECT_TRUE(tmp->getType() == SimpleProtocol::MESSAGE); @@ -51,7 +52,10 @@ Test::Main() TEST_FLUSH(); { // test SimpleReply - Reply::UP reply(new SimpleReply("reply")); + EXPECT_EQUAL(56u, sizeof(Routable)); + EXPECT_EQUAL(96u, sizeof(Reply)); + EXPECT_EQUAL(160u, sizeof(SimpleReply)); + auto reply = std::make_unique<SimpleReply>("reply"); EXPECT_TRUE(reply->isReply()); EXPECT_TRUE(reply->getProtocol() == SimpleProtocol::NAME); EXPECT_TRUE(reply->getType() == SimpleProtocol::REPLY); @@ -59,7 +63,7 @@ Test::Main() Blob b = protocol.encode(version, *reply); EXPECT_TRUE(b.size() > 0); Routable::UP tmp = protocol.decode(version, BlobRef(b)); - ASSERT_TRUE(tmp.get() != 0); + ASSERT_TRUE(tmp); EXPECT_TRUE(tmp->isReply()); EXPECT_TRUE(tmp->getProtocol() == SimpleProtocol::NAME); EXPECT_TRUE(tmp->getType() == SimpleProtocol::REPLY); |