Patrick Venture | c83c4dc | 2018-11-01 16:29:18 -0700 | [diff] [blame] | 1 | #include "store.hpp" |
| 2 | |
| 3 | #include "defines.hpp" |
| 4 | |
Deepak Kodihalli | 901c5d9 | 2016-11-30 05:19:45 -0600 | [diff] [blame] | 5 | #include <cassert> |
| 6 | #include <string> |
| 7 | #include <unordered_map> |
| 8 | #include <utility> |
Deepak Kodihalli | 901c5d9 | 2016-11-30 05:19:45 -0600 | [diff] [blame] | 9 | |
| 10 | void runTests() |
| 11 | { |
| 12 | using namespace openpower::vpd; |
| 13 | |
| 14 | // Test Store::get API |
| 15 | { |
| 16 | Parsed vpd; |
| 17 | using inner = Parsed::mapped_type; |
| 18 | inner i; |
| 19 | |
| 20 | i.emplace("SN", "1001"); |
| 21 | i.emplace("PN", "F001"); |
| 22 | i.emplace("DR", "Fake FRU"); |
| 23 | vpd.emplace("VINI", i); |
| 24 | |
| 25 | Store s(std::move(vpd)); |
| 26 | |
| 27 | assert(("1001" == s.get<Record::VINI, record::Keyword::SN>())); |
| 28 | assert(("F001" == s.get<Record::VINI, record::Keyword::PN>())); |
| 29 | assert(("Fake FRU" == s.get<Record::VINI, record::Keyword::DR>())); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | int main() |
| 34 | { |
| 35 | runTests(); |
| 36 | |
| 37 | return 0; |
| 38 | } |