xref: /openbmc/openpower-vpd-parser/test/utest_utils.cpp (revision 17ddfb53f1a30ec82e8eb6ec171d5b5d00212406)
1 #include "utility/common_utility.hpp"
2 
3 #include <utility/vpd_specific_utility.hpp>
4 
5 #include <cassert>
6 #include <string>
7 
8 #include <gtest/gtest.h>
9 
10 using namespace vpd;
11 
TEST(UtilsTest,TestValidValue)12 TEST(UtilsTest, TestValidValue)
13 {
14     uint16_t l_errCode = 0;
15     std::string key = "VINI";
16     std::string encoding = "MAC";
17     std::string expected = "56:49:4e:49";
18     EXPECT_EQ(expected,
19               vpdSpecificUtility::encodeKeyword(key, encoding, l_errCode));
20     if (l_errCode)
21     {
22         logging::logMessage(
23             "Failed to get encoded keyword value for : " + key +
24             ", error : " + commonUtility::getErrCodeMsg(l_errCode));
25     }
26 }
27 
main(int argc,char ** argv)28 int main(int argc, char** argv)
29 {
30     ::testing::InitGoogleTest(&argc, argv);
31 
32     return RUN_ALL_TESTS();
33 }
34