blob: 8b362f3ac49cade7371a68e9ced00201f2a0da27 [file] [log] [blame]
John Edward Broadbente6ffe702021-10-14 14:03:11 -07001#include "estoraged_conf.hpp"
2#include "verifyDriveGeometry.hpp"
3
John Wedig972c3fa2021-12-29 17:30:41 -08004#include <xyz/openbmc_project/Common/error.hpp>
John Edward Broadbente6ffe702021-10-14 14:03:11 -07005
6#include <gmock/gmock-matchers.h>
7#include <gmock/gmock.h>
8#include <gtest/gtest.h>
John Wedig972c3fa2021-12-29 17:30:41 -08009
John Edward Broadbentd3bfa7b2022-01-13 17:41:32 -080010namespace estoraged_test
11{
12using estoraged::VerifyDriveGeometry;
John Wedig972c3fa2021-12-29 17:30:41 -080013using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
John Edward Broadbente6ffe702021-10-14 14:03:11 -070014
15TEST(VerifyGeometry, TooBigFail)
16{
17 VerifyDriveGeometry maxVerify("");
John Wedig972c3fa2021-12-29 17:30:41 -080018 EXPECT_THROW(maxVerify.geometryOkay(ERASE_MAX_GEOMETRY + 1),
19 InternalFailure);
John Edward Broadbente6ffe702021-10-14 14:03:11 -070020}
21
22TEST(VerifyGeometry, TooSmallFail)
23{
24 VerifyDriveGeometry minVerify("");
John Wedig972c3fa2021-12-29 17:30:41 -080025 EXPECT_THROW(minVerify.geometryOkay(ERASE_MIN_GEOMETRY - 1),
26 InternalFailure);
John Edward Broadbente6ffe702021-10-14 14:03:11 -070027}
28
29TEST(VerifyGeometry, pass)
30{
31 VerifyDriveGeometry passVerify("");
32 EXPECT_NO_THROW(passVerify.geometryOkay(ERASE_MIN_GEOMETRY + 1));
33}
John Edward Broadbentd3bfa7b2022-01-13 17:41:32 -080034
35} // namespace estoraged_test