Skip to content

Commit 932bfdf

Browse files
Pol DellaieraPol Dellaiera
authored andcommitted
#5: Update tests.
1 parent 9a00d4e commit 932bfdf

29 files changed

+622
-1190
lines changed

src/Iterators/FiniteGroup.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ class FiniteGroup extends Combinatorics implements \Iterator, \Countable {
3434
*/
3535
protected $key;
3636

37+
/**
38+
* Combinatorics constructor.
39+
*/
40+
public function __construct() {
41+
parent::__construct(array(), NULL);
42+
}
43+
3744
/**
3845
* {@inheritdoc}
3946
*/

tests/fixtures/combinations.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
-
2+
input:
3+
dataset:
4+
[1, 2, 3, 4, 5]
5+
length: 5
6+
output:
7+
dataset:
8+
- [1, 2, 3, 4, 5]
9+
count: 1
10+
11+
-
12+
input:
13+
dataset:
14+
[1, 2, 3, 4, 5]
15+
length: 3
16+
output:
17+
dataset:
18+
- [1, 2, 3]
19+
- [1, 2, 4]
20+
- [1, 2, 5]
21+
- [1, 3, 4]
22+
- [1, 3, 5]
23+
- [1, 4, 5]
24+
- [2, 3, 4]
25+
- [2, 3, 5]
26+
- [2, 4, 5]
27+
- [3, 4, 5]
28+
count: 10
29+
30+
-
31+
input:
32+
dataset:
33+
[1, 2, 3, 4, 5]
34+
length: 4
35+
output:
36+
dataset:
37+
- [1, 2, 3 ,4]
38+
- [1, 2, 3 ,5]
39+
- [1, 2, 4 ,5]
40+
- [1, 3, 4 ,5]
41+
- [2, 3, 4 ,5]
42+
count: 5
43+
44+
-
45+
input:
46+
dataset:
47+
- ['element 1']
48+
- ['element 2']
49+
- ['element 3']
50+
- ['element 4']
51+
length: 3
52+
output:
53+
dataset:
54+
- [['element 1'], ['element 2'], ['element 3']]
55+
- [['element 1'], ['element 2'], ['element 4']]
56+
- [['element 1'], ['element 3'], ['element 4']]
57+
- [['element 2'], ['element 3'], ['element 4']]
58+
count: 4

tests/fixtures/cycle.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-
2+
input:
3+
dataset: [1, 2, 3, 4, 5]
4+
turn: 1
5+
output:
6+
current: 2
7+
count: 5
8+
9+
-
10+
input:
11+
dataset: [1, 2, 3, 4, 5]
12+
turn: 6
13+
output:
14+
current: 2
15+
count: 5
16+
17+
-
18+
input:
19+
dataset: [1, 2, 3, 4, 5, 6]
20+
turn: 8
21+
output:
22+
current: 3
23+
count: 6

tests/fixtures/fibonacci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-
2+
input:
3+
max: 1000
4+
output:
5+
dataset: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987]
6+
count: 17

tests/fixtures/finitegroup.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-
2+
input:
3+
size: 10
4+
output:
5+
dataset: [1, 2, 4, 5, 7, 8]
6+
count: 6

tests/fixtures/perfect.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-
2+
input:
3+
min: 0
4+
max: 1000
5+
output:
6+
dataset:
7+
- 6
8+
- 28
9+
- 496
10+
count: 3
11+
-
12+
input:
13+
min: 500
14+
max: 10000
15+
output:
16+
dataset:
17+
- 8128
18+
count: 1

