mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-26 09:32:59 +00:00
78 lines
2.6 KiB
Python
78 lines
2.6 KiB
Python
|
from advent22_api.core.helpers import spread
|
||
|
|
||
|
|
||
|
def test_easy() -> None:
|
||
|
assert spread([1, 4], 0) == []
|
||
|
assert spread([1, 4], 1) == [2]
|
||
|
assert spread([1, 4], 2) == [2, 3]
|
||
|
assert spread([1, 4], 5) == [2, 3, 1, 2, 3]
|
||
|
assert spread([1, 4], 10) == [2, 3, 1, 2, 3, 4, 1, 2, 3, 4]
|
||
|
|
||
|
|
||
|
def test_tight() -> None:
|
||
|
assert spread([1, 2], 0) == []
|
||
|
assert spread([1, 2], 1) == [1]
|
||
|
assert spread([1, 2], 2) == [1, 2]
|
||
|
assert spread([1, 2], 5) == [1, 2, 1, 2, 1]
|
||
|
assert spread([1, 2], 10) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]
|
||
|
|
||
|
assert spread([1, 2, 3, 4, 5], 0) == []
|
||
|
assert spread([1, 2, 3, 4, 5], 1) == [1]
|
||
|
assert spread([1, 2, 3, 4, 5], 2) == [1, 2]
|
||
|
assert spread([1, 2, 3, 4, 5], 5) == [1, 2, 3, 4, 5]
|
||
|
assert spread([1, 2, 3, 4, 5], 10) == [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
|
||
|
|
||
|
|
||
|
def test_more_given() -> None:
|
||
|
assert spread([0, 5, 10], 0) == []
|
||
|
assert spread([0, 5, 10], 1) == [1]
|
||
|
assert spread([0, 5, 10], 2) == [1, 2]
|
||
|
assert spread([0, 5, 10], 5) == [1, 2, 3, 4, 6]
|
||
|
assert spread([0, 5, 10], 10) == [1, 2, 3, 4, 6, 7, 8, 9, 0, 1]
|
||
|
|
||
|
assert spread([0, 1, 2, 5, 10], 0) == []
|
||
|
assert spread([0, 1, 2, 5, 10], 1) == [3]
|
||
|
assert spread([0, 1, 2, 5, 10], 2) == [3, 4]
|
||
|
assert spread([0, 1, 2, 5, 10], 5) == [3, 4, 6, 7, 8]
|
||
|
assert spread([0, 1, 2, 5, 10], 10) == [3, 4, 6, 7, 8, 9, 0, 1, 2, 3]
|
||
|
|
||
|
|
||
|
def test_one_given() -> None:
|
||
|
assert spread([0], 0) == []
|
||
|
assert spread([0], 1) == [1]
|
||
|
assert spread([0], 2) == [1, 2]
|
||
|
assert spread([0], 5) == [1, 2, 3, 4, 5]
|
||
|
assert spread([0], 10) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||
|
|
||
|
assert spread([1], 0) == []
|
||
|
assert spread([1], 1) == [1]
|
||
|
assert spread([1], 2) == [1, 1]
|
||
|
assert spread([1], 5) == [1, 1, 1, 1, 1]
|
||
|
assert spread([1], 10) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||
|
|
||
|
assert spread([2], 0) == []
|
||
|
assert spread([2], 1) == [1]
|
||
|
assert spread([2], 2) == [1, 1]
|
||
|
assert spread([2], 5) == [1, 1, 2, 1, 2]
|
||
|
assert spread([2], 10) == [1, 1, 2, 1, 2, 1, 2, 1, 2, 1]
|
||
|
|
||
|
assert spread([5], 0) == []
|
||
|
assert spread([5], 1) == [1]
|
||
|
assert spread([5], 2) == [1, 2]
|
||
|
assert spread([5], 5) == [1, 2, 3, 4, 1]
|
||
|
assert spread([5], 10) == [1, 2, 3, 4, 1, 2, 3, 4, 5, 1]
|
||
|
|
||
|
assert spread([10], 0) == []
|
||
|
assert spread([10], 1) == [1]
|
||
|
assert spread([10], 2) == [1, 2]
|
||
|
assert spread([10], 5) == [1, 2, 3, 4, 5]
|
||
|
assert spread([10], 10) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]
|
||
|
|
||
|
|
||
|
def test_none_given() -> None:
|
||
|
assert spread([], 0) == []
|
||
|
assert spread([], 1) == [1]
|
||
|
assert spread([], 2) == [1, 2]
|
||
|
assert spread([], 5) == [1, 2, 3, 4, 5]
|
||
|
assert spread([], 10) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|