net.jqwik.engine.properties.arbitraries.DefaultBigIntegerArbitrary Maven / Gradle / Ivy
package net.jqwik.engine.properties.arbitraries;
import java.math.*;
import java.util.*;
import java.util.function.*;
import net.jqwik.api.*;
import net.jqwik.api.arbitraries.*;
public class DefaultBigIntegerArbitrary extends TypedCloneable implements BigIntegerArbitrary {
public static final BigInteger DEFAULT_MIN = BigInteger.valueOf(Long.MIN_VALUE);
public static final BigInteger DEFAULT_MAX = BigInteger.valueOf(Long.MAX_VALUE);
private IntegralGeneratingArbitrary generatingArbitrary;
public DefaultBigIntegerArbitrary() {
this.generatingArbitrary = new IntegralGeneratingArbitrary(DEFAULT_MIN, DEFAULT_MAX);
}
@Override
public RandomGenerator generator(int genSize) {
return generatingArbitrary.generator(genSize);
}
@Override
public Optional> exhaustive(long maxNumberOfSamples) {
return generatingArbitrary.exhaustive(maxNumberOfSamples);
}
@Override
public EdgeCases edgeCases(int maxEdgeCases) {
return generatingArbitrary.edgeCases(maxEdgeCases);
}
@Override
public Arbitrary edgeCases(Consumer> configurator) {
DefaultBigIntegerArbitrary clone = typedClone();
clone.generatingArbitrary = (IntegralGeneratingArbitrary) generatingArbitrary.edgeCases(configurator);
return clone;
}
@Override
public BigIntegerArbitrary withDistribution(final RandomDistribution distribution) {
DefaultBigIntegerArbitrary clone = typedClone();
clone.generatingArbitrary.distribution = distribution;
return clone;
}
@Override
public BigIntegerArbitrary greaterOrEqual(BigInteger min) {
DefaultBigIntegerArbitrary clone = typedClone();
clone.generatingArbitrary.min = (min == null ? DEFAULT_MIN : min);
return clone;
}
@Override
public BigIntegerArbitrary lessOrEqual(BigInteger max) {
DefaultBigIntegerArbitrary clone = typedClone();
clone.generatingArbitrary.max = (max == null ? DEFAULT_MAX : max);
return clone;
}
@Override
public BigIntegerArbitrary shrinkTowards(BigInteger target) {
DefaultBigIntegerArbitrary clone = typedClone();
clone.generatingArbitrary.shrinkingTarget = target;
return clone;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy