Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Feb 3, 2024
1 parent c8f79ba commit a1d271f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
4 changes: 0 additions & 4 deletions cpp/controllers/abstract_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ class AbstractController : public PhaseHandler
return ctrl.message;
}

bool HasValidLength() const
{
return ctrl.current_length;
}
auto GetOffset() const
{
return ctrl.offset;
Expand Down
10 changes: 5 additions & 5 deletions cpp/controllers/generic_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void GenericController::MsgIn()
void GenericController::DataIn()
{
if (!IsDataIn()) {
if (!HasValidLength()) {
if (!GetCurrentLength()) {
Status();
return;
}
Expand All @@ -251,7 +251,7 @@ void GenericController::DataIn()
void GenericController::DataOut()
{
if (!IsDataOut()) {
if (!HasValidLength()) {
if (!GetCurrentLength()) {
Status();
return;
}
Expand Down Expand Up @@ -340,7 +340,7 @@ void GenericController::Send()

// Continue sending if there are pending data
if (in_transfer) {
assert(HasValidLength());
assert(GetCurrentLength());
assert(!GetOffset());
return;
}
Expand Down Expand Up @@ -388,7 +388,7 @@ void GenericController::Receive()
}
}

if (HasValidLength()) {
if (GetCurrentLength()) {
UpdateOffsetAndLength();
return;
}
Expand Down Expand Up @@ -419,7 +419,7 @@ void GenericController::Receive()

// Continue to receive if there are pending data
if (in_transfer) {
assert(HasValidLength());
assert(GetCurrentLength());
assert(!GetOffset());
return;
}
Expand Down
14 changes: 1 addition & 13 deletions cpp/test/abstract_controller_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,12 @@ TEST(AbstractControllerTest, TransferSize)
EXPECT_FALSE(controller.UpdateTransferSize());
}

TEST(AbstractControllerTest, Length)
{
MockAbstractController controller;

EXPECT_FALSE(controller.HasValidLength());

controller.SetCurrentLength(1);
EXPECT_EQ(1U, controller.GetCurrentLength());
EXPECT_TRUE(controller.HasValidLength());
}

TEST(AbstractControllerTest, UpdateOffsetAndLength)
{
MockAbstractController controller;

EXPECT_FALSE(controller.HasValidLength());

controller.UpdateOffsetAndLength();
EXPECT_EQ(0U, controller.GetOffset());
EXPECT_EQ(0U, controller.GetCurrentLength());
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/test/scsi_controller_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ TEST(ScsiControllerTest, MsgIn)
EXPECT_CALL(*bus, SetIO(true));
controller.MsgIn();
EXPECT_EQ(phase_t::msgin, controller.GetPhase());
EXPECT_FALSE(controller.HasValidLength());
EXPECT_EQ(0, controller.GetOffset());
EXPECT_EQ(0U, controller.GetCurrentLength());
}

TEST(ScsiControllerTest, MsgOut)
Expand All @@ -209,8 +209,8 @@ TEST(ScsiControllerTest, MsgOut)
EXPECT_CALL(*bus, SetIO(false));
controller.MsgOut();
EXPECT_EQ(phase_t::msgout, controller.GetPhase());
EXPECT_EQ(1U, controller.GetCurrentLength());
EXPECT_EQ(0, controller.GetOffset());
EXPECT_EQ(1U, controller.GetCurrentLength());
}

TEST(ScsiControllerTest, DataIn)
Expand Down

0 comments on commit a1d271f

Please sign in to comment.