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