jio.test.pbt.ParProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jio-test Show documentation
Show all versions of jio-test Show documentation
JIO test library based on Property Based Testing and Java Flight Recording Debuggers
package jio.test.pbt;
import jio.IO;
import jio.ListExp;
import jsonvalues.JsObj;
non-sealed class ParProperty extends Testable {
final int executionTimes;
final Property prop;
ParProperty(int executionTimes,
Property prop) {
this.executionTimes = executionTimes;
this.prop = prop;
}
@Override
IO createTask(JsObj conf) {
if (executionTimes < 1) {
throw new IllegalArgumentException("n < 1");
}
final IO test = prop.createTask(conf);
var result = ListExp.par(test);
for (int i = 1; i < executionTimes; i++) {
result = result.append(test);
}
return result.map(it -> it.stream()
.reduce(Report::aggregatePar)
.get());
}
}