Error code for encodeKeyword API
This commit updates encodeKeyword APIs to set error code in case of
error. This helps the caller of API to take action based on the error
code returned from the API.
Change-Id: I0cba6191d2ec6ded8e793514086f3e62218cf893
Signed-off-by: Rekha Aparna <vrekhaaparna@ibm.com>
diff --git a/test/utest_utils.cpp b/test/utest_utils.cpp
index 6511dcb..aec7c7b 100644
--- a/test/utest_utils.cpp
+++ b/test/utest_utils.cpp
@@ -1,3 +1,5 @@
+#include "utility/common_utility.hpp"
+
#include <utility/vpd_specific_utility.hpp>
#include <cassert>
@@ -9,10 +11,18 @@
TEST(UtilsTest, TestValidValue)
{
+ uint16_t l_errCode = 0;
std::string key = "VINI";
std::string encoding = "MAC";
std::string expected = "56:49:4e:49";
- EXPECT_EQ(expected, vpdSpecificUtility::encodeKeyword(key, encoding));
+ EXPECT_EQ(expected,
+ vpdSpecificUtility::encodeKeyword(key, encoding, l_errCode));
+ if (l_errCode)
+ {
+ logging::logMessage(
+ "Failed to get encoded keyword value for : " + key +
+ ", error : " + commonUtility::getErrCodeMsg(l_errCode));
+ }
}
int main(int argc, char** argv)