Skip to content

Commit

Permalink
refactor: improve equality operator from MR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-cochran committed Oct 11, 2023
1 parent efd20a2 commit 00aa429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
15 changes: 2 additions & 13 deletions src/OpenSpaceToolkit/Astrodynamics/Trajectory/StateBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,9 @@ bool StateBuilder::operator==(const StateBuilder& aStateBuilder) const
return false;
}

for (const Shared<const CoordinatesSubset>& subset : this->coordinatesBrokerSPtr_->accessSubsets())
if ((*this->coordinatesBrokerSPtr_) != (*aStateBuilder.coordinatesBrokerSPtr_))
{
if (!aStateBuilder.coordinatesBrokerSPtr_->hasSubset(subset))
{
return false;
}
}

for (const Shared<const CoordinatesSubset>& subset : aStateBuilder.coordinatesBrokerSPtr_->accessSubsets())
{
if (!this->coordinatesBrokerSPtr_->hasSubset(subset))
{
return false;
}
return false;
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Trajectory_StateBuilder, EqualToOperator)
const StateBuilder anotherStateBuilder = {Frame::GCRF(), posVelMassBrokerSPtr};

EXPECT_FALSE(aStateBuilder == anotherStateBuilder);
EXPECT_FALSE(anotherStateBuilder == aStateBuilder);
}

{
Expand All @@ -106,7 +105,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Trajectory_StateBuilder, EqualToOperator)

const StateBuilder anotherStateBuilder = {Frame::GCRF(), velPosBrokerSPtr};

EXPECT_TRUE(aStateBuilder == anotherStateBuilder);
EXPECT_FALSE(aStateBuilder == anotherStateBuilder);
}

{
Expand Down Expand Up @@ -183,7 +182,7 @@ TEST_F(OpenSpaceToolkit_Astrodynamics_Trajectory_StateBuilder, NotEqualToOperato

const StateBuilder anotherStateBuilder = {Frame::GCRF(), velPosBrokerSPtr};

EXPECT_FALSE(aStateBuilder != anotherStateBuilder);
EXPECT_TRUE(aStateBuilder != anotherStateBuilder);
}

{
Expand Down

0 comments on commit 00aa429

Please sign in to comment.