-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53 | ||
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19 | ||
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1 | ||
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83 | ||
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36 | ||
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from day04.day4 import INPUT_SMALL, Card, Inventory, grab_data, split_numbers | ||
|
||
|
||
def test_split_numbers() -> None: | ||
assert split_numbers("6 7 8 9 10") == {6, 7, 8, 9, 10} | ||
assert split_numbers("") == set() | ||
assert split_numbers("6 6 6 6 6") == {6} | ||
|
||
|
||
def test_grab_data() -> None: | ||
cards: list[Card] = grab_data(INPUT_SMALL) | ||
assert len(cards) == 6 | ||
assert cards[0].id == 1 and cards[-1].id == 6 | ||
|
||
|
||
def test_card() -> None: | ||
card = Card("Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53\n") | ||
assert card.get_points() == 8 | ||
assert card.get_matches() == 4 | ||
|
||
|
||
def test_inventory() -> None: | ||
cards: list[Card] = grab_data(INPUT_SMALL) | ||
inventory: Inventory = Inventory(cards) | ||
assert inventory.total_cards() == 30 |