PEL: Support UserData padding in the testcases
Some testcase updates were missed when the fix was made to pad the
UserData section to 4 byte boundaries as required by the spec.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I8129a70cfd740155ca05089563dfc5d7e63bdc81
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index 9976c5c..afab5ca 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -265,9 +265,16 @@
const auto& d = ud->data();
std::string jsonString{d.begin(), d.end()};
- std::string expected =
+
+ std::string expectedJSON =
R"({"KEY1":"VALUE1","KEY2":"VALUE2","KEY3":"VALUE3"})";
- EXPECT_EQ(jsonString, expected);
+
+ // The actual data is null padded to a 4B boundary.
+ std::vector<uint8_t> expectedData;
+ expectedData.resize(52, '\0');
+ memcpy(expectedData.data(), expectedJSON.data(), expectedJSON.size());
+
+ EXPECT_EQ(d, expectedData);
// Ensure we can read this as JSON
auto newJSON = nlohmann::json::parse(jsonString);