tests: unit-test for Store::get API
Change-Id: Ie67427f9496bb8f9712ef80e987c39903a66cd17
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
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;
+}