weaponregex.internal.extension.TokenMutatorExtension.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weapon-regex_2.12 Show documentation
Show all versions of weapon-regex_2.12 Show documentation
Weapon regeX mutates regular expressions for use in mutation testing.
The newest version!
package weaponregex.internal.extension
import weaponregex.model.mutation.TokenMutator
private[weaponregex] object TokenMutatorExtension {
/** The extension that filter a given sequence of [[weaponregex.model.mutation.TokenMutator]]
*/
implicit class TokenMutatorsFiltering(mutators: Seq[TokenMutator]) {
/** Filter token mutators based on the given mutation level
* @param mutationLevel
* Target mutation level
* @return
* Sequence of token mutators in the given mutation levels
*/
def atLevel(mutationLevel: Int): Seq[TokenMutator] =
mutators filter (_.levels.contains(mutationLevel))
/** Filter token mutators based on the given mutation levels
* @param mutationLevels
* Target mutation levels
* @return
* Sequence of token mutators in the given mutation levels
*/
def atLevels(mutationLevels: Seq[Int]): Seq[TokenMutator] =
mutators filter (mutator => mutationLevels exists (mutator.levels contains _))
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy