xref: /openbmc/estoraged/src/test/erase/verifyGeometry_test.cpp (revision 043af59f7fadce9b7e3872d91b1a0e841fc24cea)
1e6ffe704SJohn Edward Broadbent #include "estoraged_conf.hpp"
2e6ffe704SJohn Edward Broadbent #include "verifyDriveGeometry.hpp"
3e6ffe704SJohn Edward Broadbent 
4972c3faaSJohn Wedig #include <xyz/openbmc_project/Common/error.hpp>
5e6ffe704SJohn Edward Broadbent 
6e6ffe704SJohn Edward Broadbent #include <gmock/gmock-matchers.h>
7e6ffe704SJohn Edward Broadbent #include <gmock/gmock.h>
8e6ffe704SJohn Edward Broadbent #include <gtest/gtest.h>
9972c3faaSJohn Wedig 
10d3bfa7bbSJohn Edward Broadbent namespace estoraged_test
11d3bfa7bbSJohn Edward Broadbent {
12d3bfa7bbSJohn Edward Broadbent using estoraged::VerifyDriveGeometry;
13972c3faaSJohn Wedig using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
14e6ffe704SJohn Edward Broadbent 
TEST(VerifyGeometry,TooBigFail)15e6ffe704SJohn Edward Broadbent TEST(VerifyGeometry, TooBigFail)
16e6ffe704SJohn Edward Broadbent {
17e6ffe704SJohn Edward Broadbent     VerifyDriveGeometry maxVerify("");
18*043af59fSTom Tung     EXPECT_THROW(maxVerify.geometryOkay(ERASE_MAX_GEOMETRY, ERASE_MIN_GEOMETRY,
19*043af59fSTom Tung                                         ERASE_MAX_GEOMETRY + 1),
20972c3faaSJohn Wedig                  InternalFailure);
21e6ffe704SJohn Edward Broadbent }
22e6ffe704SJohn Edward Broadbent 
TEST(VerifyGeometry,TooSmallFail)23e6ffe704SJohn Edward Broadbent TEST(VerifyGeometry, TooSmallFail)
24e6ffe704SJohn Edward Broadbent {
25e6ffe704SJohn Edward Broadbent     VerifyDriveGeometry minVerify("");
26*043af59fSTom Tung     EXPECT_THROW(minVerify.geometryOkay(ERASE_MAX_GEOMETRY, ERASE_MIN_GEOMETRY,
27*043af59fSTom Tung                                         ERASE_MIN_GEOMETRY - 1),
28972c3faaSJohn Wedig                  InternalFailure);
29e6ffe704SJohn Edward Broadbent }
30e6ffe704SJohn Edward Broadbent 
TEST(VerifyGeometry,pass)31e6ffe704SJohn Edward Broadbent TEST(VerifyGeometry, pass)
32e6ffe704SJohn Edward Broadbent {
33e6ffe704SJohn Edward Broadbent     VerifyDriveGeometry passVerify("");
34*043af59fSTom Tung     EXPECT_NO_THROW(passVerify.geometryOkay(
35*043af59fSTom Tung         ERASE_MAX_GEOMETRY, ERASE_MIN_GEOMETRY, ERASE_MIN_GEOMETRY + 1));
36e6ffe704SJohn Edward Broadbent }
37d3bfa7bbSJohn Edward Broadbent 
38d3bfa7bbSJohn Edward Broadbent } // namespace estoraged_test
39