Conversation
…' into tamarinvs19/utbot-python-sockets # Conflicts: # utbot-python/src/main/kotlin/org/utbot/python/PythonEngine.kt # utbot-python/src/main/resources/requirements.txt
Markoutte
left a comment
There was a problem hiding this comment.
At the moment an exception is thrown, or no tests generated for this example:
def test3(x: str) -> bool:
if x[0] == 'b':
if x[1] == 'a':
if x[2] == 'd':
if x[3] == '!':
raise RuntimeError("Very bad")
return True# Conflicts: # utbot-python/src/main/kotlin/org/utbot/python/PythonEngine.kt # utbot-python/src/main/kotlin/org/utbot/python/PythonTestCaseGenerator.kt # utbot-python/src/main/resources/requirements.txt
…entation in state dict, move up ADDITIONAL_LIMIT, update utbot_executor
| data class PythonFeedback( | ||
| override val control: Control = Control.CONTINUE, | ||
| val result: Trie.Node<Instruction> = Trie.emptyNode(), | ||
| val executionFeedback: FuzzingExecutionFeedback? |
There was a problem hiding this comment.
This feedback is used as a part of equals/hashCode, therefore 2 same paths with different result will be recognized as different feedbacks. Is it intented?
| return sourceFileContent.take(offset).count { it == '\n' } + 1 | ||
| } | ||
|
|
||
| fun <T> weightedRandom(elems: List<T>, weights: List<Double>): T { |
There was a problem hiding this comment.
You can find similar util method in RandomExtension.kt (in module utbot-fuzzing) with name Random.chooseOne. Also, please not, that random in your case doesn't use seed, therefore, every run will be different, that usually is undesirable.
| }.first | ||
| val value = Random.nextDouble() | ||
| return elems[borders.indexOfFirst { it >= value }] | ||
| val index = Random.chooseOne(weights.map { it / sum }.toDoubleArray()) |
There was a problem hiding this comment.
The random is still no-seed random. Also, you can pass to the chooseOne just weights.toDoubleArray. The method chooseOne does sum itself, so, there's no need to do it before.
|
|
||
| private val cache = mutableMapOf<Pair<PythonMethodDescription, List<PythonTreeWrapper>>, PythonExecutionResult>() | ||
|
|
||
| private fun addExecutionToCache(key: Pair<PythonMethodDescription, List<PythonTreeWrapper>>, result: PythonExecutionResult) { |
There was a problem hiding this comment.
I'd recommend extracting the cache into a separate class to facilitate further work with it.
Description
Added socket connection between python and kotlin. Now it works 10 times faster then previous verision.
Fixes #1856
How to test
Manual tests
Generate tests for python function, for example, with many branches.
Self-check list
Check off the item if the statement is true. Hint: [x] is a marked item.
Please do not delete the list or its items.