コード例 #1
0
 public static IGen <T> Unfold <T>(
     this IGen <T> gen,
     Func <T, IEnumerable <T> > shrinkValue,
     Func <T, decimal>?measureValue = null,
     Func <T, int>?identifyValue    = null)
 {
     return(gen.Unfold(value => ExampleSpaceFactory.Unfold(
                           value,
                           shrinkValue.Invoke,
                           measureValue == null ? MeasureFunc.Unmeasured <T>() : measureValue !.Invoke,
                           identifyValue == null ? IdentifyFuncs.Default <T>() : value0 => ExampleId.Primitive(identifyValue !(value0)))));
 }
コード例 #2
0
 private static IExampleSpace <T> UnfoldToNumberOfShrinks <T>(T value, int numberOfShrinks) =>
 ExampleSpaceFactory.Unfold(
     value,
     new ShrinkNumberOfTimes <T>(numberOfShrinks),
     MeasureFunc.Unmeasured <T>(),
     (_) => RandomId());