Skip to content

Commit

Permalink
Add test for parsing game sets
Browse files Browse the repository at this point in the history
  • Loading branch information
samjowen committed Dec 24, 2023
1 parent f049148 commit e3c809d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/day2/day2_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,17 @@ defmodule Day2Test do
assert Day2.parse_game_number(game_string) == "1"
assert Day2.parse_game_number(large_game_string) == "999"
end

test "it parses the sets from a game string" do

Check failure on line 18 in test/day2/day2_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test it parses the sets from a game string (Day2Test)
game_string =
"Game 1: 7 red, 14 blue; 2 blue, 3 red, 3 green; 4 green, 12 blue, 15 red; 3 green, 12 blue, 3 red; 11 red, 2 green"

assert Day2.parse_game_sets(game_string) == [
"7 red, 14 blue",
"2 blue, 3 red, 3 green",
"4 green, 12 blue, 15 red",
"3 green, 12 blue, 3 red",
"11 red, 2 green"
]
end
end

0 comments on commit e3c809d

Please sign in to comment.