added Cartesian product
This commit is contained in:
parent
47e2999fec
commit
ac0f15379c
2 changed files with 41 additions and 0 deletions
9
tests/stdlib/talgorithm.nim
Normal file
9
tests/stdlib/talgorithm.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import unittest
|
||||
|
||||
suite "product":
|
||||
test "a simple case of one element":
|
||||
check product(@[@[1,2]]) == @[@[1,2]]
|
||||
test "two elements":
|
||||
check product(@[@[1,2], @[3,4]]) == @[@[2,4],@[1,4],@[2,3],@[1,3]]
|
||||
test "three elements":
|
||||
check 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]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue