summary refs log tree commit diff stats
path: root/tests/stdlib/talgorithm.nim
diff options
context:
space:
mode:
authorMichał Zieliński <michal@zielinscy.org.pl>2014-02-09 15:34:18 +0100
committerMichał Zieliński <michal@zielinscy.org.pl>2014-02-09 15:34:18 +0100
commit820fdd634870686082ad01896327f67cf45cd96f (patch)
treeffe146b77359f616d25a28b85ab2ba8efd604f4c /tests/stdlib/talgorithm.nim
parent11053afff83e00bb04be05590a169ed79ce5f0d3 (diff)
parente6a50307bb505304b37147417ba2a93586d59a51 (diff)
downloadNim-820fdd634870686082ad01896327f67cf45cd96f.tar.gz
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
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"