diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-23 19:54:57 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-23 19:54:57 +0000 |
commit | 45ef55eb4c13ed89391b4c61f81c719fc4f2033a (patch) | |
tree | 03f6bd5476689e6fb921213fe49addac06073014 /documentapi/src/tests | |
parent | 66445f857b81b051c1572409ce19d032cb03024c (diff) |
- Reorder members for compactness.
- Avoid needing the definition of Error everywhere.
- use std::make_xxx and other c++11 constructs.
Diffstat (limited to 'documentapi/src/tests')
-rw-r--r-- | documentapi/src/tests/messages/messages60test.cpp | 11 | ||||
-rw-r--r-- | documentapi/src/tests/replymerger/replymerger_test.cpp | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/documentapi/src/tests/messages/messages60test.cpp b/documentapi/src/tests/messages/messages60test.cpp index c7bb1015e02..8b895fb2b59 100644 --- a/documentapi/src/tests/messages/messages60test.cpp +++ b/documentapi/src/tests/messages/messages60test.cpp @@ -323,6 +323,7 @@ Messages60Test::testGetDocumentMessage() { GetDocumentMessage tmp(document::DocumentId("id:ns:testdoc::"), "foo bar"); + EXPECT_EQUAL(360u, sizeof(GetDocumentMessage)); EXPECT_EQUAL(MESSAGE_BASE_LENGTH + (size_t)31, serialize("GetDocumentMessage", tmp)); for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { @@ -400,6 +401,7 @@ Messages60Test::testPutDocumentMessage() msg.setTimestamp(666); msg.setCondition(TestAndSetCondition("There's just one condition")); + EXPECT_EQUAL(280u, sizeof(PutDocumentMessage)); EXPECT_EQUAL(MESSAGE_BASE_LENGTH + 45u + serializedLength(msg.getCondition().getSelection()), @@ -447,6 +449,7 @@ Messages60Test::testPutDocumentReply() reply.setHighestModificationTimestamp(30); EXPECT_EQUAL(13u, serialize("PutDocumentReply", reply)); + EXPECT_EQUAL(112u, sizeof(WriteDocumentReply)); for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { mbus::Routable::UP obj = deserialize("PutDocumentReply", DocumentProtocol::REPLY_PUTDOCUMENT, lang); @@ -466,6 +469,7 @@ Messages60Test::testUpdateDocumentReply() reply.setHighestModificationTimestamp(30); EXPECT_EQUAL(14u, serialize("UpdateDocumentReply", reply)); + EXPECT_EQUAL(120u, sizeof(UpdateDocumentReply)); for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { mbus::Routable::UP obj = deserialize("UpdateDocumentReply", DocumentProtocol::REPLY_UPDATEDOCUMENT, lang); @@ -485,12 +489,13 @@ Messages60Test::testRemoveDocumentMessage() msg.setCondition(TestAndSetCondition("There's just one condition")); + EXPECT_EQUAL(360u, sizeof(RemoveDocumentMessage)); EXPECT_EQUAL(MESSAGE_BASE_LENGTH + size_t(20) + serializedLength(msg.getCondition().getSelection()), serialize("RemoveDocumentMessage", msg)); for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { auto routablePtr = deserialize("RemoveDocumentMessage", DocumentProtocol::MESSAGE_REMOVEDOCUMENT, lang); - if (EXPECT_TRUE(routablePtr.get() != nullptr)) { + if (EXPECT_TRUE(routablePtr)) { auto & ref = static_cast<RemoveDocumentMessage &>(*routablePtr); EXPECT_EQUAL(string("id:ns:testdoc::"), ref.getDocumentId().toString()); EXPECT_EQUAL(msg.getCondition().getSelection(), ref.getCondition().getSelection()); @@ -506,6 +511,7 @@ Messages60Test::testRemoveDocumentReply() std::vector<uint64_t> ts; reply.setWasFound(false); reply.setHighestModificationTimestamp(30); + EXPECT_EQUAL(120u, sizeof(RemoveDocumentReply)); EXPECT_EQUAL(14u, serialize("RemoveDocumentReply", reply)); @@ -663,12 +669,13 @@ Messages60Test::testUpdateDocumentMessage() msg.setNewTimestamp(777u); msg.setCondition(TestAndSetCondition("There's just one condition")); + EXPECT_EQUAL(288u, sizeof(UpdateDocumentMessage)); EXPECT_EQUAL(MESSAGE_BASE_LENGTH + 93u + serializedLength(msg.getCondition().getSelection()), serialize("UpdateDocumentMessage", msg)); for (uint32_t lang = 0; lang < NUM_LANGUAGES; ++lang) { auto routableUp = deserialize("UpdateDocumentMessage", DocumentProtocol::MESSAGE_UPDATEDOCUMENT, lang); - if (EXPECT_TRUE(routableUp.get() != nullptr)) { + if (EXPECT_TRUE(routableUp)) { auto & deserializedMsg = static_cast<UpdateDocumentMessage &>(*routableUp); EXPECT_EQUAL(msg.getDocumentUpdate(), deserializedMsg.getDocumentUpdate()); EXPECT_EQUAL(msg.getOldTimestamp(), deserializedMsg.getOldTimestamp()); diff --git a/documentapi/src/tests/replymerger/replymerger_test.cpp b/documentapi/src/tests/replymerger/replymerger_test.cpp index 4626ccd0a60..f74ad23da1d 100644 --- a/documentapi/src/tests/replymerger/replymerger_test.cpp +++ b/documentapi/src/tests/replymerger/replymerger_test.cpp @@ -8,6 +8,7 @@ #include <vespa/documentapi/messagebus/messages/updatedocumentreply.h> #include <vespa/documentapi/messagebus/messages/getdocumentreply.h> #include <vespa/messagebus/emptyreply.h> +#include <vespa/messagebus/error.h> using namespace documentapi; |