product more robust against empty input

This commit is contained in:
Simon Hafner
2014-01-30 23:55:43 -06:00
parent f070edb8b9
commit e01fb17d02
2 changed files with 6 additions and 0 deletions

View File

@@ -1,6 +1,11 @@
import unittest
import algorithm
suite "product":
test "empty input":
check product[int](newSeq[seq[int]]()) == newSeq[seq[int]]()
test "bit more empty input":
check product[int](@[newSeq[int](), @[], @[]]) == newSeq[seq[int]]()
test "a simple case of one element":
check product(@[@[1,2]]) == @[@[1,2]]
test "two elements":