|
8 | 8 | import fj.data.PriorityQueue; |
9 | 9 | import fj.data.Set; |
10 | 10 | import fj.test.Arbitrary; |
| 11 | +import fj.test.Gen; |
11 | 12 | import fj.test.Property; |
12 | 13 | import fj.test.reflect.CheckParams; |
13 | 14 | import fj.test.runner.PropertyTestRunner; |
|
18 | 19 | import static fj.test.Arbitrary.arbAlphaNumString; |
19 | 20 | import static fj.test.Arbitrary.arbInteger; |
20 | 21 | import static fj.test.Arbitrary.arbSet; |
21 | | -import static fj.test.Arbitrary.arbitrary; |
22 | 22 | import static fj.test.Property.impliesBoolean; |
23 | 23 | import static fj.test.Property.prop; |
24 | 24 | import static fj.test.Property.property; |
|
32 | 32 | @CheckParams(maxSize = 100) |
33 | 33 | public class PriorityQueueProperties { |
34 | 34 |
|
35 | | - public static Arbitrary<PriorityQueue<Integer, String>> arbPriorityQueueIntegerString = arbUniqueQueue(arbAlphaNumString); |
| 35 | + public static Gen<PriorityQueue<Integer, String>> arbPriorityQueueIntegerString = arbUniqueQueue(arbAlphaNumString); |
36 | 36 |
|
37 | | - public static <A> Arbitrary<PriorityQueue<Integer, A>> arbUniqueQueue(Arbitrary<A> aa) { |
38 | | - Arbitrary<Set<Integer>> as = arbSet(Ord.intOrd, arbInteger); |
39 | | - Arbitrary<List<Integer>> ints = arbitrary(as.gen.map(si -> si.toList())); |
40 | | - Arbitrary<List<P2<Integer, A>>> alp = arbitrary( |
41 | | - ints.gen.bind(li -> aa.gen.map(s -> li.map(i -> P.p(i, s)))) |
| 37 | + public static <A> Gen<PriorityQueue<Integer, A>> arbUniqueQueue(Gen<A> aa) { |
| 38 | + Gen<Set<Integer>> as = arbSet(Ord.intOrd, arbInteger); |
| 39 | + Gen<List<Integer>> ints = (as.map(si -> si.toList())); |
| 40 | + Gen<List<P2<Integer, A>>> alp = ( |
| 41 | + ints.bind(li -> aa.map(s -> li.map(i -> P.p(i, s)))) |
42 | 42 | ); |
43 | | - return arbitrary(alp.gen.map(l -> PriorityQueue.<A>emptyInt().enqueue(l))); |
| 43 | + return (alp.map(l -> PriorityQueue.<A>emptyInt().enqueue(l))); |
44 | 44 | } |
45 | 45 |
|
46 | 46 | Property empty() { |
@@ -75,10 +75,10 @@ Property addTop() { |
75 | 75 | } |
76 | 76 |
|
77 | 77 | Property sorted() { |
78 | | - Arbitrary<Set<Integer>> as = arbSet(Ord.intOrd, arbInteger); |
79 | | - Arbitrary<List<Integer>> ints = arbitrary(as.gen.map(si -> si.toList())); |
80 | | - Arbitrary<List<P2<Integer, String>>> alp = arbitrary( |
81 | | - ints.gen.bind(li -> arbAlphaNumString.gen.map(s -> li.map(i -> P.p(i, s)))) |
| 78 | + Gen<Set<Integer>> as = arbSet(Ord.intOrd, arbInteger); |
| 79 | + Gen<List<Integer>> ints = (as.map(si -> si.toList())); |
| 80 | + Gen<List<P2<Integer, String>>> alp = ( |
| 81 | + ints.bind(li -> arbAlphaNumString.map(s -> li.map(i -> P.p(i, s)))) |
82 | 82 | ); |
83 | 83 | return property(alp, list -> { |
84 | 84 | PriorityQueue<Integer, String> q = PriorityQueue.<String>emptyInt().enqueue(list); |
|
0 commit comments