2 import fields2cover
as f2c
4 PARAMETRIZED_INPUTS = [
5 (5, [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]),
6 (10, range(10), range(10))
9 PARAMETRIZED_INPUTS_WRONG = [
10 (5, [0, 1, 2, 3, 4], [1, 2, 3, 4, 5]),
11 (5, [0, 1, 2, 3, 4], [1, 1, 2, 2, 4]),
12 (10, range(10), range(1,11))
15 @pytest.mark.parametrize(
'n,custom_order,expected', PARAMETRIZED_INPUTS)
29 swath_order = f2c.RP_CustomOrder(f2c.VectorSize(custom_order))
30 swaths = swath_order.genSortedSwaths(swaths)
32 actual = [swaths.at(i).getId()
for i
in range(swaths.size())]
33 assert len(actual) == len(expected)
34 assert all(a == b
for a, b
in zip(actual, expected))
36 @pytest.mark.parametrize(
'n,custom_order,expected', PARAMETRIZED_INPUTS_WRONG)
43 f2c.VectorPoint([f2c.Point(0, i),
44 f2c.Point(1, i)])), 1, i))
45 swath_order = f2c.RP_CustomOrder(f2c.VectorSize(custom_order))
46 swaths = swath_order.genSortedSwaths(swaths)
47 actual = [swaths.at(i).getId()
for i
in range(swaths.size())]
48 assert any(a != b
for a, b
in zip(actual, expected))