add symmetric iteration routine, related to #5
This commit is contained in:
25
tests/test_iteration.py
Normal file
25
tests/test_iteration.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from dopt_basics import iteration
|
||||
|
||||
|
||||
def test_symmetric_iter_1():
|
||||
l1_in = [1, 2, 3, 4, 5, 6]
|
||||
l1_out = [1, 6, 2, 5, 3, 4]
|
||||
|
||||
l1_calc = list(iteration.symmetric_iter(l1_in))
|
||||
assert len(l1_in) == len(l1_calc)
|
||||
assert len(l1_out) == len(l1_calc)
|
||||
|
||||
for truth, calc in zip(l1_out, l1_calc):
|
||||
assert truth == calc
|
||||
|
||||
|
||||
def test_symmetric_iter_2():
|
||||
l1_in = [1, 2, 3, 4, 5]
|
||||
l1_out = [1, 5, 2, 4, 3]
|
||||
|
||||
l1_calc = list(iteration.symmetric_iter(l1_in))
|
||||
assert len(l1_in) == len(l1_calc)
|
||||
assert len(l1_out) == len(l1_calc)
|
||||
|
||||
for truth, calc in zip(l1_out, l1_calc):
|
||||
assert truth == calc
|
||||
Reference in New Issue
Block a user