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 <parser.hpp> |
| 6 | #include <store.hpp> |
Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 7 | |
| 8 | void 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 Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 20 | assert(("P012" == vpdStore.get<Record::VINI, record::Keyword::CC>())); |
George Liu | ee79ca8 | 2019-07-12 11:05:33 +0800 | [diff] [blame] | 21 | assert(("2019-01-01-08:30:00" == |
| 22 | vpdStore.get<Record::VINI, record::Keyword::MB>())); |
Deepak Kodihalli | 79f9eee | 2016-12-02 07:10:14 -0600 | [diff] [blame] | 23 | } |
| 24 | } |
| 25 | |
| 26 | int main() |
| 27 | { |
| 28 | runTests(); |
| 29 | |
| 30 | return 0; |
| 31 | } |