Skip to content

Commit 5f14d4e

Browse files
Mutator refactorings
1 parent 98ee577 commit 5f14d4e

File tree

1 file changed

+0
-59
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/engine/greyboxfuzzer/mutator

1 file changed

+0
-59
lines changed

utbot-framework/src/main/kotlin/org/utbot/engine/greyboxfuzzer/mutator/Mutator.kt

-59
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,6 @@ object Mutator {
142142
): FParameter {
143143
val originalParameter = fParameter.parameter
144144
val originalUtModel = fParameter.utModel
145-
// if (Random.getTrue(100)) {
146-
// return regenerateRandomParameter(fParameter)
147-
// }
148-
// val randomMethod = initialInstance.classId.allMethods
149-
// .filter { !it.name.startsWith("get") && !it.name.startsWith("to")}
150-
// .filter { it.classId.name != "java.lang.Object" }
151-
// .filter { it.parameters.all { !it.name.startsWith("java.util.function") } }
152-
// .toList()
153-
// .randomOrNull() ?: return null
154145
val randomMethod = fParameter.classId.allMethods.toList().randomOrNull() ?: return fParameter
155146
val parametersForMethodInvocation =
156147
randomMethod.method.parameters.mapIndexed { index, parameter ->
@@ -171,54 +162,4 @@ object Mutator {
171162
(originalUtModel as? UtAssembleModel)?.addModification(listOf(callModel))
172163
return FParameter(originalParameter, null, fParameter.utModel, fParameter.generator, fParameter.fields)
173164
}
174-
175-
176-
// private fun mutateInput(oldData: Any, sourceOfRandomness: SourceOfRandomness): Any {
177-
// val castedData = oldData as LongArray
178-
// print("BEFORE = ")
179-
// castedData.forEach { print("$it ") }
180-
// println()
181-
// // Clone this input to create initial version of new child
182-
// //val newInput = LinearInput(this)
183-
// val bos = ByteArrayOutputStream();
184-
// val oos = ObjectOutputStream(bos);
185-
// oos.writeObject(oldData);
186-
// oos.flush();
187-
// val data = bos.toByteArray()
188-
// val random = java.util.Random()//sourceOfRandomness.toJDKRandom()
189-
//
190-
// // Stack a bunch of mutations
191-
// val numMutations = 3//ZestGuidance.Input.sampleGeometric(random, MEAN_MUTATION_COUNT)
192-
// println("mutations = $numMutations")
193-
// //newInput.desc += ",havoc:$numMutations"
194-
// val setToZero = random.nextDouble() < 0.1 // one out of 10 times
195-
// for (mutation in 1..numMutations) {
196-
//
197-
// // Select a random offset and size
198-
// val offset = random.nextInt(data.size)
199-
// val mutationSize = ZestGuidance.Input.sampleGeometric(random, MEAN_MUTATION_SIZE)
200-
//
201-
// // desc += String.format(":%d@%d", mutationSize, idx);
202-
//
203-
// // Mutate a contiguous set of bytes from offset
204-
// for (i in offset until offset + mutationSize) {
205-
// // Don't go past end of list
206-
// if (i >= data.size) {
207-
// break
208-
// }
209-
//
210-
// // Otherwise, apply a random mutation
211-
// val mutatedValue = if (setToZero) 0 else random.nextInt(256)
212-
// data[i] = mutatedValue.toByte()
213-
// }
214-
// }
215-
// val `in` = ByteArrayInputStream(data)
216-
// val `is` = ObjectInputStream(`in`)
217-
// val afterMutationData = `is`.readObject() as LongArray
218-
// print("AFTER = ")
219-
// afterMutationData.forEach { print("$it ") }
220-
// println()
221-
// return data
222-
// }
223-
224165
}

0 commit comments

Comments
 (0)