Skip to content

Instantly share code, notes, and snippets.

@sergio-sastre
Created July 18, 2021 09:59
Show Gist options
  • Save sergio-sastre/2af843767aec38cb6ffd10c72a1fbad8 to your computer and use it in GitHub Desktop.
Save sergio-sastre/2af843767aec38cb6ffd10c72a1fbad8 to your computer and use it in GitHub Desktop.
Multiplying the quality of your Unit Tests (Part2) with PBT - Method for collecting Upper Case stats of Jqwik generators
fun statsUpperCase(password: String?){
val withUpperCase = password?.contains("[A-Z]".toRegex())
Statistics
.label("Upper case")
.collect(if (withUpperCase == true) "with upper case" else "without upper case")
}
...
fun collectPasswordStats(password: String?){
statsUpperCase(password)
statsLowerCase(password)
statsDigits(password)
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment