Skip to content

Commit

Permalink
#5: Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pol Dellaiera authored and Pol Dellaiera committed Apr 3, 2017
1 parent 9a00d4e commit 932bfdf
Show file tree
Hide file tree
Showing 29 changed files with 622 additions and 1,190 deletions.
7 changes: 7 additions & 0 deletions src/Iterators/FiniteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ class FiniteGroup extends Combinatorics implements \Iterator, \Countable {
*/
protected $key;

/**
* Combinatorics constructor.
*/
public function __construct() {
parent::__construct(array(), NULL);
}

/**
* {@inheritdoc}
*/
Expand Down
58 changes: 58 additions & 0 deletions tests/fixtures/combinations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
-
input:
dataset:
[1, 2, 3, 4, 5]
length: 5
output:
dataset:
- [1, 2, 3, 4, 5]
count: 1

-
input:
dataset:
[1, 2, 3, 4, 5]
length: 3
output:
dataset:
- [1, 2, 3]
- [1, 2, 4]
- [1, 2, 5]
- [1, 3, 4]
- [1, 3, 5]
- [1, 4, 5]
- [2, 3, 4]
- [2, 3, 5]
- [2, 4, 5]
- [3, 4, 5]
count: 10

-
input:
dataset:
[1, 2, 3, 4, 5]
length: 4
output:
dataset:
- [1, 2, 3 ,4]
- [1, 2, 3 ,5]
- [1, 2, 4 ,5]
- [1, 3, 4 ,5]
- [2, 3, 4 ,5]
count: 5

-
input:
dataset:
- ['element 1']
- ['element 2']
- ['element 3']
- ['element 4']
length: 3
output:
dataset:
- [['element 1'], ['element 2'], ['element 3']]
- [['element 1'], ['element 2'], ['element 4']]
- [['element 1'], ['element 3'], ['element 4']]
- [['element 2'], ['element 3'], ['element 4']]
count: 4
23 changes: 23 additions & 0 deletions tests/fixtures/cycle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-
input:
dataset: [1, 2, 3, 4, 5]
turn: 1
output:
current: 2
count: 5

-
input:
dataset: [1, 2, 3, 4, 5]
turn: 6
output:
current: 2
count: 5

-
input:
dataset: [1, 2, 3, 4, 5, 6]
turn: 8
output:
current: 3
count: 6
6 changes: 6 additions & 0 deletions tests/fixtures/fibonacci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-
input:
max: 1000
output:
dataset: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987]
count: 17
6 changes: 6 additions & 0 deletions tests/fixtures/finitegroup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-
input:
size: 10
output:
dataset: [1, 2, 4, 5, 7, 8]
count: 6
18 changes: 18 additions & 0 deletions tests/fixtures/perfect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-
input:
min: 0
max: 1000
output:
dataset:
- 6
- 28
- 496
count: 3
-
input:
min: 500
max: 10000
output:
dataset:
- 8128
count: 1
194 changes: 194 additions & 0 deletions tests/fixtures/permutations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
-
input:
dataset: [1, 2, 3, 4, 5]
length: 5
output:
dataset:
- [1, 2, 3, 4, 5]
- [2, 1, 3, 4, 5]
- [1, 3, 2, 4, 5]
- [3, 1, 2, 4, 5]
- [2, 3, 1, 4, 5]
- [3, 2, 1, 4, 5]
- [1, 2, 4, 3, 5]
- [2, 1, 4, 3, 5]
- [1, 4, 2, 3, 5]
- [4, 1, 2, 3, 5]
- [2, 4, 1, 3, 5]
- [4, 2, 1, 3, 5]
- [1, 3, 4, 2, 5]
- [3, 1, 4, 2, 5]
- [1, 4, 3, 2, 5]
- [4, 1, 3, 2, 5]
- [3, 4, 1, 2, 5]
- [4, 3, 1, 2, 5]
- [2, 3, 4, 1, 5]
- [3, 2, 4, 1, 5]
- [2, 4, 3, 1, 5]
- [4, 2, 3, 1, 5]
- [3, 4, 2, 1, 5]
- [4, 3, 2, 1, 5]
- [1, 2, 3, 5, 4]
- [2, 1, 3, 5, 4]
- [1, 3, 2, 5, 4]
- [3, 1, 2, 5, 4]
- [2, 3, 1, 5, 4]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, 2]
- [2, 3, 5]
- [2, 5, 3]
- [3, 2, 5]
- [3, 5, 2]
- [5, 2, 3]
- [5, 3, 2]
- [2, 4, 5]
- [2, 5, 4]
- [4, 2, 5]
- [4, 5, 2]
- [5, 2, 4]
- [5, 4, 2]
- [3, 4, 5]
- [3, 5, 4]
- [4, 3, 5]
- [4, 5, 3]
- [5, 3, 4]
- [5, 4, 3]
count: 60
14 changes: 14 additions & 0 deletions tests/fixtures/prime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-
input:
min: 1
max: 1000
output:
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]
count: 168
-
input:
min: 50
max: 100
output:
dataset: [53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
count: 10
18 changes: 18 additions & 0 deletions tests/fixtures/primefactors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-
input:
number: 643455
output:
dataset: [3, 3, 5, 79, 181]
count: 5
-
input:
number: 29
output:
dataset: [29]
count: 1
-
input:
number: 100
output:
dataset: [2, 2, 5, 5]
count: 4
Loading

0 comments on commit 932bfdf

Please sign in to comment.