diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-04-30 16:09:27 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-04-30 16:09:27 +0100 |
commit | 0be654efe11311fcf1200c0e7dba9ecd55fa5591 (patch) | |
tree | 7f55b6c5f467a7094fb0978841a08a9b1764f0c3 /tests/stdlib/tpermutations.nim | |
parent | 4e778f9aac184655135daaff6579ef4a553d225a (diff) | |
parent | d9d5aa60b7df936ffe6149143c7202604f71465f (diff) | |
download | Nim-0be654efe11311fcf1200c0e7dba9ecd55fa5591.tar.gz |
Merge branch 'devel'
Diffstat (limited to 'tests/stdlib/tpermutations.nim')
-rw-r--r-- | tests/stdlib/tpermutations.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/stdlib/tpermutations.nim b/tests/stdlib/tpermutations.nim new file mode 100644 index 000000000..a6e07ded6 --- /dev/null +++ b/tests/stdlib/tpermutations.nim @@ -0,0 +1,19 @@ +discard """ + output: '''@[0, 2, 1] +@[1, 0, 2] +@[1, 2, 0] +@[2, 0, 1] +@[2, 1, 0] +@[2, 0, 1] +@[1, 2, 0] +@[1, 0, 2] +@[0, 2, 1] +@[0, 1, 2]''' +""" +import algorithm + +var v = @[0, 1, 2] +while v.nextPermutation(): + echo v +while v.prevPermutation(): + echo v |