summary refs log tree commit diff stats
path: root/tests/stdlib/talgorithm.nim
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2014-02-08 15:59:42 +0000
committerDominik Picheta <dominikpicheta@googlemail.com>2014-02-08 15:59:42 +0000
commita3f3efa1ba9e8d95acdf81e4bd07aa180c383906 (patch)
tree7a54f1d10f122256421c8654e3513b03679a2da6 /tests/stdlib/talgorithm.nim
parent471c0aa6349b7ad41d70b64ed370106bed9f0d01 (diff)
parenta70235daaa2b73bfc04fa53583be56adefd1deb8 (diff)
downloadNim-a3f3efa1ba9e8d95acdf81e4bd07aa180c383906.tar.gz
Merge branch 'devel' into newasync
Diffstat (limited to 'tests/stdlib/talgorithm.nim')
-rw-r--r--tests/stdlib/talgorithm.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/stdlib/talgorithm.nim b/tests/stdlib/talgorithm.nim
new file mode 100644
index 000000000..7ab652c82
--- /dev/null
+++ b/tests/stdlib/talgorithm.nim
@@ -0,0 +1,8 @@
+import algorithm
+
+doAssert product[int](newSeq[seq[int]]()) == newSeq[seq[int]](), "empty input"
+doAssert product[int](@[newSeq[int](), @[], @[]]) == newSeq[seq[int]](), "bit more empty input"
+doAssert product(@[@[1,2]]) == @[@[1,2]], "a simple case of one element"
+doAssert product(@[@[1,2], @[3,4]]) == @[@[2,4],@[1,4],@[2,3],@[1,3]], "two elements"
+doAssert product(@[@[1,2], @[3,4], @[5,6]]) == @[@[2,4,6],@[1,4,6],@[2,3,6],@[1,3,6], @[2,4,5],@[1,4,5],@[2,3,5],@[1,3,5]], "three elements"
+doAssert product(@[@[1,2], @[]]) == newSeq[seq[int]](), "two elements, but one empty"