blob: d9f441eba339bd81af86e0bc19eba192b0ffaf37 [file] [log] [blame]
Patrick Venturec83c4dc2018-11-01 16:29:18 -07001#include <defines.hpp>
Patrick Venturec83c4dc2018-11-01 16:29:18 -07002#include <store.hpp>
SunnySrivastava1984e12b1812020-05-26 02:23:11 -05003#include <vpd-parser/ipz_parser.hpp>
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -06004
Patrick Williamsc78d8872023-05-10 07:50:56 -05005#include <cassert>
6#include <fstream>
7#include <iterator>
8
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -06009void runTests()
10{
11 using namespace openpower::vpd;
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050012 using namespace openpower::vpd::ipz::parser;
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -060013 // Test parse() API
14 {
15 std::ifstream vpdFile("test.vpd", std::ios::binary);
16 Binary vpd((std::istreambuf_iterator<char>(vpdFile)),
17 std::istreambuf_iterator<char>());
18
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050019 IpzVpdParser ipzParser(std::move(vpd));
20 auto vpdStore = std::move(std::get<Store>(ipzParser.parse()));
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -060021
Patrick Venturec83c4dc2018-11-01 16:29:18 -070022 assert(("P012" == vpdStore.get<Record::VINI, record::Keyword::CC>()));
George Liuee79ca82019-07-12 11:05:33 +080023 assert(("2019-01-01-08:30:00" ==
24 vpdStore.get<Record::VINI, record::Keyword::MB>()));
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -060025 }
26}
27
28int main()
29{
30 runTests();
31
32 return 0;
33}