-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid using
anyObjectValueProvider
that is removed in #2583
- Loading branch information
1 parent
9ea8815
commit f64a5b7
Showing
4 changed files
with
50 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/decorators/SeedFilteringValueProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.utbot.fuzzing.spring.decorators | ||
|
||
import org.utbot.fuzzing.Description | ||
import org.utbot.fuzzing.Seed | ||
import org.utbot.fuzzing.ValueProvider | ||
|
||
fun <T, R, D : Description<T>> ValueProvider<T, R, D>.filterSeeds(predicate: (Seed<T, R>) -> Boolean) = | ||
SeedFilteringValueProvider(delegate = this, predicate) | ||
|
||
class SeedFilteringValueProvider<T, R, D : Description<T>>( | ||
delegate: ValueProvider<T, R, D>, | ||
private val predicate: (Seed<T, R>) -> Boolean | ||
) : ValueProviderDecorator<T, R, D>(delegate) { | ||
override fun wrap(provider: ValueProvider<T, R, D>): ValueProvider<T, R, D> = | ||
provider.filterSeeds(predicate) | ||
|
||
override fun generate(description: D, type: T): Sequence<Seed<T, R>> = | ||
delegate.generate(description, type).filter(predicate) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters