summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-06-04 07:20:24 -0700
committerPatrick Venture <venture@google.com>2019-06-17 18:51:19 +0000
commit8bc117792fbf118dd74d015546c22612961ccc26 (patch)
tree561a4dbb372b4a8811ba66e8f8beac8da31bb6f1 /test
parenta67323a86ec201d9292d2743a707ac04909615e3 (diff)
downloadphosphor-ipmi-blobs-8bc117792fbf118dd74d015546c22612961ccc26.tar.gz
phosphor-ipmi-blobs-8bc117792fbf118dd74d015546c22612961ccc26.zip
blobs: s/struct BlobMeta/BlobMeta/g
Because this structure is not anything special, simply use the cpp idiomatic way of referencing the object. Consistently, structures that are packed still have "struct" used in declarations. However, this distinction is only clear through its usage and nothing in the language. Perhaps a better approach would be notational naming struct PackedXYZ {};. However, that can get out of control quickly. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I3b7e48e4b6687ef2e15e9d07c0eeba96eb5d2552
Diffstat (limited to 'test')
-rw-r--r--test/blob_mock.hpp4
-rw-r--r--test/ipmi_sessionstat_unittest.cpp14
-rw-r--r--test/ipmi_stat_unittest.cpp12
-rw-r--r--test/manager_mock.hpp4
-rw-r--r--test/manager_sessionstat_unittest.cpp6
-rw-r--r--test/manager_stat_unittest.cpp6
6 files changed, 23 insertions, 23 deletions
diff --git a/test/blob_mock.hpp b/test/blob_mock.hpp
index b70d3d1..7ec7d15 100644
--- a/test/blob_mock.hpp
+++ b/test/blob_mock.hpp
@@ -15,7 +15,7 @@ class BlobMock : public GenericBlobInterface
MOCK_METHOD1(canHandleBlob, bool(const std::string&));
MOCK_METHOD0(getBlobIds, std::vector<std::string>());
MOCK_METHOD1(deleteBlob, bool(const std::string&));
- MOCK_METHOD2(stat, bool(const std::string&, struct BlobMeta*));
+ MOCK_METHOD2(stat, bool(const std::string&, BlobMeta*));
MOCK_METHOD3(open, bool(uint16_t, uint16_t, const std::string&));
MOCK_METHOD3(read, std::vector<uint8_t>(uint16_t, uint32_t, uint32_t));
MOCK_METHOD3(write, bool(uint16_t, uint32_t, const std::vector<uint8_t>&));
@@ -23,7 +23,7 @@ class BlobMock : public GenericBlobInterface
bool(uint16_t, uint32_t, const std::vector<uint8_t>&));
MOCK_METHOD2(commit, bool(uint16_t, const std::vector<uint8_t>&));
MOCK_METHOD1(close, bool(uint16_t));
- MOCK_METHOD2(stat, bool(uint16_t, struct BlobMeta*));
+ MOCK_METHOD2(stat, bool(uint16_t, BlobMeta*));
MOCK_METHOD1(expire, bool(uint16_t));
};
} // namespace blobs
diff --git a/test/ipmi_sessionstat_unittest.cpp b/test/ipmi_sessionstat_unittest.cpp
index 875b6a8..2f407a1 100644
--- a/test/ipmi_sessionstat_unittest.cpp
+++ b/test/ipmi_sessionstat_unittest.cpp
@@ -33,8 +33,8 @@ TEST(BlobSessionStatTest, RequestRejectedByManagerReturnsFailure)
dataLen = sizeof(struct BmcBlobSessionStatTx);
- EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req->sessionId),
- Matcher<struct BlobMeta*>(_)))
+ EXPECT_CALL(mgr,
+ stat(Matcher<uint16_t>(req->sessionId), Matcher<BlobMeta*>(_)))
.WillOnce(Return(false));
EXPECT_EQ(IPMI_CC_UNSPECIFIED_ERROR,
@@ -63,8 +63,8 @@ TEST(BlobSessionStatTest, RequestSucceedsNoMetadata)
rep.metadataLen = 0x00;
EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req->sessionId),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](uint16_t session, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](uint16_t session, BlobMeta* meta) {
meta->blobState = rep.blobState;
meta->size = rep.size;
return true;
@@ -91,7 +91,7 @@ TEST(BlobSessionStatTest, RequestSucceedsWithMetadata)
dataLen = sizeof(struct BmcBlobSessionStatTx);
- struct BlobMeta lmeta;
+ BlobMeta lmeta;
lmeta.blobState = 0x01;
lmeta.size = 0x100;
lmeta.metadata.push_back(0x01);
@@ -106,8 +106,8 @@ TEST(BlobSessionStatTest, RequestSucceedsWithMetadata)
rep.metadataLen = lmeta.metadata.size();
EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req->sessionId),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](uint16_t session, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](uint16_t session, BlobMeta* meta) {
(*meta) = lmeta;
return true;
}));
diff --git a/test/ipmi_stat_unittest.cpp b/test/ipmi_stat_unittest.cpp
index b4f542d..5002e69 100644
--- a/test/ipmi_stat_unittest.cpp
+++ b/test/ipmi_stat_unittest.cpp
@@ -63,7 +63,7 @@ TEST(BlobStatTest, RequestRejectedReturnsFailure)
dataLen = sizeof(struct BmcBlobStatTx) + blobId.length() + 1;
EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
- Matcher<struct BlobMeta*>(_)))
+ Matcher<BlobMeta*>(_)))
.WillOnce(Return(false));
EXPECT_EQ(IPMI_CC_UNSPECIFIED_ERROR,
@@ -96,8 +96,8 @@ TEST(BlobStatTest, RequestSucceedsNoMetadata)
rep.metadataLen = 0x00;
EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](const std::string& path, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](const std::string& path, BlobMeta* meta) {
meta->blobState = rep.blobState;
meta->size = rep.size;
return true;
@@ -128,7 +128,7 @@ TEST(BlobStatTest, RequestSucceedsWithMetadata)
dataLen = sizeof(struct BmcBlobStatTx) + blobId.length() + 1;
- struct BlobMeta lmeta;
+ BlobMeta lmeta;
lmeta.blobState = 0x01;
lmeta.size = 0x100;
lmeta.metadata.push_back(0x01);
@@ -143,8 +143,8 @@ TEST(BlobStatTest, RequestSucceedsWithMetadata)
rep.metadataLen = lmeta.metadata.size();
EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](const std::string& path, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](const std::string& path, BlobMeta* meta) {
(*meta) = lmeta;
return true;
}));
diff --git a/test/manager_mock.hpp b/test/manager_mock.hpp
index 73d4d07..bfb3348 100644
--- a/test/manager_mock.hpp
+++ b/test/manager_mock.hpp
@@ -20,8 +20,8 @@ class ManagerMock : public ManagerInterface
MOCK_METHOD0(buildBlobList, uint32_t());
MOCK_METHOD1(getBlobId, std::string(uint32_t));
MOCK_METHOD3(open, bool(uint16_t, const std::string&, uint16_t*));
- MOCK_METHOD2(stat, bool(const std::string&, struct BlobMeta*));
- MOCK_METHOD2(stat, bool(uint16_t, struct BlobMeta*));
+ MOCK_METHOD2(stat, bool(const std::string&, BlobMeta*));
+ MOCK_METHOD2(stat, bool(uint16_t, BlobMeta*));
MOCK_METHOD2(commit, bool(uint16_t, const std::vector<uint8_t>&));
MOCK_METHOD1(close, bool(uint16_t));
MOCK_METHOD3(read, std::vector<uint8_t>(uint16_t, uint32_t, uint32_t));
diff --git a/test/manager_sessionstat_unittest.cpp b/test/manager_sessionstat_unittest.cpp
index 6ae27d3..015a079 100644
--- a/test/manager_sessionstat_unittest.cpp
+++ b/test/manager_sessionstat_unittest.cpp
@@ -14,7 +14,7 @@ TEST(ManagerSessionStatTest, StatNoSessionReturnsFalse)
// Calling Stat on a session that doesn't exist should return false.
BlobManager mgr;
- struct BlobMeta meta;
+ BlobMeta meta;
uint16_t sess = 1;
EXPECT_FALSE(mgr.stat(sess, &meta));
@@ -36,7 +36,7 @@ TEST(ManagerSessionStatTest, StatSessionFoundButHandlerReturnsFalse)
EXPECT_CALL(*m1ptr, open(_, flags, path)).WillOnce(Return(true));
EXPECT_TRUE(mgr.open(flags, path, &sess));
- struct BlobMeta meta;
+ BlobMeta meta;
EXPECT_CALL(*m1ptr, stat(sess, &meta)).WillOnce(Return(false));
EXPECT_FALSE(mgr.stat(sess, &meta));
@@ -58,7 +58,7 @@ TEST(ManagerSessionStatTest, StatSessionFoundAndHandlerReturnsSuccess)
EXPECT_CALL(*m1ptr, open(_, flags, path)).WillOnce(Return(true));
EXPECT_TRUE(mgr.open(flags, path, &sess));
- struct BlobMeta meta;
+ BlobMeta meta;
EXPECT_CALL(*m1ptr, stat(sess, &meta)).WillOnce(Return(true));
EXPECT_TRUE(mgr.stat(sess, &meta));
diff --git a/test/manager_stat_unittest.cpp b/test/manager_stat_unittest.cpp
index a13a66d..4f66278 100644
--- a/test/manager_stat_unittest.cpp
+++ b/test/manager_stat_unittest.cpp
@@ -17,7 +17,7 @@ TEST(ManagerStatTest, StatNoHandler)
auto m1ptr = m1.get();
EXPECT_TRUE(mgr.registerHandler(std::move(m1)));
- struct BlobMeta meta;
+ BlobMeta meta;
std::string path = "/asdf/asdf";
EXPECT_CALL(*m1ptr, canHandleBlob(path)).WillOnce(Return(false));
@@ -33,7 +33,7 @@ TEST(ManagerStatTest, StatHandlerFoundButFails)
auto m1ptr = m1.get();
EXPECT_TRUE(mgr.registerHandler(std::move(m1)));
- struct BlobMeta meta;
+ BlobMeta meta;
std::string path = "/asdf/asdf";
EXPECT_CALL(*m1ptr, canHandleBlob(path)).WillOnce(Return(true));
EXPECT_CALL(*m1ptr, stat(path, &meta)).WillOnce(Return(false));
@@ -50,7 +50,7 @@ TEST(ManagerStatTest, StatHandlerFoundAndSucceeds)
auto m1ptr = m1.get();
EXPECT_TRUE(mgr.registerHandler(std::move(m1)));
- struct BlobMeta meta;
+ BlobMeta meta;
std::string path = "/asdf/asdf";
EXPECT_CALL(*m1ptr, canHandleBlob(path)).WillOnce(Return(true));
EXPECT_CALL(*m1ptr, stat(path, &meta)).WillOnce(Return(true));
OpenPOWER on IntegriCloud