blob: 4c83ba753df5af525b7f1f450b29550ad863f64b [file] [log] [blame]
Patrick Venturec83c4dc2018-11-01 16:29:18 -07001#include "store.hpp"
2
3#include "defines.hpp"
4
Deepak Kodihalli901c5d92016-11-30 05:19:45 -06005#include <cassert>
6#include <string>
7#include <unordered_map>
8#include <utility>
Deepak Kodihalli901c5d92016-11-30 05:19:45 -06009
10void runTests()
11{
12 using namespace openpower::vpd;
13
14 // Test Store::get API
15 {
16 Parsed vpd;
17 using inner = Parsed::mapped_type;
18 inner i;
19
20 i.emplace("SN", "1001");
21 i.emplace("PN", "F001");
22 i.emplace("DR", "Fake FRU");
23 vpd.emplace("VINI", i);
24
25 Store s(std::move(vpd));
26
27 assert(("1001" == s.get<Record::VINI, record::Keyword::SN>()));
28 assert(("F001" == s.get<Record::VINI, record::Keyword::PN>()));
29 assert(("Fake FRU" == s.get<Record::VINI, record::Keyword::DR>()));
30 }
31}
32
33int main()
34{
35 runTests();
36
37 return 0;
38}