Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Oct 19, 2024
1 parent 466934c commit c354198
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpp/test/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ class MockPrimaryDevice : public PrimaryDevice
FRIEND_TEST(PrimaryDeviceTest, TestUnitReady);
FRIEND_TEST(PrimaryDeviceTest, RequestSense);
FRIEND_TEST(PrimaryDeviceTest, Inquiry);
FRIEND_TEST(PrimaryDeviceTest, ModeSense6);
FRIEND_TEST(PrimaryDeviceTest, ModeSense10);
FRIEND_TEST(ControllerTest, RequestSense);
FRIEND_TEST(CommandExecutorTest, ValidateOperation);

Expand Down
16 changes: 16 additions & 0 deletions cpp/test/primary_device_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,22 @@ TEST(PrimaryDeviceTest, ModeSelect)
EXPECT_THROW(device.ModeSelect( { }, { }, 0), scsi_exception);
}

TEST(PrimaryDeviceTest, ModeSense6)
{
MockPrimaryDevice device(0);
vector<uint8_t> v;

EXPECT_EQ(0, device.ModeSense6( { }, v));
}

TEST(PrimaryDeviceTest, ModeSense10)
{
MockPrimaryDevice device(0);
vector<uint8_t> v;

EXPECT_EQ(0, device.ModeSense10( { }, v));
}

TEST(PrimaryDeviceTest, TestUnitReady)
{
auto [controller, device] = CreatePrimaryDevice();
Expand Down

0 comments on commit c354198

Please sign in to comment.