Skip to content

Commit

Permalink
extend Array#permutations: test
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkdoor committed Nov 15, 2013
1 parent af2a438 commit 27583ce
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/array.fy
Expand Up @@ -572,11 +572,15 @@ FancySpec describe: Array with: {
}

it: "returns an array of permutations of self" with: 'permutations: when: {
[] permutations to_a is: [[]]
[] permutations: 0 . to_a is: [[]]
[1] permutations to_a is: [[1]]
[1,2] permutations to_a is: [[1,2], [2,1]]
[1,2,3] permutations to_a is: \
[] permutations to_a is: [[]]
[] permutations: 0 . to_a is: [[]]
[1] permutations to_a is: [[1]]
[1,2] permutations to_a is: [[1,2], [2,1]]

[1,2,3] permutations: 2 . to_a is: \
[[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]]

[1,2,3] permutations to_a is: \
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
}
}

0 comments on commit 27583ce

Please sign in to comment.