0
|
1 package fj.test;
|
|
2
|
|
3 import static fj.Function.curry;
|
|
4 import static fj.Function.compose2;
|
|
5 import static fj.P.p;
|
|
6
|
|
7 import fj.*;
|
|
8
|
|
9 import static fj.P2.__2;
|
|
10 import fj.data.List;
|
|
11 import fj.data.Option;
|
|
12 import static fj.data.Option.none;
|
|
13 import fj.data.Stream;
|
|
14 import static fj.test.Arg.arg;
|
|
15 import static fj.test.CheckResult.exhausted;
|
|
16 import static fj.test.CheckResult.falsified;
|
|
17 import static fj.test.CheckResult.genException;
|
|
18 import static fj.test.CheckResult.passed;
|
|
19 import static fj.test.CheckResult.propException;
|
|
20 import static fj.test.CheckResult.proven;
|
|
21 import static fj.test.Result.noResult;
|
|
22 import static java.lang.Math.round;
|
|
23
|
|
24 /**
|
|
25 * Represents an algebraic property about a program that may be {@link #check(Rand, int, int, int,
|
|
26 * int) checked} for its truth value. For example, it is true that "for all integers (call it x) and
|
|
27 * for all integers (call it y), then x + y is equivalent to y + x". This statement is a (algebraic)
|
|
28 * property, proposition or theorem that, when checked, will at least (depending on arguments) fail
|
|
29 * to be falsified — since there does not exist a counter-example to this statement.
|
|
30 *
|
|
31 * @version %build.number%
|
|
32 */
|
|
33 public final class Property {
|
|
34 private final F<Integer, F<Rand, Result>> f;
|
|
35
|
|
36 private Property(final F<Integer, F<Rand, Result>> f) {
|
|
37 this.f = f;
|
|
38 }
|
|
39
|
|
40 /**
|
|
41 * Returns the result of applying the given size and random generator.
|
|
42 *
|
|
43 * @param i The size to use to obtain a result.
|
|
44 * @param r The random generator to use to obtain a result.
|
|
45 * @return The result of applying the given size and random generator.
|
|
46 */
|
|
47 public Result prop(final int i, final Rand r) {
|
|
48 return f.f(i).f(r);
|
|
49 }
|
|
50
|
|
51 /**
|
|
52 * Returns a generator of results from this property.
|
|
53 *
|
|
54 * @return A generator of results from this property.
|
|
55 */
|
|
56 public Gen<Result> gen() {
|
|
57 return Gen.gen(new F<Integer, F<Rand, Result>>() {
|
|
58 public F<Rand, Result> f(final Integer i) {
|
|
59 return new F<Rand, Result>() {
|
|
60 public Result f(final Rand r) {
|
|
61 return f.f(i).f(r);
|
|
62 }
|
|
63 };
|
|
64 }
|
|
65 });
|
|
66 }
|
|
67
|
|
68 /**
|
|
69 * Performs a conjunction of this property with the given property.
|
|
70 *
|
|
71 * @param p The property to perform the conjunction with.
|
|
72 * @return A conjunction of this property with the given property.
|
|
73 */
|
|
74 public Property and(final Property p) {
|
|
75 return fromGen(gen().bind(p.gen(), new F<Result, F<Result, Result>>() {
|
|
76 public F<Result, Result> f(final Result res1) {
|
|
77 return new F<Result, Result>() {
|
|
78 public Result f(final Result res2) {
|
|
79 return res1.isException() || res1.isFalsified() ? res1 : res2.isException() || res2.isFalsified() ? res2 : res1.isProven() || res1.isUnfalsified() ? res2 : res2.isProven() || res2.isUnfalsified() ? res1 : noResult();
|
|
80 }
|
|
81 };
|
|
82 }
|
|
83 }));
|
|
84 }
|
|
85
|
|
86 /**
|
|
87 * Performs a disjunction of this property with the given property.
|
|
88 *
|
|
89 * @param p The property to perform the disjunction with.
|
|
90 * @return A disjunction of this property with the given property.
|
|
91 */
|
|
92 public Property or(final Property p) {
|
|
93 return fromGen(gen().bind(p.gen(), new F<Result, F<Result, Result>>() {
|
|
94 public F<Result, Result> f(final Result res1) {
|
|
95 return new F<Result, Result>() {
|
|
96 public Result f(final Result res2) {
|
|
97 return res1.isException() || res1.isFalsified() ? res1 : res2.isException() || res2.isFalsified() ? res2 : res1.isProven() || res1.isUnfalsified() ? res1 : res2.isProven() || res2.isUnfalsified() ? res2 : noResult();
|
|
98 }
|
|
99 };
|
|
100 }
|
|
101 }));
|
|
102 }
|
|
103
|
|
104 /**
|
|
105 * Performs a sequence of this property with the given property. The returned property holds if
|
|
106 * and only if this property and the given property also hold. If one property does not hold, but
|
|
107 * the other does, then the returned property will produce the same result and the property that
|
|
108 * holds.
|
|
109 *
|
|
110 * @param p The property to sequence this property with.
|
|
111 * @return A sequence of this property with the given property.
|
|
112 */
|
|
113 public Property sequence(final Property p) {
|
|
114 return fromGen(gen().bind(p.gen(), new F<Result, F<Result, Result>>() {
|
|
115 public F<Result, Result> f(final Result res1) {
|
|
116 return new F<Result, Result>() {
|
|
117 public Result f(final Result res2) {
|
|
118 return res1.isException() || res1.isProven() || res1.isUnfalsified() ? res1 : res2.isException() || res2.isProven() || res2.isUnfalsified() ? res2 : res1.isFalsified() ? res2 : res2.isFalsified() ? res1 : noResult();
|
|
119 }
|
|
120 };
|
|
121 }
|
|
122 }));
|
|
123 }
|
|
124
|
|
125 /**
|
|
126 * Checks this property using the given arguments and produces a result.
|
|
127 *
|
|
128 * @param r The random generator to use for checking.
|
|
129 * @param minSuccessful The minimum number of successful tests before a result is reached.
|
|
130 * @param maxDiscarded The maximum number of tests discarded because they did not satisfy
|
|
131 * pre-conditions (i.e. {@link #implies(boolean, P1)}).
|
|
132 * @param minSize The minimum size to use for checking.
|
|
133 * @param maxSize The maximum size to use for checking.
|
|
134 * @return A result after checking this property.
|
|
135 */
|
|
136 @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
|
|
137 public CheckResult check(final Rand r,
|
|
138 final int minSuccessful,
|
|
139 final int maxDiscarded,
|
|
140 final int minSize,
|
|
141 final int maxSize) {
|
|
142 int s = 0;
|
|
143 int d = 0;
|
|
144 float sz = minSize;
|
|
145 CheckResult res;
|
|
146
|
|
147 while (true) {
|
|
148 final float size = s == 0 && d == 0 ? minSize : sz + (maxSize - sz) / (minSuccessful - s);
|
|
149 try {
|
|
150 final Result x = f.f(round(size)).f(r);
|
|
151 if (x.isNoResult())
|
|
152 if (d + 1 >= maxDiscarded) {
|
|
153 res = exhausted(s, d + 1);
|
|
154 break;
|
|
155 } else {
|
|
156 sz = size;
|
|
157 d++;
|
|
158 }
|
|
159 else if (x.isProven()) {
|
|
160 res = proven(x.args().some(), s + 1, d);
|
|
161 break;
|
|
162 } else if (x.isUnfalsified())
|
|
163 if (s + 1 >= minSuccessful) {
|
|
164 res = passed(s + 1, d);
|
|
165 break;
|
|
166 } else {
|
|
167 sz = size;
|
|
168 s++;
|
|
169 }
|
|
170 else if (x.isFalsified()) {
|
|
171 res = falsified(x.args().some(), s, d);
|
|
172 break;
|
|
173 } else if (x.isException()) {
|
|
174 res = propException(x.args().some(), x.exception().some(), s, d);
|
|
175 break;
|
|
176 }
|
|
177 } catch (final Throwable t) {
|
|
178 res = genException(t, s, d);
|
|
179 break;
|
|
180 }
|
|
181 }
|
|
182
|
|
183 return res;
|
|
184 }
|
|
185
|
|
186 /**
|
|
187 * Checks this property using a {@link Rand#Rand(F, F) standard random generator} and the given
|
|
188 * arguments to produce a result.
|
|
189 *
|
|
190 * @param minSuccessful The minimum number of successful tests before a result is reached.
|
|
191 * @param maxDiscarded The maximum number of tests discarded because they did not satisfy
|
|
192 * pre-conditions (i.e. {@link #implies(boolean, P1)}).
|
|
193 * @param minSize The minimum size to use for checking.
|
|
194 * @param maxSize The maximum size to use for checking.
|
|
195 * @return A result after checking this property.
|
|
196 */
|
|
197 public CheckResult check(final int minSuccessful,
|
|
198 final int maxDiscarded,
|
|
199 final int minSize,
|
|
200 final int maxSize) {
|
|
201 return check(Rand.standard, minSuccessful, maxDiscarded, minSize, maxSize);
|
|
202 }
|
|
203
|
|
204 /**
|
|
205 * Checks this property using the given random generator, 100 minimum successful checks, 500
|
|
206 * maximum discarded tests, minimum size of 0, maximum size of 100.
|
|
207 *
|
|
208 * @param r The random generator.
|
|
209 * @return A result after checking this property.
|
|
210 */
|
|
211 public CheckResult check(final Rand r) {
|
|
212 return check(r, 100, 500, 0, 100);
|
|
213 }
|
|
214
|
|
215 /**
|
|
216 * Checks this property using the given random generator, 100 minimum successful checks, 500
|
|
217 * maximum discarded tests, the given minimum size and the given maximum size.
|
|
218 *
|
|
219 * @param r The random generator.
|
|
220 * @param minSize The minimum size to use for checking.
|
|
221 * @param maxSize The maximum size to use for checking.
|
|
222 * @return A result after checking this property.
|
|
223 */
|
|
224 public CheckResult check(final Rand r, final int minSize, final int maxSize) {
|
|
225 return check(r, 100, 500, minSize, maxSize);
|
|
226 }
|
|
227
|
|
228 /**
|
|
229 * Checks this property using a {@link Rand#Rand(F, F) standard random generator}, 100 minimum
|
|
230 * successful checks, 500 maximum discarded tests and the given arguments to produce a result.
|
|
231 *
|
|
232 * @param minSize The minimum size to use for checking.
|
|
233 * @param maxSize The maximum size to use for checking.
|
|
234 * @return A result after checking this property.
|
|
235 */
|
|
236 public CheckResult check(final int minSize,
|
|
237 final int maxSize) {
|
|
238 return check(100, 500, minSize, maxSize);
|
|
239 }
|
|
240
|
|
241 /**
|
|
242 * Checks this property using a {@link Rand#Rand(F, F) standard random generator}, 100 minimum
|
|
243 * successful checks, 500 maximum discarded tests, minimum size of 0, maximum size of 100.
|
|
244 *
|
|
245 * @return A result after checking this property.
|
|
246 */
|
|
247 public CheckResult check() {
|
|
248 return check(0, 100);
|
|
249 }
|
|
250
|
|
251 /**
|
|
252 * Checks this property using a {@link Rand#Rand(F, F) standard random generator}, the given minimum
|
|
253 * successful checks, 500 maximum discarded tests, minimum size of 0, maximum size of 100.
|
|
254 *
|
|
255 * @param minSuccessful The minimum number of successful tests before a result is reached.
|
|
256 * @return A result after checking this property.
|
|
257 */
|
|
258 public CheckResult minSuccessful(final int minSuccessful) {
|
|
259 return check(minSuccessful, 500, 0, 100);
|
|
260 }
|
|
261
|
|
262 /**
|
|
263 * Checks this property using the given random generator, the given minimum
|
|
264 * successful checks, 500 maximum discarded tests, minimum size of 0, maximum size of 100.
|
|
265 *
|
|
266 * @param r The random generator.
|
|
267 * @param minSuccessful The minimum number of successful tests before a result is reached.
|
|
268 * @return A result after checking this property.
|
|
269 */
|
|
270 public CheckResult minSuccessful(final Rand r, final int minSuccessful) {
|
|
271 return check(r, minSuccessful, 500, 0, 100);
|
|
272 }
|
|
273
|
|
274 /**
|
|
275 * Checks this property using a {@link Rand#Rand(F, F) standard random generator}, 100 minimum
|
|
276 * successful checks, the given maximum discarded tests, minimum size of 0, maximum size of 100.
|
|
277 *
|
|
278 * @param maxDiscarded The maximum number of tests discarded because they did not satisfy
|
|
279 * pre-conditions (i.e. {@link #implies(boolean, P1)}).
|
|
280 * @return A result after checking this property.
|
|
281 */
|
|
282 public CheckResult maxDiscarded(final int maxDiscarded) {
|
|
283 return check(100, maxDiscarded, 0, 100);
|
|
284 }
|
|
285
|
|
286 /**
|
|
287 * Checks this property using a the given random generator}, 100 minimum
|
|
288 * successful checks, the given maximum discarded tests, minimum size of 0, maximum size of 100.
|
|
289 *
|
|
290 * @param r The random generator.
|
|
291 * @param maxDiscarded The maximum number of tests discarded because they did not satisfy
|
|
292 * pre-conditions (i.e. {@link #implies(boolean, P1)}).
|
|
293 * @return A result after checking this property.
|
|
294 */
|
|
295 public CheckResult maxDiscarded(final Rand r, final int maxDiscarded) {
|
|
296 return check(r, 100, maxDiscarded, 0, 100);
|
|
297 }
|
|
298
|
|
299 /**
|
|
300 * Checks this property using a {@link Rand#Rand(F, F) standard random generator}, 100 minimum
|
|
301 * successful checks, 500 maximum discarded tests, the given minimum size, maximum size of 100.
|
|
302 *
|
|
303 * @param minSize The minimum size to use for checking.
|
|
304 * @return A result after checking this property.
|
|
305 */
|
|
306 public CheckResult minSize(final int minSize) {
|
|
307 return check(100, 500, minSize, 100);
|
|
308 }
|
|
309
|
|
310 /**
|
|
311 * Checks this property using the given random generator, 100 minimum
|
|
312 * successful checks, 500 maximum discarded tests, the given minimum size, maximum size of 100.
|
|
313 *
|
|
314 * @param r The random generator.
|
|
315 * @param minSize The minimum size to use for checking.
|
|
316 * @return A result after checking this property.
|
|
317 */
|
|
318 public CheckResult minSize(final Rand r, final int minSize) {
|
|
319 return check(r, 100, 500, minSize, 100);
|
|
320 }
|
|
321
|
|
322 /**
|
|
323 * Checks this property using a {@link Rand#Rand(F, F) standard random generator}, 100 minimum
|
|
324 * successful checks, 500 maximum discarded tests, minimum size of 0, the given maximum size.
|
|
325 *
|
|
326 * @param maxSize The maximum size to use for checking.
|
|
327 * @return A result after checking this property.
|
|
328 */
|
|
329 public CheckResult maxSize(final int maxSize) {
|
|
330 return check(100, 500, 0, maxSize);
|
|
331 }
|
|
332
|
|
333 /**
|
|
334 * Checks this property using the given random generator, 100 minimum
|
|
335 * successful checks, 500 maximum discarded tests, minimum size of 0, the given maximum size.
|
|
336 *
|
|
337 * @param r The random generator.
|
|
338 * @param maxSize The maximum size to use for checking.
|
|
339 * @return A result after checking this property.
|
|
340 */
|
|
341 public CheckResult maxSize(final Rand r, final int maxSize) {
|
|
342 return check(r, 100, 500, 0, maxSize);
|
|
343 }
|
|
344
|
|
345 /**
|
|
346 * Returns a property that produces a result only if the given condition satisfies. The result
|
|
347 * will be taken from the given property.
|
|
348 *
|
|
349 * @param b The condition that, if satisfied, produces the given property.
|
|
350 * @param p The property to return if the condition satisfies.
|
|
351 * @return A property that produces a result only if the given condition satisfies.
|
|
352 */
|
|
353 public static Property implies(final boolean b, final P1<Property> p) {
|
|
354 return b ? p._1() : new Property(new F<Integer, F<Rand, Result>>() {
|
|
355 public F<Rand, Result> f(final Integer i) {
|
|
356 return new F<Rand, Result>() {
|
|
357 public Result f(final Rand r) {
|
|
358 return noResult();
|
|
359 }
|
|
360 };
|
|
361 }
|
|
362 });
|
|
363 }
|
|
364
|
|
365 /**
|
|
366 * Returns a property from the given function.
|
|
367 *
|
|
368 * @param f The function to construct the returned property with.
|
|
369 * @return A property from the given function.
|
|
370 */
|
|
371 public static Property prop(final F<Integer, F<Rand, Result>> f) {
|
|
372 return new Property(f);
|
|
373 }
|
|
374
|
|
375 /**
|
|
376 * Returns a property that always has the given result.
|
|
377 *
|
|
378 * @param r The result of the returned property.
|
|
379 * @return A property that always has the given result.
|
|
380 */
|
|
381 public static Property prop(final Result r) {
|
|
382 return new Property(new F<Integer, F<Rand, Result>>() {
|
|
383 public F<Rand, Result> f(final Integer integer) {
|
|
384 return new F<Rand, Result>() {
|
|
385 public Result f(final Rand x) {
|
|
386 return r;
|
|
387 }
|
|
388 };
|
|
389 }
|
|
390 });
|
|
391 }
|
|
392
|
|
393 /**
|
|
394 * Returns a property that is either proven (the given condition satsifies) or falsified
|
|
395 * otherwise.
|
|
396 *
|
|
397 * @param b The condition that, if satisfied, returns a property that is proven; otherwise, the
|
|
398 * property is falsified.
|
|
399 * @return A property that is either proven (the given condition satsifies) or falsified
|
|
400 * otherwise.
|
|
401 */
|
|
402 public static Property prop(final boolean b) {
|
|
403 return b ? prop(Result.proven(List.<Arg<?>>nil())) : prop(Result.falsified(List.<Arg<?>>nil()));
|
|
404 }
|
|
405
|
|
406 /**
|
|
407 * Constructs a property from a generator of results.
|
|
408 *
|
|
409 * @param g The generator of results to constructor a property with.
|
|
410 * @return A property from a generator of results.
|
|
411 */
|
|
412 public static Property fromGen(final Gen<Result> g) {
|
|
413 return prop(new F<Integer, F<Rand, Result>>() {
|
|
414 public F<Rand, Result> f(final Integer i) {
|
|
415 return new F<Rand, Result>() {
|
|
416 public Result f(final Rand r) {
|
|
417 return g.gen(i, r);
|
|
418 }
|
|
419 };
|
|
420 }
|
|
421 });
|
|
422 }
|
|
423
|
|
424 /**
|
|
425 * Returns a property where its result is derived from universal quantification across the
|
|
426 * application of its arguments.
|
|
427 *
|
|
428 * @param g The generator to produces values from to produce the property with.
|
|
429 * @param shrink The shrink strategy to use upon falsification.
|
|
430 * @param f The function to produce properties with results.
|
|
431 * @return A property where its result is derived from universal quantification across the
|
|
432 * application of its arguments.
|
|
433 */
|
|
434 public static <A> Property forall(final Gen<A> g, final Shrink<A> shrink, final F<A, P1<Property>> f) {
|
|
435 return prop(new F<Integer, F<Rand, Result>>() {
|
|
436 public F<Rand, Result> f(final Integer i) {
|
|
437 return new F<Rand, Result>() {
|
|
438 public Result f(final Rand r) {
|
|
439 final class Util {
|
|
440 @SuppressWarnings({"IfMayBeConditional"})
|
|
441 Option<P2<A, Result>> first(final Stream<A> as, final int shrinks) {
|
|
442 final Stream<Option<P2<A, Result>>> results = as.map(new F<A, Option<P2<A, Result>>>() {
|
|
443 public Option<P2<A, Result>> f(final A a) {
|
|
444 final Result result = exception(f.f(a)).prop(i, r);
|
|
445
|
|
446 return result.toOption().map(new F<Result, P2<A, Result>>() {
|
|
447 public P2<A, Result> f(final Result result) {
|
|
448 return p(a, result.provenAsUnfalsified().addArg(arg(a, shrinks)));
|
|
449 }
|
|
450 });
|
|
451 }
|
|
452 });
|
|
453
|
|
454 if (results.isEmpty())
|
|
455 return none();
|
|
456 else return results.find(new F<Option<P2<A, Result>>, Boolean>() {
|
|
457 public Boolean f(final Option<P2<A, Result>> o) {
|
|
458 return failed(o);
|
|
459 }
|
|
460 }).orSome(new P1<Option<P2<A, Result>>>() {
|
|
461 public Option<P2<A, Result>> _1() {
|
|
462 return results.head();
|
|
463 }
|
|
464 });
|
|
465 }
|
|
466
|
|
467 public boolean failed(final Option<P2<A, Result>> o) {
|
|
468 return o.isSome() && o.some()._2().failed();
|
|
469 }
|
|
470 }
|
|
471
|
|
472 final Util u = new Util();
|
|
473
|
|
474 Option<P2<A, Result>> x = u.first(Stream.single(g.gen(i, r)), 0);
|
|
475 final F<P2<A, Result>, Result> __2 = __2();
|
|
476 if (u.failed(x)) {
|
|
477 Option<Result> or;
|
|
478 int shrinks = 0;
|
|
479
|
|
480 do {
|
|
481 shrinks++;
|
|
482 or = x.map(__2);
|
|
483 x = u.first(shrink.shrink(x.some()._1()), shrinks);
|
|
484 }
|
|
485 while (u.failed(x));
|
|
486
|
|
487 return noResult(or);
|
|
488 } else
|
|
489 return noResult(x.map(__2));
|
|
490 }
|
|
491 };
|
|
492 }
|
|
493 });
|
|
494 }
|
|
495
|
|
496 /**
|
|
497 * Returns a property where its result is derived from universal quantification across the
|
|
498 * application of its arguments.
|
|
499 *
|
|
500 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
501 * @param sa The shrink strategy to use upon falsification.
|
|
502 * @param f The function to produce properties with results.
|
|
503 * @return A property where its result is derived from universal quantification across the
|
|
504 * application of its arguments.
|
|
505 */
|
|
506 public static <A> Property propertyP(final Arbitrary<A> aa, final Shrink<A> sa, final F<A, P1<Property>> f) {
|
|
507 return forall(aa.gen, sa, f);
|
|
508 }
|
|
509
|
|
510 /**
|
|
511 * Returns a property where its result is derived from universal quantification across the
|
|
512 * application of its arguments.
|
|
513 *
|
|
514 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
515 * @param sa The shrink strategy to use upon falsification.
|
|
516 * @param f The function to produce properties with results.
|
|
517 * @return A property where its result is derived from universal quantification across the
|
|
518 * application of its arguments.
|
|
519 */
|
|
520 public static <A> Property property(final Arbitrary<A> aa, final Shrink<A> sa, final F<A, Property> f) {
|
|
521 return propertyP(aa, sa, P1.curry(f));
|
|
522 }
|
|
523
|
|
524 /**
|
|
525 * Returns a property where its result is derived from universal quantification across the
|
|
526 * application of its arguments. No shrinking occurs upon falsification.
|
|
527 *
|
|
528 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
529 * @param f The function to produce properties with results.
|
|
530 * @return A property where its result is derived from universal quantification across the
|
|
531 * application of its arguments.
|
|
532 */
|
|
533 public static <A> Property propertyP(final Arbitrary<A> aa, final F<A, P1<Property>> f) {
|
|
534 return propertyP(aa, Shrink.<A>empty(), f);
|
|
535 }
|
|
536
|
|
537 /**
|
|
538 * Returns a property where its result is derived from universal quantification across the
|
|
539 * application of its arguments. No shrinking occurs upon falsification.
|
|
540 *
|
|
541 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
542 * @param f The function to produce properties with results.
|
|
543 * @return A property where its result is derived from universal quantification across the
|
|
544 * application of its arguments.
|
|
545 */
|
|
546 public static <A> Property property(final Arbitrary<A> aa, final F<A, Property> f) {
|
|
547 return propertyP(aa, P1.curry(f));
|
|
548 }
|
|
549
|
|
550
|
|
551 /**
|
|
552 * Returns a property where its result is derived from universal quantification across the
|
|
553 * application of its arguments.
|
|
554 *
|
|
555 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
556 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
557 * @param sa The shrink strategy to use upon falsification.
|
|
558 * @param sb The shrink strategy to use upon falsification.
|
|
559 * @param f The function to produce properties with results.
|
|
560 * @return A property where its result is derived from universal quantification across the
|
|
561 * application of its arguments.
|
|
562 */
|
|
563 public static <A, B> Property propertyP(final Arbitrary<A> aa, final Arbitrary<B> ab, final Shrink<A> sa, final Shrink<B> sb, final F<A, F<B, P1<Property>>> f) {
|
|
564 return property(aa, sa, new F<A, Property>() {
|
|
565 public Property f(final A a) {
|
|
566 return propertyP(ab, sb, new F<B, P1<Property>>() {
|
|
567 public P1<Property> f(final B b) {
|
|
568 return f.f(a).f(b);
|
|
569 }
|
|
570 });
|
|
571 }
|
|
572 });
|
|
573 }
|
|
574
|
|
575 /**
|
|
576 * Returns a property where its result is derived from universal quantification across the
|
|
577 * application of its arguments.
|
|
578 *
|
|
579 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
580 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
581 * @param sa The shrink strategy to use upon falsification.
|
|
582 * @param sb The shrink strategy to use upon falsification.
|
|
583 * @param f The function to produce properties with results.
|
|
584 * @return A property where its result is derived from universal quantification across the
|
|
585 * application of its arguments.
|
|
586 */
|
|
587 public static <A, B> Property property(final Arbitrary<A> aa, final Arbitrary<B> ab, final Shrink<A> sa, final Shrink<B> sb, final F<A, F<B, Property>> f) {
|
|
588 return propertyP(aa, ab, sa, sb, compose2(P.<Property>p1(), f));
|
|
589 }
|
|
590
|
|
591 /**
|
|
592 * Returns a property where its result is derived from universal quantification across the
|
|
593 * application of its arguments. No shrinking occurs upon falsification.
|
|
594 *
|
|
595 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
596 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
597 * @param f The function to produce properties with results.
|
|
598 * @return A property where its result is derived from universal quantification across the
|
|
599 * application of its arguments.
|
|
600 */
|
|
601 public static <A, B> Property propertyP(final Arbitrary<A> aa, final Arbitrary<B> ab, final F<A, F<B, P1<Property>>> f) {
|
|
602 return property(aa, new F<A, Property>() {
|
|
603 public Property f(final A a) {
|
|
604 return propertyP(ab, new F<B, P1<Property>>() {
|
|
605 public P1<Property> f(final B b) {
|
|
606 return f.f(a).f(b);
|
|
607 }
|
|
608 });
|
|
609 }
|
|
610 });
|
|
611 }
|
|
612
|
|
613 /**
|
|
614 * Returns a property where its result is derived from universal quantification across the
|
|
615 * application of its arguments. No shrinking occurs upon falsification.
|
|
616 *
|
|
617 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
618 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
619 * @param f The function to produce properties with results.
|
|
620 * @return A property where its result is derived from universal quantification across the
|
|
621 * application of its arguments.
|
|
622 */
|
|
623 public static <A, B> Property property(final Arbitrary<A> aa, final Arbitrary<B> ab, final F<A, F<B, Property>> f) {
|
|
624 return propertyP(aa, ab, compose2(P.<Property>p1(), f));
|
|
625 }
|
|
626
|
|
627 /**
|
|
628 * Returns a property where its result is derived from universal quantification across the
|
|
629 * application of its arguments.
|
|
630 *
|
|
631 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
632 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
633 * @param sa The shrink strategy to use upon falsification.
|
|
634 * @param sb The shrink strategy to use upon falsification.
|
|
635 * @param f The function to produce properties with results.
|
|
636 * @return A property where its result is derived from universal quantification across the
|
|
637 * application of its arguments.
|
|
638 */
|
|
639 public static <A, B> Property propertyP(final Arbitrary<A> aa, final Arbitrary<B> ab, final Shrink<A> sa, final Shrink<B> sb, final F2<A, B, P1<Property>> f) {
|
|
640 return propertyP(aa, ab, sa, sb, curry(f));
|
|
641 }
|
|
642
|
|
643 /**
|
|
644 * Returns a property where its result is derived from universal quantification across the
|
|
645 * application of its arguments.
|
|
646 *
|
|
647 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
648 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
649 * @param sa The shrink strategy to use upon falsification.
|
|
650 * @param sb The shrink strategy to use upon falsification.
|
|
651 * @param f The function to produce properties with results.
|
|
652 * @return A property where its result is derived from universal quantification across the
|
|
653 * application of its arguments.
|
|
654 */
|
|
655 public static <A, B> Property property(final Arbitrary<A> aa, final Arbitrary<B> ab, final Shrink<A> sa, final Shrink<B> sb, final F2<A, B, Property> f) {
|
|
656 return propertyP(aa, ab, sa, sb, compose2(P.<Property>p1(), curry(f)));
|
|
657 }
|
|
658
|
|
659 /**
|
|
660 * Returns a property where its result is derived from universal quantification across the
|
|
661 * application of its arguments. No shrinking occurs upon falsification.
|
|
662 *
|
|
663 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
664 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
665 * @param f The function to produce properties with results.
|
|
666 * @return A property where its result is derived from universal quantification across the
|
|
667 * application of its arguments.
|
|
668 */
|
|
669 public static <A, B> Property propertyP(final Arbitrary<A> aa, final Arbitrary<B> ab, final F2<A, B, P1<Property>> f) {
|
|
670 return propertyP(aa, ab, curry(f));
|
|
671 }
|
|
672
|
|
673 /**
|
|
674 * Returns a property where its result is derived from universal quantification across the
|
|
675 * application of its arguments. No shrinking occurs upon falsification.
|
|
676 *
|
|
677 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
678 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
679 * @param f The function to produce properties with results.
|
|
680 * @return A property where its result is derived from universal quantification across the
|
|
681 * application of its arguments.
|
|
682 */
|
|
683 public static <A, B> Property property(final Arbitrary<A> aa, final Arbitrary<B> ab, final F2<A, B, Property> f) {
|
|
684 return propertyP(aa, ab, compose2(P.<Property>p1(), curry(f)));
|
|
685 }
|
|
686
|
|
687 /**
|
|
688 * Returns a property where its result is derived from universal quantification across the
|
|
689 * application of its arguments.
|
|
690 *
|
|
691 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
692 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
693 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
694 * @param sa The shrink strategy to use upon falsification.
|
|
695 * @param sb The shrink strategy to use upon falsification.
|
|
696 * @param sc The shrink strategy to use upon falsification.
|
|
697 * @param f The function to produce properties with results.
|
|
698 * @return A property where its result is derived from universal quantification across the
|
|
699 * application of its arguments.
|
|
700 */
|
|
701 public static <A, B, C> Property property(final Arbitrary<A> aa,
|
|
702 final Arbitrary<B> ab,
|
|
703 final Arbitrary<C> ac,
|
|
704 final Shrink<A> sa,
|
|
705 final Shrink<B> sb,
|
|
706 final Shrink<C> sc,
|
|
707 final F<A, F<B, F<C, Property>>> f) {
|
|
708 return property(aa, ab, sa, sb, new F<A, F<B, Property>>() {
|
|
709 public F<B, Property> f(final A a) {
|
|
710 return new F<B, Property>() {
|
|
711 public Property f(final B b) {
|
|
712 return property(ac, sc, new F<C, Property>() {
|
|
713 public Property f(final C c) {
|
|
714 return f.f(a).f(b).f(c);
|
|
715 }
|
|
716 });
|
|
717 }
|
|
718 };
|
|
719 }
|
|
720 });
|
|
721 }
|
|
722
|
|
723 /**
|
|
724 * Returns a property where its result is derived from universal quantification across the
|
|
725 * application of its arguments. No shrinking occurs upon falsification.
|
|
726 *
|
|
727 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
728 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
729 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
730 * @param f The function to produce properties with results.
|
|
731 * @return A property where its result is derived from universal quantification across the
|
|
732 * application of its arguments.
|
|
733 */
|
|
734 public static <A, B, C> Property property(final Arbitrary<A> aa,
|
|
735 final Arbitrary<B> ab,
|
|
736 final Arbitrary<C> ac,
|
|
737 final F<A, F<B, F<C, Property>>> f) {
|
|
738 return property(aa, ab, new F<A, F<B, Property>>() {
|
|
739 public F<B, Property> f(final A a) {
|
|
740 return new F<B, Property>() {
|
|
741 public Property f(final B b) {
|
|
742 return property(ac, new F<C, Property>() {
|
|
743 public Property f(final C c) {
|
|
744 return f.f(a).f(b).f(c);
|
|
745 }
|
|
746 });
|
|
747 }
|
|
748 };
|
|
749 }
|
|
750 });
|
|
751 }
|
|
752
|
|
753 /**
|
|
754 * Returns a property where its result is derived from universal quantification across the
|
|
755 * application of its arguments.
|
|
756 *
|
|
757 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
758 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
759 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
760 * @param sa The shrink strategy to use upon falsification.
|
|
761 * @param sb The shrink strategy to use upon falsification.
|
|
762 * @param sc The shrink strategy to use upon falsification.
|
|
763 * @param f The function to produce properties with results.
|
|
764 * @return A property where its result is derived from universal quantification across the
|
|
765 * application of its arguments.
|
|
766 */
|
|
767 public static <A, B, C> Property property(final Arbitrary<A> aa,
|
|
768 final Arbitrary<B> ab,
|
|
769 final Arbitrary<C> ac,
|
|
770 final Shrink<A> sa,
|
|
771 final Shrink<B> sb,
|
|
772 final Shrink<C> sc,
|
|
773 final F3<A, B, C, Property> f) {
|
|
774 return property(aa, ab, ac, sa, sb, sc, curry(f));
|
|
775 }
|
|
776
|
|
777 /**
|
|
778 * Returns a property where its result is derived from universal quantification across the
|
|
779 * application of its arguments. No shrinking occurs upon falsification.
|
|
780 *
|
|
781 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
782 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
783 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
784 * @param f The function to produce properties with results.
|
|
785 * @return A property where its result is derived from universal quantification across the
|
|
786 * application of its arguments.
|
|
787 */
|
|
788 public static <A, B, C> Property property(final Arbitrary<A> aa,
|
|
789 final Arbitrary<B> ab,
|
|
790 final Arbitrary<C> ac,
|
|
791 final F3<A, B, C, Property> f) {
|
|
792 return property(aa, ab, ac, curry(f));
|
|
793 }
|
|
794
|
|
795 /**
|
|
796 * Returns a property where its result is derived from universal quantification across the
|
|
797 * application of its arguments.
|
|
798 *
|
|
799 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
800 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
801 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
802 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
803 * @param sa The shrink strategy to use upon falsification.
|
|
804 * @param sb The shrink strategy to use upon falsification.
|
|
805 * @param sc The shrink strategy to use upon falsification.
|
|
806 * @param sd The shrink strategy to use upon falsification.
|
|
807 * @param f The function to produce properties with results.
|
|
808 * @return A property where its result is derived from universal quantification across the
|
|
809 * application of its arguments.
|
|
810 */
|
|
811 public static <A, B, C, D> Property property(final Arbitrary<A> aa,
|
|
812 final Arbitrary<B> ab,
|
|
813 final Arbitrary<C> ac,
|
|
814 final Arbitrary<D> ad,
|
|
815 final Shrink<A> sa,
|
|
816 final Shrink<B> sb,
|
|
817 final Shrink<C> sc,
|
|
818 final Shrink<D> sd,
|
|
819 final F<A, F<B, F<C, F<D, Property>>>> f) {
|
|
820 return property(aa, ab, ac, sa, sb, sc, new F<A, F<B, F<C, Property>>>() {
|
|
821 public F<B, F<C, Property>> f(final A a) {
|
|
822 return new F<B, F<C, Property>>() {
|
|
823 public F<C, Property> f(final B b) {
|
|
824 return new F<C, Property>() {
|
|
825 public Property f(final C c) {
|
|
826 return property(ad, sd, new F<D, Property>() {
|
|
827 public Property f(final D d) {
|
|
828 return f.f(a).f(b).f(c).f(d);
|
|
829 }
|
|
830 });
|
|
831 }
|
|
832 };
|
|
833 }
|
|
834 };
|
|
835 }
|
|
836 });
|
|
837 }
|
|
838
|
|
839 /**
|
|
840 * Returns a property where its result is derived from universal quantification across the
|
|
841 * application of its arguments. No shrinking occurs upon falsification.
|
|
842 *
|
|
843 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
844 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
845 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
846 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
847 * @param f The function to produce properties with results.
|
|
848 * @return A property where its result is derived from universal quantification across the
|
|
849 * application of its arguments.
|
|
850 */
|
|
851 public static <A, B, C, D> Property property(final Arbitrary<A> aa,
|
|
852 final Arbitrary<B> ab,
|
|
853 final Arbitrary<C> ac,
|
|
854 final Arbitrary<D> ad,
|
|
855 final F<A, F<B, F<C, F<D, Property>>>> f) {
|
|
856 return property(aa, ab, ac, new F<A, F<B, F<C, Property>>>() {
|
|
857 public F<B, F<C, Property>> f(final A a) {
|
|
858 return new F<B, F<C, Property>>() {
|
|
859 public F<C, Property> f(final B b) {
|
|
860 return new F<C, Property>() {
|
|
861 public Property f(final C c) {
|
|
862 return property(ad, new F<D, Property>() {
|
|
863 public Property f(final D d) {
|
|
864 return f.f(a).f(b).f(c).f(d);
|
|
865 }
|
|
866 });
|
|
867 }
|
|
868 };
|
|
869 }
|
|
870 };
|
|
871 }
|
|
872 });
|
|
873 }
|
|
874
|
|
875 /**
|
|
876 * Returns a property where its result is derived from universal quantification across the
|
|
877 * application of its arguments.
|
|
878 *
|
|
879 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
880 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
881 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
882 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
883 * @param sa The shrink strategy to use upon falsification.
|
|
884 * @param sb The shrink strategy to use upon falsification.
|
|
885 * @param sc The shrink strategy to use upon falsification.
|
|
886 * @param sd The shrink strategy to use upon falsification.
|
|
887 * @param f The function to produce properties with results.
|
|
888 * @return A property where its result is derived from universal quantification across the
|
|
889 * application of its arguments.
|
|
890 */
|
|
891 public static <A, B, C, D> Property property(final Arbitrary<A> aa,
|
|
892 final Arbitrary<B> ab,
|
|
893 final Arbitrary<C> ac,
|
|
894 final Arbitrary<D> ad,
|
|
895 final Shrink<A> sa,
|
|
896 final Shrink<B> sb,
|
|
897 final Shrink<C> sc,
|
|
898 final Shrink<D> sd,
|
|
899 final F4<A, B, C, D, Property> f) {
|
|
900 return property(aa, ab, ac, ad, sa, sb, sc, sd, curry(f));
|
|
901 }
|
|
902
|
|
903 /**
|
|
904 * Returns a property where its result is derived from universal quantification across the
|
|
905 * application of its arguments. No shrinking occurs upon falsification.
|
|
906 *
|
|
907 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
908 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
909 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
910 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
911 * @param f The function to produce properties with results.
|
|
912 * @return A property where its result is derived from universal quantification across the
|
|
913 * application of its arguments.
|
|
914 */
|
|
915 public static <A, B, C, D> Property property(final Arbitrary<A> aa,
|
|
916 final Arbitrary<B> ab,
|
|
917 final Arbitrary<C> ac,
|
|
918 final Arbitrary<D> ad,
|
|
919 final F4<A, B, C, D, Property> f) {
|
|
920 return property(aa, ab, ac, ad, curry(f));
|
|
921 }
|
|
922
|
|
923 /**
|
|
924 * Returns a property where its result is derived from universal quantification across the
|
|
925 * application of its arguments.
|
|
926 *
|
|
927 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
928 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
929 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
930 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
931 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
932 * @param sa The shrink strategy to use upon falsification.
|
|
933 * @param sb The shrink strategy to use upon falsification.
|
|
934 * @param sc The shrink strategy to use upon falsification.
|
|
935 * @param sd The shrink strategy to use upon falsification.
|
|
936 * @param se The shrink strategy to use upon falsification.
|
|
937 * @param f The function to produce properties with results.
|
|
938 * @return A property where its result is derived from universal quantification across the
|
|
939 * application of its arguments.
|
|
940 */
|
|
941 public static <A, B, C, D, E> Property property(final Arbitrary<A> aa,
|
|
942 final Arbitrary<B> ab,
|
|
943 final Arbitrary<C> ac,
|
|
944 final Arbitrary<D> ad,
|
|
945 final Arbitrary<E> ae,
|
|
946 final Shrink<A> sa,
|
|
947 final Shrink<B> sb,
|
|
948 final Shrink<C> sc,
|
|
949 final Shrink<D> sd,
|
|
950 final Shrink<E> se,
|
|
951 final F<A, F<B, F<C, F<D, F<E, Property>>>>> f) {
|
|
952 return property(aa, ab, ac, ad, sa, sb, sc, sd, new F<A, F<B, F<C, F<D, Property>>>>() {
|
|
953 public F<B, F<C, F<D, Property>>> f(final A a) {
|
|
954 return new F<B, F<C, F<D, Property>>>() {
|
|
955 public F<C, F<D, Property>> f(final B b) {
|
|
956 return new F<C, F<D, Property>>() {
|
|
957 public F<D, Property> f(final C c) {
|
|
958 return new F<D, Property>() {
|
|
959 public Property f(final D d) {
|
|
960 return property(ae, se, new F<E, Property>() {
|
|
961 public Property f(final E e) {
|
|
962 return f.f(a).f(b).f(c).f(d).f(e);
|
|
963 }
|
|
964 });
|
|
965 }
|
|
966 };
|
|
967 }
|
|
968 };
|
|
969 }
|
|
970 };
|
|
971 }
|
|
972 });
|
|
973 }
|
|
974
|
|
975 /**
|
|
976 * Returns a property where its result is derived from universal quantification across the
|
|
977 * application of its arguments. No shrinking occurs upon falsification.
|
|
978 *
|
|
979 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
980 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
981 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
982 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
983 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
984 * @param f The function to produce properties with results.
|
|
985 * @return A property where its result is derived from universal quantification across the
|
|
986 * application of its arguments.
|
|
987 */
|
|
988 public static <A, B, C, D, E> Property property(final Arbitrary<A> aa,
|
|
989 final Arbitrary<B> ab,
|
|
990 final Arbitrary<C> ac,
|
|
991 final Arbitrary<D> ad,
|
|
992 final Arbitrary<E> ae,
|
|
993 final F<A, F<B, F<C, F<D, F<E, Property>>>>> f) {
|
|
994 return property(aa, ab, ac, ad, new F<A, F<B, F<C, F<D, Property>>>>() {
|
|
995 public F<B, F<C, F<D, Property>>> f(final A a) {
|
|
996 return new F<B, F<C, F<D, Property>>>() {
|
|
997 public F<C, F<D, Property>> f(final B b) {
|
|
998 return new F<C, F<D, Property>>() {
|
|
999 public F<D, Property> f(final C c) {
|
|
1000 return new F<D, Property>() {
|
|
1001 public Property f(final D d) {
|
|
1002 return property(ae, new F<E, Property>() {
|
|
1003 public Property f(final E e) {
|
|
1004 return f.f(a).f(b).f(c).f(d).f(e);
|
|
1005 }
|
|
1006 });
|
|
1007 }
|
|
1008 };
|
|
1009 }
|
|
1010 };
|
|
1011 }
|
|
1012 };
|
|
1013 }
|
|
1014 });
|
|
1015 }
|
|
1016
|
|
1017 /**
|
|
1018 * Returns a property where its result is derived from universal quantification across the
|
|
1019 * application of its arguments.
|
|
1020 *
|
|
1021 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1022 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1023 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1024 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1025 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1026 * @param sa The shrink strategy to use upon falsification.
|
|
1027 * @param sb The shrink strategy to use upon falsification.
|
|
1028 * @param sc The shrink strategy to use upon falsification.
|
|
1029 * @param sd The shrink strategy to use upon falsification.
|
|
1030 * @param se The shrink strategy to use upon falsification.
|
|
1031 * @param f The function to produce properties with results.
|
|
1032 * @return A property where its result is derived from universal quantification across the
|
|
1033 * application of its arguments.
|
|
1034 */
|
|
1035 public static <A, B, C, D, E> Property property(final Arbitrary<A> aa,
|
|
1036 final Arbitrary<B> ab,
|
|
1037 final Arbitrary<C> ac,
|
|
1038 final Arbitrary<D> ad,
|
|
1039 final Arbitrary<E> ae,
|
|
1040 final Shrink<A> sa,
|
|
1041 final Shrink<B> sb,
|
|
1042 final Shrink<C> sc,
|
|
1043 final Shrink<D> sd,
|
|
1044 final Shrink<E> se,
|
|
1045 final F5<A, B, C, D, E, Property> f) {
|
|
1046 return property(aa, ab, ac, ad, ae, sa, sb, sc, sd, se, curry(f));
|
|
1047 }
|
|
1048
|
|
1049 /**
|
|
1050 * Returns a property where its result is derived from universal quantification across the
|
|
1051 * application of its arguments. No shrinking occurs upon falsification.
|
|
1052 *
|
|
1053 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1054 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1055 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1056 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1057 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1058 * @param f The function to produce properties with results.
|
|
1059 * @return A property where its result is derived from universal quantification across the
|
|
1060 * application of its arguments.
|
|
1061 */
|
|
1062 public static <A, B, C, D, E> Property property(final Arbitrary<A> aa,
|
|
1063 final Arbitrary<B> ab,
|
|
1064 final Arbitrary<C> ac,
|
|
1065 final Arbitrary<D> ad,
|
|
1066 final Arbitrary<E> ae,
|
|
1067 final F5<A, B, C, D, E, Property> f) {
|
|
1068 return property(aa, ab, ac, ad, ae, curry(f));
|
|
1069 }
|
|
1070
|
|
1071 /**
|
|
1072 * Returns a property where its result is derived from universal quantification across the
|
|
1073 * application of its arguments.
|
|
1074 *
|
|
1075 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1076 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1077 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1078 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1079 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1080 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1081 * @param sa The shrink strategy to use upon falsification.
|
|
1082 * @param sb The shrink strategy to use upon falsification.
|
|
1083 * @param sc The shrink strategy to use upon falsification.
|
|
1084 * @param sd The shrink strategy to use upon falsification.
|
|
1085 * @param se The shrink strategy to use upon falsification.
|
|
1086 * @param sf The shrink strategy to use upon falsification.
|
|
1087 * @param f The function to produce properties with results.
|
|
1088 * @return A property where its result is derived from universal quantification across the
|
|
1089 * application of its arguments.
|
|
1090 */
|
|
1091 public static <A, B, C, D, E, F$> Property property(final Arbitrary<A> aa,
|
|
1092 final Arbitrary<B> ab,
|
|
1093 final Arbitrary<C> ac,
|
|
1094 final Arbitrary<D> ad,
|
|
1095 final Arbitrary<E> ae,
|
|
1096 final Arbitrary<F$> af,
|
|
1097 final Shrink<A> sa,
|
|
1098 final Shrink<B> sb,
|
|
1099 final Shrink<C> sc,
|
|
1100 final Shrink<D> sd,
|
|
1101 final Shrink<E> se,
|
|
1102 final Shrink<F$> sf,
|
|
1103 final F<A, F<B, F<C, F<D, F<E, F<F$, Property>>>>>> f) {
|
|
1104 return property(aa, ab, ac, ad, ae, sa, sb, sc, sd, se, new F<A, F<B, F<C, F<D, F<E, Property>>>>>() {
|
|
1105 public F<B, F<C, F<D, F<E, Property>>>> f(final A a) {
|
|
1106 return new F<B, F<C, F<D, F<E, Property>>>>() {
|
|
1107 public F<C, F<D, F<E, Property>>> f(final B b) {
|
|
1108 return new F<C, F<D, F<E, Property>>>() {
|
|
1109 public F<D, F<E, Property>> f(final C c) {
|
|
1110 return new F<D, F<E, Property>>() {
|
|
1111 public F<E, Property> f(final D d) {
|
|
1112 return new F<E, Property>() {
|
|
1113 public Property f(final E e) {
|
|
1114 return property(af, sf, new F<F$, Property>() {
|
|
1115 public Property f(final F$ f$) {
|
|
1116 return f.f(a).f(b).f(c).f(d).f(e).f(f$);
|
|
1117 }
|
|
1118 });
|
|
1119 }
|
|
1120 };
|
|
1121 }
|
|
1122 };
|
|
1123 }
|
|
1124 };
|
|
1125 }
|
|
1126 };
|
|
1127 }
|
|
1128 });
|
|
1129 }
|
|
1130
|
|
1131 /**
|
|
1132 * Returns a property where its result is derived from universal quantification across the
|
|
1133 * application of its arguments. No shrinking occurs upon falsification.
|
|
1134 *
|
|
1135 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1136 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1137 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1138 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1139 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1140 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1141 * @param f The function to produce properties with results.
|
|
1142 * @return A property where its result is derived from universal quantification across the
|
|
1143 * application of its arguments.
|
|
1144 */
|
|
1145 public static <A, B, C, D, E, F$> Property property(final Arbitrary<A> aa,
|
|
1146 final Arbitrary<B> ab,
|
|
1147 final Arbitrary<C> ac,
|
|
1148 final Arbitrary<D> ad,
|
|
1149 final Arbitrary<E> ae,
|
|
1150 final Arbitrary<F$> af,
|
|
1151 final F<A, F<B, F<C, F<D, F<E, F<F$, Property>>>>>> f) {
|
|
1152 return property(aa, ab, ac, ad, ae, new F<A, F<B, F<C, F<D, F<E, Property>>>>>() {
|
|
1153 public F<B, F<C, F<D, F<E, Property>>>> f(final A a) {
|
|
1154 return new F<B, F<C, F<D, F<E, Property>>>>() {
|
|
1155 public F<C, F<D, F<E, Property>>> f(final B b) {
|
|
1156 return new F<C, F<D, F<E, Property>>>() {
|
|
1157 public F<D, F<E, Property>> f(final C c) {
|
|
1158 return new F<D, F<E, Property>>() {
|
|
1159 public F<E, Property> f(final D d) {
|
|
1160 return new F<E, Property>() {
|
|
1161 public Property f(final E e) {
|
|
1162 return property(af, new F<F$, Property>() {
|
|
1163 public Property f(final F$ f$) {
|
|
1164 return f.f(a).f(b).f(c).f(d).f(e).f(f$);
|
|
1165 }
|
|
1166 });
|
|
1167 }
|
|
1168 };
|
|
1169 }
|
|
1170 };
|
|
1171 }
|
|
1172 };
|
|
1173 }
|
|
1174 };
|
|
1175 }
|
|
1176 });
|
|
1177 }
|
|
1178
|
|
1179 /**
|
|
1180 * Returns a property where its result is derived from universal quantification across the
|
|
1181 * application of its arguments.
|
|
1182 *
|
|
1183 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1184 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1185 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1186 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1187 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1188 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1189 * @param sa The shrink strategy to use upon falsification.
|
|
1190 * @param sb The shrink strategy to use upon falsification.
|
|
1191 * @param sc The shrink strategy to use upon falsification.
|
|
1192 * @param sd The shrink strategy to use upon falsification.
|
|
1193 * @param se The shrink strategy to use upon falsification.
|
|
1194 * @param sf The shrink strategy to use upon falsification.
|
|
1195 * @param f The function to produce properties with results.
|
|
1196 * @return A property where its result is derived from universal quantification across the
|
|
1197 * application of its arguments.
|
|
1198 */
|
|
1199 public static <A, B, C, D, E, F$> Property property(final Arbitrary<A> aa,
|
|
1200 final Arbitrary<B> ab,
|
|
1201 final Arbitrary<C> ac,
|
|
1202 final Arbitrary<D> ad,
|
|
1203 final Arbitrary<E> ae,
|
|
1204 final Arbitrary<F$> af,
|
|
1205 final Shrink<A> sa,
|
|
1206 final Shrink<B> sb,
|
|
1207 final Shrink<C> sc,
|
|
1208 final Shrink<D> sd,
|
|
1209 final Shrink<E> se,
|
|
1210 final Shrink<F$> sf,
|
|
1211 final F6<A, B, C, D, E, F$, Property> f) {
|
|
1212 return property(aa, ab, ac, ad, ae, af, sa, sb, sc, sd, se, sf, curry(f));
|
|
1213 }
|
|
1214
|
|
1215 /**
|
|
1216 * Returns a property where its result is derived from universal quantification across the
|
|
1217 * application of its arguments. No shrinking occurs upon falsification.
|
|
1218 *
|
|
1219 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1220 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1221 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1222 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1223 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1224 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1225 * @param f The function to produce properties with results.
|
|
1226 * @return A property where its result is derived from universal quantification across the
|
|
1227 * application of its arguments.
|
|
1228 */
|
|
1229 public static <A, B, C, D, E, F$> Property property(final Arbitrary<A> aa,
|
|
1230 final Arbitrary<B> ab,
|
|
1231 final Arbitrary<C> ac,
|
|
1232 final Arbitrary<D> ad,
|
|
1233 final Arbitrary<E> ae,
|
|
1234 final Arbitrary<F$> af,
|
|
1235 final F6<A, B, C, D, E, F$, Property> f) {
|
|
1236 return property(aa, ab, ac, ad, ae, af, curry(f));
|
|
1237 }
|
|
1238
|
|
1239 /**
|
|
1240 * Returns a property where its result is derived from universal quantification across the
|
|
1241 * application of its arguments.
|
|
1242 *
|
|
1243 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1244 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1245 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1246 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1247 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1248 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1249 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1250 * @param sa The shrink strategy to use upon falsification.
|
|
1251 * @param sb The shrink strategy to use upon falsification.
|
|
1252 * @param sc The shrink strategy to use upon falsification.
|
|
1253 * @param sd The shrink strategy to use upon falsification.
|
|
1254 * @param se The shrink strategy to use upon falsification.
|
|
1255 * @param sf The shrink strategy to use upon falsification.
|
|
1256 * @param sg The shrink strategy to use upon falsification.
|
|
1257 * @param f The function to produce properties with results.
|
|
1258 * @return A property where its result is derived from universal quantification across the
|
|
1259 * application of its arguments.
|
|
1260 */
|
|
1261 public static <A, B, C, D, E, F$, G> Property property(final Arbitrary<A> aa,
|
|
1262 final Arbitrary<B> ab,
|
|
1263 final Arbitrary<C> ac,
|
|
1264 final Arbitrary<D> ad,
|
|
1265 final Arbitrary<E> ae,
|
|
1266 final Arbitrary<F$> af,
|
|
1267 final Arbitrary<G> ag,
|
|
1268 final Shrink<A> sa,
|
|
1269 final Shrink<B> sb,
|
|
1270 final Shrink<C> sc,
|
|
1271 final Shrink<D> sd,
|
|
1272 final Shrink<E> se,
|
|
1273 final Shrink<F$> sf,
|
|
1274 final Shrink<G> sg,
|
|
1275 final F<A, F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>>> f) {
|
|
1276 return property(aa, ab, ac, ad, ae, af, sa, sb, sc, sd, se, sf, new F<A, F<B, F<C, F<D, F<E, F<F$, Property>>>>>>() {
|
|
1277 public F<B, F<C, F<D, F<E, F<F$, Property>>>>> f(final A a) {
|
|
1278 return new F<B, F<C, F<D, F<E, F<F$, Property>>>>>() {
|
|
1279 public F<C, F<D, F<E, F<F$, Property>>>> f(final B b) {
|
|
1280 return new F<C, F<D, F<E, F<F$, Property>>>>() {
|
|
1281 public F<D, F<E, F<F$, Property>>> f(final C c) {
|
|
1282 return new F<D, F<E, F<F$, Property>>>() {
|
|
1283 public F<E, F<F$, Property>> f(final D d) {
|
|
1284 return new F<E, F<F$, Property>>() {
|
|
1285 public F<F$, Property> f(final E e) {
|
|
1286 return new F<F$, Property>() {
|
|
1287 public Property f(final F$ f$) {
|
|
1288 return property(ag, sg, new F<G, Property>() {
|
|
1289 public Property f(final G g) {
|
|
1290 return f.f(a).f(b).f(c).f(d).f(e).f(f$).f(g);
|
|
1291 }
|
|
1292 });
|
|
1293 }
|
|
1294 };
|
|
1295 }
|
|
1296 };
|
|
1297 }
|
|
1298 };
|
|
1299 }
|
|
1300 };
|
|
1301 }
|
|
1302 };
|
|
1303 }
|
|
1304 });
|
|
1305 }
|
|
1306
|
|
1307 /**
|
|
1308 * Returns a property where its result is derived from universal quantification across the
|
|
1309 * application of its arguments. No shrinking occurs upon falsification.
|
|
1310 *
|
|
1311 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1312 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1313 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1314 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1315 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1316 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1317 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1318 * @param f The function to produce properties with results.
|
|
1319 * @return A property where its result is derived from universal quantification across the
|
|
1320 * application of its arguments.
|
|
1321 */
|
|
1322 public static <A, B, C, D, E, F$, G> Property property(final Arbitrary<A> aa,
|
|
1323 final Arbitrary<B> ab,
|
|
1324 final Arbitrary<C> ac,
|
|
1325 final Arbitrary<D> ad,
|
|
1326 final Arbitrary<E> ae,
|
|
1327 final Arbitrary<F$> af,
|
|
1328 final Arbitrary<G> ag,
|
|
1329 final F<A, F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>>> f) {
|
|
1330 return property(aa, ab, ac, ad, ae, af, new F<A, F<B, F<C, F<D, F<E, F<F$, Property>>>>>>() {
|
|
1331 public F<B, F<C, F<D, F<E, F<F$, Property>>>>> f(final A a) {
|
|
1332 return new F<B, F<C, F<D, F<E, F<F$, Property>>>>>() {
|
|
1333 public F<C, F<D, F<E, F<F$, Property>>>> f(final B b) {
|
|
1334 return new F<C, F<D, F<E, F<F$, Property>>>>() {
|
|
1335 public F<D, F<E, F<F$, Property>>> f(final C c) {
|
|
1336 return new F<D, F<E, F<F$, Property>>>() {
|
|
1337 public F<E, F<F$, Property>> f(final D d) {
|
|
1338 return new F<E, F<F$, Property>>() {
|
|
1339 public F<F$, Property> f(final E e) {
|
|
1340 return new F<F$, Property>() {
|
|
1341 public Property f(final F$ f$) {
|
|
1342 return property(ag, new F<G, Property>() {
|
|
1343 public Property f(final G g) {
|
|
1344 return f.f(a).f(b).f(c).f(d).f(e).f(f$).f(g);
|
|
1345 }
|
|
1346 });
|
|
1347 }
|
|
1348 };
|
|
1349 }
|
|
1350 };
|
|
1351 }
|
|
1352 };
|
|
1353 }
|
|
1354 };
|
|
1355 }
|
|
1356 };
|
|
1357 }
|
|
1358 });
|
|
1359 }
|
|
1360
|
|
1361 /**
|
|
1362 * Returns a property where its result is derived from universal quantification across the
|
|
1363 * application of its arguments.
|
|
1364 *
|
|
1365 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1366 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1367 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1368 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1369 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1370 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1371 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1372 * @param sa The shrink strategy to use upon falsification.
|
|
1373 * @param sb The shrink strategy to use upon falsification.
|
|
1374 * @param sc The shrink strategy to use upon falsification.
|
|
1375 * @param sd The shrink strategy to use upon falsification.
|
|
1376 * @param se The shrink strategy to use upon falsification.
|
|
1377 * @param sf The shrink strategy to use upon falsification.
|
|
1378 * @param sg The shrink strategy to use upon falsification.
|
|
1379 * @param f The function to produce properties with results.
|
|
1380 * @return A property where its result is derived from universal quantification across the
|
|
1381 * application of its arguments.
|
|
1382 */
|
|
1383 public static <A, B, C, D, E, F$, G> Property property(final Arbitrary<A> aa,
|
|
1384 final Arbitrary<B> ab,
|
|
1385 final Arbitrary<C> ac,
|
|
1386 final Arbitrary<D> ad,
|
|
1387 final Arbitrary<E> ae,
|
|
1388 final Arbitrary<F$> af,
|
|
1389 final Arbitrary<G> ag,
|
|
1390 final Shrink<A> sa,
|
|
1391 final Shrink<B> sb,
|
|
1392 final Shrink<C> sc,
|
|
1393 final Shrink<D> sd,
|
|
1394 final Shrink<E> se,
|
|
1395 final Shrink<F$> sf,
|
|
1396 final Shrink<G> sg,
|
|
1397 final F7<A, B, C, D, E, F$, G, Property> f) {
|
|
1398 return property(aa, ab, ac, ad, ae, af, ag, sa, sb, sc, sd, se, sf, sg, curry(f));
|
|
1399 }
|
|
1400
|
|
1401 /**
|
|
1402 * Returns a property where its result is derived from universal quantification across the
|
|
1403 * application of its arguments. No shrinking occurs upon falsification.
|
|
1404 *
|
|
1405 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1406 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1407 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1408 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1409 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1410 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1411 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1412 * @param f The function to produce properties with results.
|
|
1413 * @return A property where its result is derived from universal quantification across the
|
|
1414 * application of its arguments.
|
|
1415 */
|
|
1416 public static <A, B, C, D, E, F$, G> Property property(final Arbitrary<A> aa,
|
|
1417 final Arbitrary<B> ab,
|
|
1418 final Arbitrary<C> ac,
|
|
1419 final Arbitrary<D> ad,
|
|
1420 final Arbitrary<E> ae,
|
|
1421 final Arbitrary<F$> af,
|
|
1422 final Arbitrary<G> ag,
|
|
1423 final F7<A, B, C, D, E, F$, G, Property> f) {
|
|
1424 return property(aa, ab, ac, ad, ae, af, ag, curry(f));
|
|
1425 }
|
|
1426
|
|
1427 /**
|
|
1428 * Returns a property where its result is derived from universal quantification across the
|
|
1429 * application of its arguments.
|
|
1430 *
|
|
1431 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1432 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1433 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1434 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1435 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1436 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1437 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1438 * @param ah The arbitrrary to produces values from to produce the property with.
|
|
1439 * @param sa The shrink strategy to use upon falsification.
|
|
1440 * @param sb The shrink strategy to use upon falsification.
|
|
1441 * @param sc The shrink strategy to use upon falsification.
|
|
1442 * @param sd The shrink strategy to use upon falsification.
|
|
1443 * @param se The shrink strategy to use upon falsification.
|
|
1444 * @param sf The shrink strategy to use upon falsification.
|
|
1445 * @param sg The shrink strategy to use upon falsification.
|
|
1446 * @param sh The shrink strategy to use upon falsification.
|
|
1447 * @param f The function to produce properties with results.
|
|
1448 * @return A property where its result is derived from universal quantification across the
|
|
1449 * application of its arguments.
|
|
1450 */
|
|
1451 public static <A, B, C, D, E, F$, G, H> Property property(final Arbitrary<A> aa,
|
|
1452 final Arbitrary<B> ab,
|
|
1453 final Arbitrary<C> ac,
|
|
1454 final Arbitrary<D> ad,
|
|
1455 final Arbitrary<E> ae,
|
|
1456 final Arbitrary<F$> af,
|
|
1457 final Arbitrary<G> ag,
|
|
1458 final Arbitrary<H> ah,
|
|
1459 final Shrink<A> sa,
|
|
1460 final Shrink<B> sb,
|
|
1461 final Shrink<C> sc,
|
|
1462 final Shrink<D> sd,
|
|
1463 final Shrink<E> se,
|
|
1464 final Shrink<F$> sf,
|
|
1465 final Shrink<G> sg,
|
|
1466 final Shrink<H> sh,
|
|
1467 final F<A, F<B, F<C, F<D, F<E, F<F$, F<G, F<H, Property>>>>>>>> f) {
|
|
1468 return property(aa, ab, ac, ad, ae, af, ag, sa, sb, sc, sd, se, sf, sg, new F<A, F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>>>() {
|
|
1469 public F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>> f(final A a) {
|
|
1470 return new F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>>() {
|
|
1471 public F<C, F<D, F<E, F<F$, F<G, Property>>>>> f(final B b) {
|
|
1472 return new F<C, F<D, F<E, F<F$, F<G, Property>>>>>() {
|
|
1473 public F<D, F<E, F<F$, F<G, Property>>>> f(final C c) {
|
|
1474 return new F<D, F<E, F<F$, F<G, Property>>>>() {
|
|
1475 public F<E, F<F$, F<G, Property>>> f(final D d) {
|
|
1476 return new F<E, F<F$, F<G, Property>>>() {
|
|
1477 public F<F$, F<G, Property>> f(final E e) {
|
|
1478 return new F<F$, F<G, Property>>() {
|
|
1479 public F<G, Property> f(final F$ f$) {
|
|
1480 return new F<G, Property>() {
|
|
1481 public Property f(final G g) {
|
|
1482 return property(ah, sh, new F<H, Property>() {
|
|
1483 public Property f(final H h) {
|
|
1484 return f.f(a).f(b).f(c).f(d).f(e).f(f$).f(g).f(h);
|
|
1485 }
|
|
1486 });
|
|
1487 }
|
|
1488 };
|
|
1489 }
|
|
1490 };
|
|
1491 }
|
|
1492 };
|
|
1493 }
|
|
1494 };
|
|
1495 }
|
|
1496 };
|
|
1497 }
|
|
1498 };
|
|
1499 }
|
|
1500 });
|
|
1501 }
|
|
1502
|
|
1503 /**
|
|
1504 * Returns a property where its result is derived from universal quantification across the
|
|
1505 * application of its arguments. No shrinking occurs upon falsification.
|
|
1506 *
|
|
1507 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1508 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1509 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1510 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1511 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1512 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1513 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1514 * @param ah The arbitrrary to produces values from to produce the property with.
|
|
1515 * @param f The function to produce properties with results.
|
|
1516 * @return A property where its result is derived from universal quantification across the
|
|
1517 * application of its arguments.
|
|
1518 */
|
|
1519 public static <A, B, C, D, E, F$, G, H> Property property(final Arbitrary<A> aa,
|
|
1520 final Arbitrary<B> ab,
|
|
1521 final Arbitrary<C> ac,
|
|
1522 final Arbitrary<D> ad,
|
|
1523 final Arbitrary<E> ae,
|
|
1524 final Arbitrary<F$> af,
|
|
1525 final Arbitrary<G> ag,
|
|
1526 final Arbitrary<H> ah,
|
|
1527 final F<A, F<B, F<C, F<D, F<E, F<F$, F<G, F<H, Property>>>>>>>> f) {
|
|
1528 return property(aa, ab, ac, ad, ae, af, ag, new F<A, F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>>>() {
|
|
1529 public F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>> f(final A a) {
|
|
1530 return new F<B, F<C, F<D, F<E, F<F$, F<G, Property>>>>>>() {
|
|
1531 public F<C, F<D, F<E, F<F$, F<G, Property>>>>> f(final B b) {
|
|
1532 return new F<C, F<D, F<E, F<F$, F<G, Property>>>>>() {
|
|
1533 public F<D, F<E, F<F$, F<G, Property>>>> f(final C c) {
|
|
1534 return new F<D, F<E, F<F$, F<G, Property>>>>() {
|
|
1535 public F<E, F<F$, F<G, Property>>> f(final D d) {
|
|
1536 return new F<E, F<F$, F<G, Property>>>() {
|
|
1537 public F<F$, F<G, Property>> f(final E e) {
|
|
1538 return new F<F$, F<G, Property>>() {
|
|
1539 public F<G, Property> f(final F$ f$) {
|
|
1540 return new F<G, Property>() {
|
|
1541 public Property f(final G g) {
|
|
1542 return property(ah, new F<H, Property>() {
|
|
1543 public Property f(final H h) {
|
|
1544 return f.f(a).f(b).f(c).f(d).f(e).f(f$).f(g).f(h);
|
|
1545 }
|
|
1546 });
|
|
1547 }
|
|
1548 };
|
|
1549 }
|
|
1550 };
|
|
1551 }
|
|
1552 };
|
|
1553 }
|
|
1554 };
|
|
1555 }
|
|
1556 };
|
|
1557 }
|
|
1558 };
|
|
1559 }
|
|
1560 });
|
|
1561 }
|
|
1562
|
|
1563 /**
|
|
1564 * Returns a property where its result is derived from universal quantification across the
|
|
1565 * application of its arguments.
|
|
1566 *
|
|
1567 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1568 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1569 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1570 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1571 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1572 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1573 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1574 * @param ah The arbitrrary to produces values from to produce the property with.
|
|
1575 * @param sa The shrink strategy to use upon falsification.
|
|
1576 * @param sb The shrink strategy to use upon falsification.
|
|
1577 * @param sc The shrink strategy to use upon falsification.
|
|
1578 * @param sd The shrink strategy to use upon falsification.
|
|
1579 * @param se The shrink strategy to use upon falsification.
|
|
1580 * @param sf The shrink strategy to use upon falsification.
|
|
1581 * @param sg The shrink strategy to use upon falsification.
|
|
1582 * @param sh The shrink strategy to use upon falsification.
|
|
1583 * @param f The function to produce properties with results.
|
|
1584 * @return A property where its result is derived from universal quantification across the
|
|
1585 * application of its arguments.
|
|
1586 */
|
|
1587 public static <A, B, C, D, E, F$, G, H> Property property(final Arbitrary<A> aa,
|
|
1588 final Arbitrary<B> ab,
|
|
1589 final Arbitrary<C> ac,
|
|
1590 final Arbitrary<D> ad,
|
|
1591 final Arbitrary<E> ae,
|
|
1592 final Arbitrary<F$> af,
|
|
1593 final Arbitrary<G> ag,
|
|
1594 final Arbitrary<H> ah,
|
|
1595 final Shrink<A> sa,
|
|
1596 final Shrink<B> sb,
|
|
1597 final Shrink<C> sc,
|
|
1598 final Shrink<D> sd,
|
|
1599 final Shrink<E> se,
|
|
1600 final Shrink<F$> sf,
|
|
1601 final Shrink<G> sg,
|
|
1602 final Shrink<H> sh,
|
|
1603 final F8<A, B, C, D, E, F$, G, H, Property> f) {
|
|
1604 return property(aa, ab, ac, ad, ae, af, ag, ah, sa, sb, sc, sd, se, sf, sg, sh, curry(f));
|
|
1605 }
|
|
1606
|
|
1607 /**
|
|
1608 * Returns a property where its result is derived from universal quantification across the
|
|
1609 * application of its arguments. No shrinking occurs upon falsification.
|
|
1610 *
|
|
1611 * @param aa The arbitrrary to produces values from to produce the property with.
|
|
1612 * @param ab The arbitrrary to produces values from to produce the property with.
|
|
1613 * @param ac The arbitrrary to produces values from to produce the property with.
|
|
1614 * @param ad The arbitrrary to produces values from to produce the property with.
|
|
1615 * @param ae The arbitrrary to produces values from to produce the property with.
|
|
1616 * @param af The arbitrrary to produces values from to produce the property with.
|
|
1617 * @param ag The arbitrrary to produces values from to produce the property with.
|
|
1618 * @param ah The arbitrrary to produces values from to produce the property with.
|
|
1619 * @param f The function to produce properties with results.
|
|
1620 * @return A property where its result is derived from universal quantification across the
|
|
1621 * application of its arguments.
|
|
1622 */
|
|
1623 public static <A, B, C, D, E, F$, G, H> Property property(final Arbitrary<A> aa,
|
|
1624 final Arbitrary<B> ab,
|
|
1625 final Arbitrary<C> ac,
|
|
1626 final Arbitrary<D> ad,
|
|
1627 final Arbitrary<E> ae,
|
|
1628 final Arbitrary<F$> af,
|
|
1629 final Arbitrary<G> ag,
|
|
1630 final Arbitrary<H> ah,
|
|
1631 final F8<A, B, C, D, E, F$, G, H, Property> f) {
|
|
1632 return property(aa, ab, ac, ad, ae, af, ag, ah, curry(f));
|
|
1633 }
|
|
1634
|
|
1635 /**
|
|
1636 * Returns a property that has a result of exception, if the evaluation of the given property
|
|
1637 * throws an exception; otherwise, the given property is returned.
|
|
1638 *
|
|
1639 * @param p A property to evaluate to check for an exception.
|
|
1640 * @return A property that has a result of exception, if the evaluation of the given property
|
|
1641 * throws an exception; otherwise, the given property is returned.
|
|
1642 */
|
|
1643 public static Property exception(final P1<Property> p) {
|
|
1644 try {
|
|
1645 return p._1();
|
|
1646 } catch (final Throwable t) {
|
|
1647 return new Property(new F<Integer, F<Rand, Result>>() {
|
|
1648 public F<Rand, Result> f(final Integer i) {
|
|
1649 return new F<Rand, Result>() {
|
|
1650 public Result f(final Rand r) {
|
|
1651 return Result.exception(List.<Arg<?>>nil(), t);
|
|
1652 }
|
|
1653 };
|
|
1654 }
|
|
1655 });
|
|
1656 }
|
|
1657 }
|
|
1658
|
|
1659
|
|
1660
|
|
1661 }
|