public static Gen<int> Int(int min = -10_000, int max = 10_000)Generates integers in the inclusive range [min, max], shrinking toward 0.
All Types / Ferrous.Testing
public static class Gen
Built-in Gen<T> factories for primitives, collections, and Ferrous types (NonEmptyString, NonZero<T>, Option<T>, Result<T, TError>).
public static Gen<int> Int(int min = -10_000, int max = 10_000)Generates integers in the inclusive range [min, max], shrinking toward 0.
public static Gen<long> Long(long min = -1_000_000, long max = 1_000_000)Generates 64-bit integers in [min, max], shrinking toward 0.
public static Gen<bool> Bool()Generates booleans, shrinking true to false.
public static Gen<double> Double(double min = -1000.0, double max = 1000.0)Generates finite double values in [min, max].
public static Gen<decimal> Decimal(decimal min = -1000m, decimal max = 1000m)Generates decimal values in [min, max], shrinking toward 0.
public static Gen<Guid> Guid()Generates deterministic System.Guid values from the RNG stream.
public static Gen<DateTimeOffset> DateTimeOffset(int minYear = 2000, int maxYear = 2035)Generates UTC System.DateTimeOffset values between minYear and maxYear.
public static Gen<TNewtype> Newtype<TNewtype, TUnderlying>(
Gen<TUnderlying> underlyingGen,
Func<TUnderlying, TNewtype> wrap,
Func<TNewtype, TUnderlying> unwrap)Wraps an underlying Gen<T> into a strongly-typed [Newtype] generator while preserving shrinking.
public static Gen<T> OneOfGen<T>(params Gen<T>[] generators)Composes multiple generators (ideal for [DiscriminatedUnion] variants), selecting one uniformly per sample and preserving shrinking within the chosen variant.
public static Gen<string> String(int minLength = 0, int maxLength = 32)Generates ASCII strings of length [minLength, maxLength], shrinking toward shorter strings.
public static Gen<NonEmptyString> NonEmptyString(int maxLength = 32)Generates guaranteed valid Ferrous.Results.NonEmptyString values.
public static Gen<NonZero<int>> NonZeroInt(int min = -1000, int max = 1000)Generates guaranteed valid NonZero<T> integers.
public static Gen<Option<T>> Option<T>(Gen<T> inner, double noneProbability = 0.2)Generates Option<T> values, shrinking Some(x) toward None and simpler Some values.
public static Gen<Result<T, TError>> Result<T, TError>(
Gen<T> okGen,
Gen<TError> errGen,
double errProbability = 0.3)Generates Result<T, TError> values, shrinking both Ok and Err payloads.
public static Gen<T> OneOf<T>(params T[] choices)Picks uniformly from choices, shrinking toward the first choice.
public static Gen<List<T>> List<T>(Gen<T> elementGen, int minCount = 0, int maxCount = 16)Generates lists of length [minCount, maxCount], shrinking length and elements.