summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-12-18 13:45:05 -0600
committerMatt Spinler <spinler@us.ibm.com>2020-02-14 19:15:42 +0000
commit7ae2fa69f2bd15cbd22be54aeefbb49d3ad06fc5 (patch)
tree833e3a29e9fe024b618b88b4fa4b44ecd6265b9e /test
parent6aae6a0caee074b65f4eb935677f207bf9acb841 (diff)
downloadphosphor-logging-7ae2fa69f2bd15cbd22be54aeefbb49d3ad06fc5.tar.gz
phosphor-logging-7ae2fa69f2bd15cbd22be54aeefbb49d3ad06fc5.zip
PEL: Allow adding to AdditionalData
Add an interface to add a key/value pair to the data stored in the AdditionalData class. Also add an interface to get to the raw underlying map of data. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I61200f92b45be8e86992d3f4888698d6a5bbe251
Diffstat (limited to 'test')
-rw-r--r--test/openpower-pels/additional_data_test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/openpower-pels/additional_data_test.cpp b/test/openpower-pels/additional_data_test.cpp
index f3f9824..c93fdf2 100644
--- a/test/openpower-pels/additional_data_test.cpp
+++ b/test/openpower-pels/additional_data_test.cpp
@@ -47,3 +47,19 @@ TEST(AdditionalDataTest, GetKeywords)
ad.remove("KEY1");
EXPECT_FALSE(ad.getValue("KEY1"));
}
+
+TEST(AdditionalDataTest, AddData)
+{
+ AdditionalData ad;
+
+ ad.add("KEY1", "VALUE1");
+ EXPECT_EQ(*(ad.getValue("KEY1")), "VALUE1");
+
+ ad.add("KEY2", "VALUE2");
+ EXPECT_EQ(*(ad.getValue("KEY2")), "VALUE2");
+
+ std::map<std::string, std::string> expected{{"KEY1", "VALUE1"},
+ {"KEY2", "VALUE2"}};
+
+ EXPECT_EQ(expected, ad.getData());
+}
OpenPOWER on IntegriCloud