tests: Add unit-tests for canHandleBlob
Add unit-tests for canHandleBlob interface method.
Change-Id: I975d6f41f2a010fd3473c4f18b7018e5036a37e1
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/firmware_canhandle_unittest.cpp b/test/firmware_canhandle_unittest.cpp
new file mode 100644
index 0000000..2350828
--- /dev/null
+++ b/test/firmware_canhandle_unittest.cpp
@@ -0,0 +1,30 @@
+#include "firmware_handler.hpp"
+
+#include <memory>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+namespace blobs
+{
+TEST(FirmwareHandlerCanHandleTest, VerifyItemsInListAreOk)
+{
+
+ struct ListItem
+ {
+ std::string name;
+ bool expected;
+ };
+
+ std::vector<ListItem> items = {
+ {"asdf", true}, {"nope", false}, {"123123", false}, {"bcdf", true}};
+
+ auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
+ {"asdf", "bcdf"}, static_cast<uint16_t>(FirmwareUpdateFlags::bt));
+
+ for (const auto& item : items)
+ {
+ EXPECT_EQ(item.expected, handler->canHandleBlob(item.name));
+ }
+}
+} // namespace blobs