File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
quickcheck/src/main/java/fj/test Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -475,12 +475,6 @@ public Gen<Short> f(final Integer i) {
475475 }
476476 });
477477
478- /**
479- * An arbitrary implementation for naturals.
480- */
481- public static final Gen <Natural > arbNatural = arbLong .filter (not (longEqual .eq (Long .MIN_VALUE )))
482- .map (Longs .abs ).map (Natural ::natural ).map (o -> o .some ());
483-
484478 /**
485479 * An arbitrary implementation for character values.
486480 */
@@ -1179,6 +1173,11 @@ public static <A> Gen<SynchronousQueue<A>> arbSynchronousQueue(final Gen<A> aa)
11791173
11801174 // END java.math
11811175
1176+ /**
1177+ * An arbitrary implementation for naturals.
1178+ */
1179+ public static final Gen <Natural > arbNatural = arbBigInteger .map (BigInteger ::abs ).map (Natural ::natural ).map (o -> o .some ());
1180+
11821181 /**
11831182 * An arbitrary implementation for locales.
11841183 */
Original file line number Diff line number Diff line change @@ -184,10 +184,6 @@ public static <A> Shrink<A> empty() {
184184 */
185185 public static final Shrink <Double > shrinkDouble = shrinkLong .map (Long_Double , Double_Long );
186186
187- /**
188- * A shrink strategy for naturals.
189- */
190- public static final Shrink <Natural > shrinkNatural = shrinkLong .map (l -> Natural .natural (l ).orSome (Natural .ZERO ), Natural ::longValue );
191187
192188 /**
193189 * Returns a shrink strategy for optional values. A 'no value' is already fully
@@ -701,6 +697,12 @@ public static <A> Shrink<SynchronousQueue<A>> shrinkSynchronousQueue(final Shrin
701697
702698 // END java.math
703699
700+ /**
701+ * A shrink strategy for naturals.
702+ */
703+ public static final Shrink <Natural > shrinkNatural = shrinkBigInteger .map (l -> Natural .natural (l ).orSome (Natural .ZERO ), Natural ::bigIntegerValue );
704+
705+
704706 /**
705707 * Returns a shrinking strategy for product-1 values.
706708 *
You can’t perform that action at this time.
0 commit comments