Adapt the tester for permutations

Uses the bool return value now
This commit is contained in:
def 2015-02-02 08:06:19 +01:00
commit 03db4d2930

View file

@ -1,17 +1,19 @@
discard """ discard """
output: '''@[0, 1, 2, 3, 4, 5, 6, 7, 9, 8] output: '''@[0, 2, 1]
@[0, 1, 2, 3, 4, 5, 6, 8, 7, 9] @[1, 0, 2]
@[0, 1, 2, 3, 4, 5, 6, 8, 9, 7] @[1, 2, 0]
@[0, 1, 2, 3, 4, 5, 6, 8, 7, 9] @[2, 0, 1]
@[0, 1, 2, 3, 4, 5, 6, 7, 9, 8] @[2, 1, 0]
@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]''' @[2, 0, 1]
@[1, 2, 0]
@[1, 0, 2]
@[0, 2, 1]
@[0, 1, 2]'''
""" """
import algorithm import algorithm
var v = @[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] var v = @[0, 1, 2]
for i in 1..3: while v.nextPermutation():
v.nextPermutation()
echo v echo v
for i in 1..3: while v.prevPermutation():
v.prevPermutation()
echo v echo v