Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 1 | #include <cassert> |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 2 | #include <defines.hpp> |
Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 3 | #include <fstream> |
| 4 | #include <iterator> |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 5 | #include <store.hpp> |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 6 | #include <vpd-parser/ipz_parser.hpp> |
Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 7 | |
| 8 | void runTests() |
| 9 | { |
| 10 | using namespace openpower::vpd; |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 11 | using namespace openpower::vpd::ipz::parser; |
Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 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 | |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 18 | IpzVpdParser ipzParser(std::move(vpd)); |
| 19 | auto vpdStore = std::move(std::get<Store>(ipzParser.parse())); |
Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 20 | |
Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 21 | assert(("P012" == vpdStore.get<Record::VINI, record::Keyword::CC>())); |
George Liu | ee79ca8 | 2019-07-12 11:05:33 +0800 | [diff] [blame] | 22 | assert(("2019-01-01-08:30:00" == |
| 23 | vpdStore.get<Record::VINI, record::Keyword::MB>())); |
Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 24 | } |
| 25 | } |
| 26 | |
| 27 | int main() |
| 28 | { |
| 29 | runTests(); |
| 30 | |
| 31 | return 0; |
| 32 | } |