1 #include "estoraged_conf.hpp"
2 #include "verifyDriveGeometry.hpp"
3
4 #include <xyz/openbmc_project/Common/error.hpp>
5
6 #include <gmock/gmock-matchers.h>
7 #include <gmock/gmock.h>
8 #include <gtest/gtest.h>
9
10 namespace estoraged_test
11 {
12 using estoraged::VerifyDriveGeometry;
13 using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
14
TEST(VerifyGeometry,TooBigFail)15 TEST(VerifyGeometry, TooBigFail)
16 {
17 VerifyDriveGeometry maxVerify("");
18 EXPECT_THROW(maxVerify.geometryOkay(ERASE_MAX_GEOMETRY, ERASE_MIN_GEOMETRY,
19 ERASE_MAX_GEOMETRY + 1),
20 InternalFailure);
21 }
22
TEST(VerifyGeometry,TooSmallFail)23 TEST(VerifyGeometry, TooSmallFail)
24 {
25 VerifyDriveGeometry minVerify("");
26 EXPECT_THROW(minVerify.geometryOkay(ERASE_MAX_GEOMETRY, ERASE_MIN_GEOMETRY,
27 ERASE_MIN_GEOMETRY - 1),
28 InternalFailure);
29 }
30
TEST(VerifyGeometry,pass)31 TEST(VerifyGeometry, pass)
32 {
33 VerifyDriveGeometry passVerify("");
34 EXPECT_NO_THROW(passVerify.geometryOkay(
35 ERASE_MAX_GEOMETRY, ERASE_MIN_GEOMETRY, ERASE_MIN_GEOMETRY + 1));
36 }
37
38 } // namespace estoraged_test
39