John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 1 | #include "estoraged_conf.hpp" |
| 2 | #include "verifyDriveGeometry.hpp" |
| 3 | |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame] | 4 | #include <xyz/openbmc_project/Common/error.hpp> |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 5 | |
| 6 | #include <gmock/gmock-matchers.h> |
| 7 | #include <gmock/gmock.h> |
| 8 | #include <gtest/gtest.h> |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame] | 9 | |
John Edward Broadbent | d3bfa7b | 2022-01-13 17:41:32 -0800 | [diff] [blame] | 10 | namespace estoraged_test |
| 11 | { |
| 12 | using estoraged::VerifyDriveGeometry; |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame] | 13 | using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 14 | |
| 15 | TEST(VerifyGeometry, TooBigFail) |
| 16 | { |
| 17 | VerifyDriveGeometry maxVerify(""); |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame] | 18 | EXPECT_THROW(maxVerify.geometryOkay(ERASE_MAX_GEOMETRY + 1), |
| 19 | InternalFailure); |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | TEST(VerifyGeometry, TooSmallFail) |
| 23 | { |
| 24 | VerifyDriveGeometry minVerify(""); |
John Wedig | 972c3fa | 2021-12-29 17:30:41 -0800 | [diff] [blame] | 25 | EXPECT_THROW(minVerify.geometryOkay(ERASE_MIN_GEOMETRY - 1), |
| 26 | InternalFailure); |
John Edward Broadbent | e6ffe70 | 2021-10-14 14:03:11 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | TEST(VerifyGeometry, pass) |
| 30 | { |
| 31 | VerifyDriveGeometry passVerify(""); |
| 32 | EXPECT_NO_THROW(passVerify.geometryOkay(ERASE_MIN_GEOMETRY + 1)); |
| 33 | } |
John Edward Broadbent | d3bfa7b | 2022-01-13 17:41:32 -0800 | [diff] [blame] | 34 | |
| 35 | } // namespace estoraged_test |