From e3c809d112f586549e9e49ebd9bd497c09def74c Mon Sep 17 00:00:00 2001 From: Samuel Owen Date: Sun, 24 Dec 2023 02:03:34 +0000 Subject: [PATCH] Add test for parsing game sets --- test/day2/day2_test.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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