77import static fj .Ord .charOrd ;
88import static fj .data .List .list ;
99import static fj .data .List .range ;
10- import static fj .test .Gen .pickCombinationWithReplacement ;
11- import static fj .test .Gen .pickCombinationWithoutReplacement ;
12- import static fj .test .Gen .pickPermutationWithReplacement ;
13- import static fj .test .Gen .pickPermutationWithoutReplacement ;
10+ import static fj .test .Gen .selectionOf ;
11+ import static fj .test .Gen .combinationOf ;
12+ import static fj .test .Gen .wordOf ;
13+ import static fj .test .Gen .permutationOf ;
1414import static fj .test .Rand .standard ;
1515import static org .junit .Assert .assertEquals ;
1616import static org .junit .Assert .assertTrue ;
1717
18- public final class TestGen {
18+ public final class GenTest {
1919
2020 private static final List <Character > AS = list ('A' , 'B' , 'C' );
2121
2222 @ Test
23- public void testPickCombinationWithoutReplacement_none () {
24- Gen <List <Character >> instance = pickCombinationWithoutReplacement (0 , AS );
23+ public void testCombinationOf_none () {
24+ Gen <List <Character >> instance = combinationOf (0 , AS );
2525 testPick (100 , instance , actual -> {
2626 assertTrue (actual .isEmpty ());
2727 });
2828 }
2929
3030 @ Test
31- public void testPickCombinationWithoutReplacement_one () {
32- Gen <List <Character >> instance = pickCombinationWithoutReplacement (1 , AS );
31+ public void testCombinationOf_one () {
32+ Gen <List <Character >> instance = combinationOf (1 , AS );
3333 testPick (100 , instance , actual -> {
3434 assertEquals (1 , actual .length ());
3535 assertTrue (AS .exists (a -> a .equals (actual .head ())));
3636 });
3737 }
3838
3939 @ Test
40- public void testPickCombinationWithoutReplacement_two () {
41- Gen <List <Character >> instance = pickCombinationWithoutReplacement (2 , AS );
40+ public void testCombinationOf_two () {
41+ Gen <List <Character >> instance = combinationOf (2 , AS );
4242 testPick (100 , instance , actual -> {
4343 assertEquals (2 , actual .length ());
4444 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
@@ -47,8 +47,8 @@ public void testPickCombinationWithoutReplacement_two() {
4747 }
4848
4949 @ Test
50- public void testPickCombinationWithoutReplacement_three () {
51- Gen <List <Character >> instance = pickCombinationWithoutReplacement (3 , AS );
50+ public void testCombinationOf_three () {
51+ Gen <List <Character >> instance = combinationOf (3 , AS );
5252 testPick (100 , instance , actual -> {
5353 assertEquals (3 , actual .length ());
5454 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
@@ -57,25 +57,25 @@ public void testPickCombinationWithoutReplacement_three() {
5757 }
5858
5959 @ Test
60- public void testPickCombinationWithReplacement_none () {
61- Gen <List <Character >> instance = pickCombinationWithReplacement (0 , AS );
60+ public void testSelectionOf_none () {
61+ Gen <List <Character >> instance = selectionOf (0 , AS );
6262 testPick (100 , instance , actual -> {
6363 assertTrue (actual .isEmpty ());
6464 });
6565 }
6666
6767 @ Test
68- public void testPickCombinationWithReplacement_one () {
69- Gen <List <Character >> instance = pickCombinationWithReplacement (1 , AS );
68+ public void testSelectionOf_one () {
69+ Gen <List <Character >> instance = selectionOf (1 , AS );
7070 testPick (100 , instance , actual -> {
7171 assertEquals (1 , actual .length ());
7272 assertTrue (AS .exists (a -> a .equals (actual .head ())));
7373 });
7474 }
7575
7676 @ Test
77- public void testPickCombinationWithReplacement_two () {
78- Gen <List <Character >> instance = pickCombinationWithReplacement (2 , AS );
77+ public void testSelectionOf_two () {
78+ Gen <List <Character >> instance = selectionOf (2 , AS );
7979 testPick (100 , instance , actual -> {
8080 assertEquals (2 , actual .length ());
8181 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
@@ -84,8 +84,8 @@ public void testPickCombinationWithReplacement_two() {
8484 }
8585
8686 @ Test
87- public void testPickCombinationWithReplacement_three () {
88- Gen <List <Character >> instance = pickCombinationWithReplacement (3 , AS );
87+ public void testSelectionOf_three () {
88+ Gen <List <Character >> instance = selectionOf (3 , AS );
8989 testPick (100 , instance , actual -> {
9090 assertEquals (3 , actual .length ());
9191 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
@@ -94,8 +94,8 @@ public void testPickCombinationWithReplacement_three() {
9494 }
9595
9696 @ Test
97- public void testPickCombinationWithReplacement_four () {
98- Gen <List <Character >> instance = pickCombinationWithReplacement (4 , AS );
97+ public void testSelectionOf_four () {
98+ Gen <List <Character >> instance = selectionOf (4 , AS );
9999 testPick (100 , instance , actual -> {
100100 assertEquals (4 , actual .length ());
101101 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
@@ -104,34 +104,34 @@ public void testPickCombinationWithReplacement_four() {
104104 }
105105
106106 @ Test
107- public void testPickPermutationWithoutReplacement_none () {
108- Gen <List <Character >> instance = pickPermutationWithoutReplacement (0 , AS );
107+ public void testPermutationOf_none () {
108+ Gen <List <Character >> instance = permutationOf (0 , AS );
109109 testPick (100 , instance , actual -> {
110110 assertTrue (actual .isEmpty ());
111111 });
112112 }
113113
114114 @ Test
115- public void testPickPermutationWithoutReplacement_one () {
116- Gen <List <Character >> instance = pickPermutationWithoutReplacement (1 , AS );
115+ public void testPermutationOf_one () {
116+ Gen <List <Character >> instance = permutationOf (1 , AS );
117117 testPick (100 , instance , actual -> {
118118 assertEquals (1 , actual .length ());
119119 assertTrue (AS .exists (a -> a .equals (actual .head ())));
120120 });
121121 }
122122
123123 @ Test
124- public void testPickPermutationWithoutReplacement_two () {
125- Gen <List <Character >> instance = pickCombinationWithoutReplacement (2 , AS );
124+ public void testPermutationOf_two () {
125+ Gen <List <Character >> instance = combinationOf (2 , AS );
126126 testPick (100 , instance , actual -> {
127127 assertEquals (2 , actual .length ());
128128 assertTrue (actual .tails ().forall (l -> l .isEmpty () || l .tail ().forall (a -> !a .equals (l .head ()))));
129129 });
130130 }
131131
132132 @ Test
133- public void testPickPermutationWithoutReplacement_three () {
134- Gen <List <Character >> instance = pickPermutationWithoutReplacement (3 , AS );
133+ public void testPermutationOf_three () {
134+ Gen <List <Character >> instance = permutationOf (3 , AS );
135135 testPick (100 , instance , actual -> {
136136 assertEquals (3 , actual .length ());
137137 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
@@ -140,51 +140,51 @@ public void testPickPermutationWithoutReplacement_three() {
140140 }
141141
142142 @ Test
143- public void testPickPermutationWithReplacement_none () {
144- Gen <List <Character >> instance = pickPermutationWithReplacement (0 , AS );
143+ public void testWordOf_none () {
144+ Gen <List <Character >> instance = wordOf (0 , AS );
145145 testPick (100 , instance , actual -> {
146146 assertTrue (actual .isEmpty ());
147147 });
148148 }
149149
150150 @ Test
151- public void testPickPermutationWithReplacement_one () {
152- Gen <List <Character >> instance = pickPermutationWithReplacement (1 , AS );
151+ public void testWordOf_one () {
152+ Gen <List <Character >> instance = wordOf (1 , AS );
153153 testPick (100 , instance , actual -> {
154154 assertEquals (1 , actual .length ());
155155 assertTrue (AS .exists (a -> a .equals (actual .head ())));
156156 });
157157 }
158158
159159 @ Test
160- public void testPickPermutationWithReplacement_two () {
161- Gen <List <Character >> instance = pickPermutationWithReplacement (2 , AS );
160+ public void testWordOf_two () {
161+ Gen <List <Character >> instance = wordOf (2 , AS );
162162 testPick (100 , instance , actual -> {
163163 assertEquals (2 , actual .length ());
164164 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
165165 });
166166 }
167167
168168 @ Test
169- public void testPickPermutationWithReplacement_three () {
170- Gen <List <Character >> instance = pickPermutationWithReplacement (3 , AS );
169+ public void testWordOf_three () {
170+ Gen <List <Character >> instance = wordOf (3 , AS );
171171 testPick (100 , instance , actual -> {
172172 assertEquals (3 , actual .length ());
173173 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
174174 });
175175 }
176176
177177 @ Test
178- public void testPickPermutationWithReplacement_four () {
179- Gen <List <Character >> instance = pickPermutationWithReplacement (4 , AS );
178+ public void testWordOf_four () {
179+ Gen <List <Character >> instance = wordOf (4 , AS );
180180 testPick (100 , instance , actual -> {
181181 assertEquals (4 , actual .length ());
182182 assertTrue (actual .forall (actualA -> AS .exists (a -> a .equals (actualA ))));
183183 });
184184 }
185185
186186 private static <A > void testPick (int n , Gen <List <A >> instance , Effect1 <List <A >> test ) {
187- range (0 , n ).map (i -> instance .gen (0 , standard )).foreachDoEffect (test ::f );
187+ range (0 , n ).map (ignore -> instance .gen (0 , standard )).foreachDoEffect (test ::f );
188188 }
189189
190190}
0 commit comments