From c354198280298513e2ea40c4b840cac212965a20 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Sat, 19 Oct 2024 22:58:03 +0200 Subject: [PATCH] Add unit tests --- cpp/test/mocks.h | 2 ++ cpp/test/primary_device_test.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/cpp/test/mocks.h b/cpp/test/mocks.h index afda5dbf..8327d408 100644 --- a/cpp/test/mocks.h +++ b/cpp/test/mocks.h @@ -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); diff --git a/cpp/test/primary_device_test.cpp b/cpp/test/primary_device_test.cpp index 10377720..7ad6070e 100644 --- a/cpp/test/primary_device_test.cpp +++ b/cpp/test/primary_device_test.cpp @@ -164,6 +164,22 @@ TEST(PrimaryDeviceTest, ModeSelect) EXPECT_THROW(device.ModeSelect( { }, { }, 0), scsi_exception); } +TEST(PrimaryDeviceTest, ModeSense6) +{ + MockPrimaryDevice device(0); + vector v; + + EXPECT_EQ(0, device.ModeSense6( { }, v)); +} + +TEST(PrimaryDeviceTest, ModeSense10) +{ + MockPrimaryDevice device(0); + vector v; + + EXPECT_EQ(0, device.ModeSense10( { }, v)); +} + TEST(PrimaryDeviceTest, TestUnitReady) { auto [controller, device] = CreatePrimaryDevice();