dave08
05/20/2021, 12:07 PMJonathan Olsson
05/20/2021, 12:17 PMdave08
05/20/2021, 12:20 PMclassify()
and checkCoverage()
for assumptions already 🤔sam
05/20/2021, 1:30 PMdave08
05/20/2021, 1:34 PM@Property
void simpleStats(@ForAll RoundingMode mode) {
Statistics.collect(mode);
}
will create an output similar to that:
[MyTest:simpleStats] (1000) statistics =
FLOOR (158) : 16 %
HALF_EVEN (135) : 14 %
DOWN (126) : 13 %
UP (120) : 12 %
HALF_UP (118) : 12 %
CEILING (117) : 12 %
UNNECESSARY (117) : 12 %
HALF_DOWN (109) : 11 %
sam
05/20/2021, 1:34 PMdave08
05/20/2021, 1:34 PMsam
05/20/2021, 1:35 PMdave08
05/20/2021, 1:36 PMsam
05/20/2021, 1:37 PMdave08
05/20/2021, 1:40 PMIs it to check the platforms random is actually randomNo, rather to make sure that filtering and all other steps produce a reasonable amount of variants. The programmer's errors, not the framework. And edgecases need to be contrived, and when you don't know when they're already covered by the random ones sufficiently, it's not so easy to do in more complicated setups.
sam
05/20/2021, 1:42 PMdave08
05/20/2021, 1:46 PMPropertyContext
I just supposed others could benefit from this...
I would make a PR, but I'm not familiar with MPP and how you would like this to be done.fun PropertyContext.printResult() {
val attempts = attempts().toDouble()
classifications().forEach { labelled, occurences ->
val percent = (occurences.toDouble() / attempts) * 100.0
println("$labelled ($occurences): ${percent.roundToInt()} %")
}
}
sam
05/20/2021, 2:03 PMdave08
05/20/2021, 2:04 PMinline fun <reified T : Enum<T>> PropertyContext.classify(label: T) {
classify(label.name)
}
... the wonders of kotlin extension functions 😁.
I made my own classifiers too for domain specific uses, this might be nice to document!sam
08/21/2021, 10:26 PMdave08
08/22/2021, 11:11 AM