Skip to content

Commit

Permalink
(RelEng) Clean other code smells.
Browse files Browse the repository at this point in the history
  • Loading branch information
kdesnos committed Sep 15, 2022
1 parent 1eef047 commit 1298470
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
5 changes: 2 additions & 3 deletions gegelatilib/include/mutator/tpgMutator.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,14 @@ namespace Mutator {
* This function mutates the behavior of the given TPGEdge Program,
* using the ProgramMutator functions, until the Program behavior is
* unique according to recordings held in the given Archive.
* The Program mutation is applid systematically, and a call to
* The Program mutation is applied systematically, and a call to
* MutateEdgeDestination is also made with a probability from the
* given MutationParameters.
*
* \param[in,out] graph the TPGGraph within which the team and edge are
* stored.
* \param[in] archive Archive used to assess the uniqueness of the
* mutated Program behavior.
* \param[in] team the source TPGTeam of the edge.
* \param[in] edge the TPGEdge whose destination will be altered.
* \param[in] preExistingTeams the TPGTeam candidates for destination.
* \param[in] preExistingActions the TPGAction candidates for
Expand All @@ -166,7 +165,7 @@ namespace Mutator {
*/
void mutateOutgoingEdge(
TPG::TPGGraph& graph, const Archive& archive,
const TPG::TPGTeam& team, const TPG::TPGEdge* edge,
const TPG::TPGEdge* edge,
const std::vector<const TPG::TPGTeam*>& preExistingTeams,
const std::vector<const TPG::TPGAction*>& preExistingActions,
std::list<std::shared_ptr<Program::Program>>& newPrograms,
Expand Down
9 changes: 4 additions & 5 deletions gegelatilib/src/mutator/tpgMutator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ void Mutator::TPGMutator::mutateEdgeDestination(
}

void Mutator::TPGMutator::mutateOutgoingEdge(
TPG::TPGGraph& graph, const Archive& archive, const TPG::TPGTeam& team,
const TPG::TPGEdge* edge,
TPG::TPGGraph& graph, const Archive& archive, const TPG::TPGEdge* edge,
const std::vector<const TPG::TPGTeam*>& preExistingTeams,
const std::vector<const TPG::TPGAction*>& preExistingActions,
std::list<std::shared_ptr<Program::Program>>& newPrograms,
Expand Down Expand Up @@ -306,9 +305,9 @@ void Mutator::TPGMutator::mutateTPGTeam(
// Edge->Program bid modification
if (rng.getDouble(0.0, 1.0) < params.tpg.pProgramMutation) {
// Mutate the edge
mutateOutgoingEdge(graph, archive, team, edge,
preExistingTeams, preExistingActions,
newPrograms, params, rng);
mutateOutgoingEdge(graph, archive, edge, preExistingTeams,
preExistingActions, newPrograms, params,
rng);
anyMutationDone = true;
}
}
Expand Down
8 changes: 3 additions & 5 deletions test/mutatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,7 @@ TEST_F(MutatorTest, TPGMutatorMutateOutgoingEdge)
std::list<std::shared_ptr<Program::Program>> newPrograms;

ASSERT_NO_THROW(Mutator::TPGMutator::mutateOutgoingEdge(
tpg, arch, vertex0, &edge0, {&vertex0}, {&vertex1}, newPrograms, params,
rng));
tpg, arch, &edge0, {&vertex0}, {&vertex1}, newPrograms, params, rng));

// Check that progPointer use count was decreased since the mutated program
// is a copy of the original
Expand Down Expand Up @@ -862,9 +861,8 @@ TEST_F(MutatorTest, TPGMutatorMutateProgramBehaviorAgainstArchive)

std::list<std::shared_ptr<Program::Program>> newPrograms;

Mutator::TPGMutator::mutateOutgoingEdge(tpg, arch, vertex0, &edge0,
{&vertex0}, {&vertex1}, newPrograms,
params, rng);
Mutator::TPGMutator::mutateOutgoingEdge(
tpg, arch, &edge0, {&vertex0}, {&vertex1}, newPrograms, params, rng);

ASSERT_NO_THROW(Mutator::TPGMutator::mutateProgramBehaviorAgainstArchive(
newPrograms.front(), params, arch, rng))
Expand Down

0 comments on commit 1298470

Please sign in to comment.