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