blob: 2be06c420fad624a0eae07a9c86d05972858b7d0 [file] [log] [blame]
Matt Spinler15ee6ae2019-07-08 16:50:06 -05001#include "extensions/openpower-pels/additional_data.hpp"
2
3#include <gtest/gtest.h>
4
5using namespace openpower::pels;
6
7TEST(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}