summary refs log tree commit diff stats
path: root/tests/stdlib/tpermutations.nim
diff options
context:
space:
mode:
authorSimon Hafner <hafnersimon@gmail.com>2015-03-05 14:44:54 -0600
committerSimon Hafner <hafnersimon@gmail.com>2015-03-05 14:44:54 -0600
commit70eaf92ff0493ed11c6e6c8887bca1b235371aff (patch)
tree530255b69df349728c76621e97bf40a11d63fe79 /tests/stdlib/tpermutations.nim
parentf592240c545506448e2bea78a2fa3404c7f46e69 (diff)
parent8f43979cf6308c9d7e14a0d87c0faf227e1c4afe (diff)
downloadNim-70eaf92ff0493ed11c6e6c8887bca1b235371aff.tar.gz
Merge branch 'devel' into warning-for-result
Diffstat (limited to 'tests/stdlib/tpermutations.nim')
-rw-r--r--tests/stdlib/tpermutations.nim19
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