mirror of
https://github.com/akuker/RASCSI.git
synced 2026-04-21 02:17:25 +00:00
Code cleanup, especially casts, lambdas, data types, encapsulation (#952)
* Unit test updates * Lambda syntax cleanup * Use new-style casts * Use std::none_of when saving the cache * Use to_integer instead of casts * Use accessors for getting CDB data * Made ctrl_t private * Improved encapsulation * Replaced pointers by references * Removed all remaining occurrences of DWORD and BYTE, making os.h obsolete
This commit is contained in:
@@ -91,7 +91,7 @@ TEST(ScsiPrinterTest, Print)
|
||||
|
||||
cmd[3] = 0xff;
|
||||
cmd[4] = 0xff;
|
||||
EXPECT_THAT([&printer]() { printer->Dispatch(scsi_command::eCmdPrint); }, Throws<scsi_exception>(AllOf(
|
||||
EXPECT_THAT([&] { printer->Dispatch(scsi_command::eCmdPrint); }, Throws<scsi_exception>(AllOf(
|
||||
Property(&scsi_exception::get_sense_key, sense_key::ILLEGAL_REQUEST),
|
||||
Property(&scsi_exception::get_asc, asc::INVALID_FIELD_IN_CDB))))
|
||||
<< "Buffer overflow was not reported";
|
||||
@@ -112,7 +112,7 @@ TEST(ScsiPrinterTest, SynchronizeBuffer)
|
||||
NiceMock<MockAbstractController> controller(make_shared<MockBus>(), 0);
|
||||
auto printer = CreateDevice(SCLP, controller);
|
||||
|
||||
EXPECT_THAT([&printer]() { printer->Dispatch(scsi_command::eCmdSynchronizeBuffer); }, Throws<scsi_exception>(AllOf(
|
||||
EXPECT_THAT([&] { printer->Dispatch(scsi_command::eCmdSynchronizeBuffer); }, Throws<scsi_exception>(AllOf(
|
||||
Property(&scsi_exception::get_sense_key, sense_key::ABORTED_COMMAND),
|
||||
Property(&scsi_exception::get_asc, asc::NO_ADDITIONAL_SENSE_INFORMATION))))
|
||||
<< "Nothing to print";
|
||||
@@ -125,7 +125,7 @@ TEST(ScsiPrinterTest, WriteByteSequence)
|
||||
NiceMock<MockAbstractController> controller(make_shared<MockBus>(), 0);
|
||||
auto printer = dynamic_pointer_cast<SCSIPrinter>(CreateDevice(SCLP, controller));
|
||||
|
||||
vector<BYTE> buf(1);
|
||||
vector<uint8_t> buf(1);
|
||||
EXPECT_TRUE(printer->WriteByteSequence(buf, buf.size()));
|
||||
printer->Cleanup();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user