diff --git a/cpp/test/disk_test.cpp b/cpp/test/disk_test.cpp index 861675c8..f96379cc 100644 --- a/cpp/test/disk_test.cpp +++ b/cpp/test/disk_test.cpp @@ -462,6 +462,24 @@ TEST(DiskTest, ModeSense10) ValidateCachingPage(*controller, 16); } +TEST(DiskTest, ReadData) +{ + MockDisk disk; + + EXPECT_THAT([&] {disk.ReadData( {});}, Throws(AllOf( + Property(&scsi_exception::get_sense_key, sense_key::not_ready), + Property(&scsi_exception::get_asc, asc::medium_not_present)))) << "Disk is not ready"; +} + +TEST(DiskTest, WriteData) +{ + MockDisk disk; + + EXPECT_THAT([&] {disk.WriteData( {}, scsi_command::write6);}, Throws(AllOf( + Property(&scsi_exception::get_sense_key, sense_key::not_ready), + Property(&scsi_exception::get_asc, asc::medium_not_present)))) << "Disk is not ready"; +} + TEST(DiskTest, SynchronizeCache) { auto [controller, disk] = CreateDisk(); diff --git a/cpp/test/scsi_cd_test.cpp b/cpp/test/scsi_cd_test.cpp index c6e35be2..3bc2cd16 100644 --- a/cpp/test/scsi_cd_test.cpp +++ b/cpp/test/scsi_cd_test.cpp @@ -119,3 +119,10 @@ TEST(ScsiCdTest, ReadToc) EXPECT_CALL(controller, DataIn()); EXPECT_NO_THROW(cd->Dispatch(scsi_command::read_toc)); } + +TEST(ScsiCdTest, ReadData) +{ + ScsiCd cd(0); + + EXPECT_THROW(cd.ReadData( {}), scsi_exception)<< "Drive is not ready"; +}