diff options
| author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2016-11-30 05:19:45 -0600 |
|---|---|---|
| committer | Deepak Kodihalli <dkodihal@in.ibm.com> | 2016-12-08 12:40:08 -0600 |
| commit | 901c5d92d10cc23c52d9ff306b3ecea276ce67a4 (patch) | |
| tree | ad55f9fd3a8428444e31e8e13d58259545a34d2c /test | |
| parent | 2bba75d47657e35f9031e5bade0949a03399ce3f (diff) | |
| download | openpower-vpd-parser-901c5d92d10cc23c52d9ff306b3ecea276ce67a4.tar.gz openpower-vpd-parser-901c5d92d10cc23c52d9ff306b3ecea276ce67a4.zip | |
tests: unit-test for Store::get API
Change-Id: Ie67427f9496bb8f9712ef80e987c39903a66cd17
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile.am | 8 | ||||
| -rw-r--r-- | test/store/store.cpp | 36 |
2 files changed, 44 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..71591f0 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,8 @@ +AM_CPPFLAGS = -I$(top_srcdir) + +check_PROGRAMS = + +TESTS = $(check_PROGRAMS) + +check_PROGRAMS += store_test +store_test_SOURCES = store/store.cpp diff --git a/test/store/store.cpp b/test/store/store.cpp new file mode 100644 index 0000000..32b403c --- /dev/null +++ b/test/store/store.cpp @@ -0,0 +1,36 @@ +#include <cassert> +#include <string> +#include <unordered_map> +#include <utility> +#include "defines.hpp" +#include "store.hpp" + +void runTests() +{ + using namespace openpower::vpd; + + // Test Store::get API + { + Parsed vpd; + using inner = Parsed::mapped_type; + inner i; + + i.emplace("SN", "1001"); + i.emplace("PN", "F001"); + i.emplace("DR", "Fake FRU"); + vpd.emplace("VINI", i); + + Store s(std::move(vpd)); + + assert(("1001" == s.get<Record::VINI, record::Keyword::SN>())); + assert(("F001" == s.get<Record::VINI, record::Keyword::PN>())); + assert(("Fake FRU" == s.get<Record::VINI, record::Keyword::DR>())); + } +} + +int main() +{ + runTests(); + + return 0; +} |

