Matt Spinler | 15ee6ae | 2019-07-08 16:50:06 -0500 | [diff] [blame] | 1 | #include "extensions/openpower-pels/additional_data.hpp" |
| 2 | |
| 3 | #include <gtest/gtest.h> |
| 4 | |
| 5 | using namespace openpower::pels; |
| 6 | |
| 7 | TEST(AdditionalDataTest, GetKeywords) |
| 8 | { |
| 9 | std::vector<std::string> data{"KEY1=VALUE1", "KEY2=VALUE2", |
| 10 | "KEY3=", "HELLOWORLD", "=VALUE5"}; |
| 11 | AdditionalData ad{data}; |
| 12 | |
| 13 | EXPECT_TRUE(ad.getValue("KEY1")); |
| 14 | EXPECT_EQ(*(ad.getValue("KEY1")), "VALUE1"); |
| 15 | |
| 16 | EXPECT_TRUE(ad.getValue("KEY2")); |
| 17 | EXPECT_EQ(*(ad.getValue("KEY2")), "VALUE2"); |
| 18 | |
| 19 | EXPECT_FALSE(ad.getValue("x")); |
| 20 | |
| 21 | auto value3 = ad.getValue("KEY3"); |
| 22 | EXPECT_TRUE(value3); |
| 23 | EXPECT_TRUE((*value3).empty()); |
| 24 | |
| 25 | EXPECT_FALSE(ad.getValue("HELLOWORLD")); |
| 26 | EXPECT_FALSE(ad.getValue("VALUE5")); |
| 27 | } |