diff --git a/test/day2/day2_test.exs b/test/day2/day2_test.exs index 5dcc32d..ed96353 100644 --- a/test/day2/day2_test.exs +++ b/test/day2/day2_test.exs @@ -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 + 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