blob: 139c4f2b473bf4197999a665604c51e3f599b5fb [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 <parser.hpp>
6#include <store.hpp>
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -06007
8void runTests()
9{
10 using namespace openpower::vpd;
11
12 // 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
18 auto vpdStore = parse(std::move(vpd));
19
Patrick Venturec83c4dc2018-11-01 16:29:18 -070020 assert(("P012" == vpdStore.get<Record::VINI, record::Keyword::CC>()));
George Liuee79ca82019-07-12 11:05:33 +080021 assert(("2019-01-01-08:30:00" ==
22 vpdStore.get<Record::VINI, record::Keyword::MB>()));
Deepak Kodihalli79f9eee2016-12-02 07:10:14 -060023 }
24}
25
26int main()
27{
28 runTests();
29
30 return 0;
31}