xref: /openbmc/phosphor-power/test/nvtest.cpp (revision 2f135445)
1*2f135445SMatt Spinler /**
2*2f135445SMatt Spinler  * Copyright © 2017 IBM Corporation
3*2f135445SMatt Spinler  *
4*2f135445SMatt Spinler  * Licensed under the Apache License, Version 2.0 (the "License");
5*2f135445SMatt Spinler  * you may not use this file except in compliance with the License.
6*2f135445SMatt Spinler  * You may obtain a copy of the License at
7*2f135445SMatt Spinler  *
8*2f135445SMatt Spinler  *     http://www.apache.org/licenses/LICENSE-2.0
9*2f135445SMatt Spinler  *
10*2f135445SMatt Spinler  * Unless required by applicable law or agreed to in writing, software
11*2f135445SMatt Spinler  * distributed under the License is distributed on an "AS IS" BASIS,
12*2f135445SMatt Spinler  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*2f135445SMatt Spinler  * See the License for the specific language governing permissions and
14*2f135445SMatt Spinler  * limitations under the License.
15*2f135445SMatt Spinler  */
16*2f135445SMatt Spinler #include <gtest/gtest.h>
17*2f135445SMatt Spinler #include "names_values.hpp"
18*2f135445SMatt Spinler 
19*2f135445SMatt Spinler TEST(NamesValuesTest, TestValues)
20*2f135445SMatt Spinler {
21*2f135445SMatt Spinler     witherspoon::power::util::NamesValues nv;
22*2f135445SMatt Spinler 
23*2f135445SMatt Spinler     std::string expected;
24*2f135445SMatt Spinler     EXPECT_EQ(nv.get(), expected); //empty
25*2f135445SMatt Spinler 
26*2f135445SMatt Spinler     nv.add("name1", 0);
27*2f135445SMatt Spinler     nv.add("name2", 0xC0FFEE);
28*2f135445SMatt Spinler     nv.add("name3", 0x12345678abcdef12);
29*2f135445SMatt Spinler     nv.add("name4", 0x0000000001);
30*2f135445SMatt Spinler 
31*2f135445SMatt Spinler     expected = "name1=0x0|name2=0xc0ffee|name3=0x12345678abcdef12|name4=0x1";
32*2f135445SMatt Spinler 
33*2f135445SMatt Spinler     EXPECT_EQ(nv.get(), expected);
34*2f135445SMatt Spinler }
35*2f135445SMatt Spinler 
36