diff --git a/Project 1/utilities.py b/Project 1/utilities.py index 1219252..aa01c6d 100644 --- a/Project 1/utilities.py +++ b/Project 1/utilities.py @@ -12,4 +12,15 @@ def sum_cards_recursive(cards: list[Card]) -> int: if cards == []: return 0 return cards[0] + sum_cards_recursive(cards[1:]) -#Added for project 2: Created a function to sum a list of Card objects using recursion. \ No newline at end of file +#Added for project 2: Created a function to sum a list of Card objects using recursion. + +def test_sum_cards(): + cards = [ + Card("diamond", 5), + Card("clubs", 3), + Card("spade", 12), + Card("clubs", 1) + ] + assert sum_cards_iter(cards) == 21 + assert sum_cards_recursive(cards) == 21 +#Added for project 2: Example tests given \ No newline at end of file