summaryrefslogtreecommitdiffstats
path: root/test/openpower-pels/private_header_test.cpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-10-29 11:34:03 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-11-04 16:18:29 -0600
commit97d19b4806101161c5a97c1cc4daab6b95c89984 (patch)
tree4205a872c25082902a25cec74524aae58b7cf7de /test/openpower-pels/private_header_test.cpp
parentda031717543b48a75e193d5e4d846a80279ca90b (diff)
downloadphosphor-logging-97d19b4806101161c5a97c1cc4daab6b95c89984.tar.gz
phosphor-logging-97d19b4806101161c5a97c1cc4daab6b95c89984.zip
PEL: Const accessors for Private/UserHeader
Change the combined non-const accessor/setter functions for the PrivateHeader and UserHeader fields to the standard const accessors, and have separate setters for the fields that need to be modified. In addition, make the 'get PrivateHeader' and 'get UserHeader' functions on the PEL class return a const reference. This allows const enforcement on the PEL class, for things like: void func(const PEL& pel) { auto id = pel.privateHeader().id(); } Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I840170e72b41e9e2465f716617500269244de6d9
Diffstat (limited to 'test/openpower-pels/private_header_test.cpp')
-rw-r--r--test/openpower-pels/private_header_test.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/openpower-pels/private_header_test.cpp b/test/openpower-pels/private_header_test.cpp
index 07746b3..4eb052b 100644
--- a/test/openpower-pels/private_header_test.cpp
+++ b/test/openpower-pels/private_header_test.cpp
@@ -28,7 +28,7 @@ TEST_F(PrivateHeaderTest, UnflattenFlattenTest)
EXPECT_EQ(ph.header().subType, 0x02);
EXPECT_EQ(ph.header().componentID, 0x0304);
- auto& ct = ph.createTimestamp();
+ auto ct = ph.createTimestamp();
EXPECT_EQ(ct.yearMSB, 0x20);
EXPECT_EQ(ct.yearLSB, 0x30);
EXPECT_EQ(ct.month, 0x05);
@@ -38,7 +38,7 @@ TEST_F(PrivateHeaderTest, UnflattenFlattenTest)
EXPECT_EQ(ct.seconds, 0x01);
EXPECT_EQ(ct.hundredths, 0x63);
- auto& mt = ph.commitTimestamp();
+ auto mt = ph.commitTimestamp();
EXPECT_EQ(mt.yearMSB, 0x20);
EXPECT_EQ(mt.yearLSB, 0x31);
EXPECT_EQ(mt.month, 0x06);
@@ -68,7 +68,7 @@ TEST_F(PrivateHeaderTest, UnflattenFlattenTest)
EXPECT_EQ(data, newData);
// Change a field, then flatten and unflatten again
- ph.creatorID() = 0x55;
+ ph.setID(0x55);
newStream.offset(0);
newData.clear();
@@ -79,7 +79,7 @@ TEST_F(PrivateHeaderTest, UnflattenFlattenTest)
PrivateHeader newPH(newStream);
EXPECT_TRUE(newPH.valid());
- EXPECT_EQ(newPH.creatorID(), 0x55);
+ EXPECT_EQ(newPH.id(), 0x55);
}
TEST_F(PrivateHeaderTest, ShortDataTest)
OpenPOWER on IntegriCloud