21 lines
466 B
Python
21 lines
466 B
Python
from calorie_counting import parse, group_sums, max_calories, top_three
|
|
|
|
BEISPIEL = "1\n2\n\n5\n\n3\n4\n\n10\n\n6\n"
|
|
|
|
|
|
def test_parse():
|
|
# Drei Gruppen: zwei Zahlen, eine Zahl, zwei Zahlen usw.
|
|
assert parse("1\n2\n\n5") == [[1, 2], [5]]
|
|
|
|
|
|
def test_group_sums():
|
|
assert group_sums(BEISPIEL) == [3, 5, 7, 10, 6]
|
|
|
|
|
|
def test_max_calories():
|
|
assert max_calories(BEISPIEL) == 10
|
|
|
|
|
|
def test_top_three():
|
|
# 10 + 7 + 6
|
|
assert top_three(BEISPIEL) == 23 |