tests/fixtures/permutations.yml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
-
2+
input:
3+
dataset: [1, 2, 3, 4, 5]
4+
length: 5
5+
output:
6+
dataset:
7+
- [1, 2, 3, 4, 5]
8+
- [2, 1, 3, 4, 5]
9+
- [1, 3, 2, 4, 5]
10+
- [3, 1, 2, 4, 5]
11+
- [2, 3, 1, 4, 5]
12+
- [3, 2, 1, 4, 5]
13+
- [1, 2, 4, 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]
65+
- [2, 5, 1, 4, 3]
66+
- [5, 2, 1, 4, 3]
67+
- [1, 4, 5, 2, 3]
68+
- [4, 1, 5, 2, 3]
69+
- [1, 5, 4, 2, 3]
70+
- [5, 1, 4, 2, 3]
71+
- [4, 5, 1, 2, 3]
72+
- [5, 4, 1, 2, 3]
73+
- [2, 4, 5, 1, 3]
74+
- [4, 2, 5, 1, 3]
75+
- [2, 5, 4, 1, 3]
76+
- [5, 2, 4, 1, 3]
77+
- [4, 5, 2, 1, 3]
78+
- [5, 4, 2, 1, 3]
79+
- [1, 3, 4, 5, 2]
80+
- [3, 1, 4, 5, 2]
81+
- [1, 4, 3, 5, 2]
82+
- [4, 1, 3, 5, 2]
83+
- [3, 4, 1, 5, 2]
84+
- [4, 3, 1, 5, 2]
85+
- [1, 3, 5, 4, 2]
86+
- [3, 1, 5, 4, 2]
87+
- [1, 5, 3, 4, 2]
88+
- [5, 1, 3, 4, 2]
89+
- [3, 5, 1, 4, 2]
90+
- [5, 3, 1, 4, 2]
91+
- [1, 4, 5, 3, 2]
92+
- [4, 1, 5, 3, 2]
93+
- [1, 5, 4, 3, 2]
94+
- [5, 1, 4, 3, 2]
95+
- [4, 5, 1, 3, 2]
96+
- [5, 4, 1, 3, 2]
97+
- [3, 4, 5, 1, 2]
98+
- [4, 3, 5, 1, 2]
99+
- [3, 5, 4, 1, 2]
100+
- [5, 3, 4, 1, 2]
101+
- [4, 5, 3, 1, 2]
102+
- [5, 4, 3, 1, 2]
103+
- [2, 3, 4, 5, 1]
104+
- [3, 2, 4, 5, 1]
105+
- [2, 4, 3, 5, 1]
106+
- [4, 2, 3, 5, 1]
107+
- [3, 4, 2, 5, 1]
108+
- [4, 3, 2, 5, 1]
109+
- [2, 3, 5, 4, 1]
110+
- [3, 2, 5, 4, 1]
111+
- [2, 5, 3, 4, 1]
112+
- [5, 2, 3, 4, 1]
113+
- [3, 5, 2, 4, 1]
114+
- [5, 3, 2, 4, 1]
115+
- [2, 4, 5, 3, 1]
116+
- [4, 2, 5, 3, 1]
117+
- [2, 5, 4, 3, 1]
118+
- [5, 2, 4, 3, 1]
119+
- [4, 5, 2, 3, 1]
120+
- [5, 4, 2, 3, 1]
121+
- [3, 4, 5, 2, 1]
122+
- [4, 3, 5, 2, 1]
123+
- [3, 5, 4, 2, 1]
124+
- [5, 3, 4, 2, 1]
125+
- [4, 5, 3, 2, 1]
126+
- [5, 4, 3, 2, 1]
127+
count: 120
128+
-
129+
input:
130+
dataset: [1, 2, 3, 4, 5]
131+
length: 3
132+
output:
133+
dataset:
134+
- [1, 2, 3]
135+
- [1, 3, 2]
136+
- [2, 1, 3]
137+
- [2, 3, 1]
138+
- [3, 1, 2]
139+
- [3, 2, 1]
140+
- [1, 2, 4]
141+
- [1, 4, 2]
142+
- [2, 1, 4]
143+
- [2, 4, 1]
144+
- [4, 1, 2]
145+
- [4, 2, 1]
146+
- [1, 2, 5]
147+
- [1, 5, 2]
148+
- [2, 1, 5]
149+
- [2, 5, 1]
150+
- [5, 1, 2]
151+
- [5, 2, 1]
152+
- [1, 3, 4]
153+
- [1, 4, 3]
154+
- [3, 1, 4]
155+
- [3, 4, 1]
156+
- [4, 1, 3]
157+
- [4, 3, 1]
158+
- [1, 3, 5]
159+
- [1, 5, 3]
160+
- [3, 1, 5]
161+
- [3, 5, 1]
162+
- [5, 1, 3]
163+
- [5, 3, 1]
164+
- [1, 4, 5]
165+
- [1, 5, 4]
166+
- [4, 1, 5]
167+
- [4, 5, 1]
168+
- [5, 1, 4]
169+
- [5, 4, 1]
170+
- [2, 3, 4]
171+
- [2, 4, 3]
172+
- [3, 2, 4]
173+
- [3, 4, 2]
174+
- [4, 2, 3]
175+
- [4, 3, 2]
176+
- [2, 3, 5]
177+
- [2, 5, 3]
178+
- [3, 2, 5]
179+
- [3, 5, 2]
180+
- [5, 2, 3]
181+
- [5, 3, 2]
182+
- [2, 4, 5]
183+
- [2, 5, 4]
184+
- [4, 2, 5]
185+
- [4, 5, 2]
186+
- [5, 2, 4]
187+
- [5, 4, 2]
188+
- [3, 4, 5]
189+
- [3, 5, 4]
190+
- [4, 3, 5]
191+
- [4, 5, 3]
192+
- [5, 3, 4]
193+
- [5, 4, 3]
194+
count: 60

tests/fixtures/prime.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-
2+
input:
3+
min: 1
4+
max: 1000
5+
output:
6+
dataset: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
7+
count: 168
8+
-
9+
input:
10+
min: 50
11+
max: 100
12+
output:
13+
dataset: [53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
14+
count: 10

tests/fixtures/primefactors.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-
2+
input:
3+
number: 643455
4+
output:
5+
dataset: [3, 3, 5, 79, 181]
6+
count: 5
7+
-
8+
input:
9+
number: 29
10+
output:
11+
dataset: [29]
12+
count: 1
13+
-
14+
input:
15+
number: 100
16+
output:
17+
dataset: [2, 2, 5, 5]
18+
count: 4

0 commit comments

Comments
 (0)