tests: unit-test for parse() API
Change-Id: I9912102d442f2c00ce70514a4a65f25e1552fc19
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/test/parser/parser.cpp b/test/parser/parser.cpp
new file mode 100644
index 0000000..eda30af
--- /dev/null
+++ b/test/parser/parser.cpp
@@ -0,0 +1,30 @@
+#include <defines.hpp>
+#include <store.hpp>
+#include <parser.hpp>
+#include <cassert>
+#include <fstream>
+#include <iterator>
+
+void runTests()
+{
+ using namespace openpower::vpd;
+
+ // Test parse() API
+ {
+ std::ifstream vpdFile("test.vpd", std::ios::binary);
+ Binary vpd((std::istreambuf_iterator<char>(vpdFile)),
+ std::istreambuf_iterator<char>());
+
+ auto vpdStore = parse(std::move(vpd));
+
+ assert(("P012" ==
+ vpdStore.get<Record::VINI, record::Keyword::CC>()));
+ }
+}
+
+int main()
+{
+ runTests();
+
+ return 0;
+}