Skip to content

Commit 47660f0

Browse files
Change builder place, and add some comments
1 parent 37e06c2 commit 47660f0

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

core/src/main/kotlin/org/evomaster/core/search/builder/JsonPatchDocumentGeneBuilder.kt renamed to core/src/main/kotlin/org/evomaster/core/search/gene/builder/JsonPatchDocumentGeneBuilder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ object JsonPatchDocumentGeneBuilder {
8282

8383
private fun generateRandomPaths(randomness: Randomness): List<String> =
8484
generateSequence { "/${randomness.nextWordString(2, 6)}" }
85-
.take(RANDOM_PATH_COUNT * 2)
85+
.take(RANDOM_PATH_COUNT * 2) // generate extra candidates so that after deduplication we still have RANDOM_PATH_COUNT distinct paths
8686
.distinct()
8787
.take(RANDOM_PATH_COUNT)
8888
.toList()

core/src/main/kotlin/org/evomaster/core/search/gene/jsonpatch/JsonPatchOperationGene.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ abstract class JsonPatchOperationGene(
7676
children.filter { it.isMutable() }.forEach { it.randomize(randomness, tryToForceNewValue) }
7777
}
7878

79+
// Set to false due that for patch operation genes, all variation is already delegated to children (the path/value
80+
// sub-genes and, at the document level, ArrayGene and ChoiceGene, that selects which operation is active).
7981
override fun customShouldApplyShallowMutation(
8082
randomness: Randomness,
8183
selectionStrategy: SubsetGeneMutationSelectionStrategy,

core/src/test/kotlin/org/evomaster/core/search/builder/JsonPatchDocumentGeneBuilderTest.kt renamed to core/src/test/kotlin/org/evomaster/core/search/gene/builder/JsonPatchDocumentGeneBuilderTest.kt

File renamed without changes.

0 commit comments

Comments
 (0)