blob: 57da82f3c7353b84d62c9b58a82e8a7024e1ec0c [file] [log] [blame]
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -06001#include <cassert>
Patrick Venturec83c4dc2018-11-01 16:29:18 -07002#include <defines.hpp>
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -06003#include <fstream>
4#include <iterator>
Patrick Venturec83c4dc2018-11-01 16:29:18 -07005#include <store.hpp>
SunnySrivastava1984e12b1812020-05-26 02:23:11 -05006#include <vpd-parser/ipz_parser.hpp>
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -06007
8void runTests()
9{
10 using namespace openpower::vpd;
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050011 using namespace openpower::vpd::ipz::parser;
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -060012 // Test parse() API
13 {
14 std::ifstream vpdFile("test.vpd", std::ios::binary);
15 Binary vpd((std::istreambuf_iterator<char>(vpdFile)),
16 std::istreambuf_iterator<char>());
17
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050018 IpzVpdParser ipzParser(std::move(vpd));
19 auto vpdStore = std::move(std::get<Store>(ipzParser.parse()));
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -060020
Patrick Venturec83c4dc2018-11-01 16:29:18 -070021 assert(("P012" == vpdStore.get<Record::VINI, record::Keyword::CC>()));
George Liuee79ca82019-07-12 11:05:33 +080022 assert(("2019-01-01-08:30:00" ==
23 vpdStore.get<Record::VINI, record::Keyword::MB>()));
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -060024 }
25}
26
27int main()
28{
29 runTests();
30
31 return 0;
32}