Jie Yang | fbe1b68 | 2021-02-19 04:54:55 -0800 | [diff] [blame] | 1 | #include "handler_unittest.hpp" |
| 2 | |
| 3 | #include <string> |
| 4 | #include <vector> |
| 5 | |
| 6 | #include <gtest/gtest.h> |
| 7 | |
| 8 | namespace blobs |
| 9 | { |
| 10 | |
| 11 | class SmbiosBlobHandlerBasicTest : public SmbiosBlobHandlerTest |
| 12 | {}; |
| 13 | |
| 14 | TEST_F(SmbiosBlobHandlerBasicTest, CanHandleBlobChecksNameInvalid) |
| 15 | { |
| 16 | // Verify canHandleBlob checks and returns false on an invalid name. |
| 17 | |
| 18 | EXPECT_FALSE(handler.canHandleBlob("asdf")); |
| 19 | EXPECT_FALSE(handler.canHandleBlob("smbios")); |
| 20 | EXPECT_FALSE(handler.canHandleBlob("/smbios0")); |
| 21 | EXPECT_FALSE(handler.canHandleBlob("/smbios/0")); |
| 22 | } |
| 23 | |
| 24 | TEST_F(SmbiosBlobHandlerBasicTest, CanHandleBlobChecksNameVaild) |
| 25 | { |
| 26 | // Verify canHandleBlob checks and returns true on the valid name. |
| 27 | |
| 28 | EXPECT_TRUE(handler.canHandleBlob(expectedBlobId)); |
| 29 | } |
| 30 | |
| 31 | TEST_F(SmbiosBlobHandlerBasicTest, GetblobIdsAsExpected) |
| 32 | { |
| 33 | // Verify getBlobIds returns the expected blob list. |
| 34 | |
| 35 | EXPECT_EQ(handler.getBlobIds(), expectedBlobIdList); |
| 36 | } |
| 37 | |
| 38 | } // namespace blobs |