Skip to content

Commit

Permalink
Add test for getting maximum number of cubes by color
Browse files Browse the repository at this point in the history
  • Loading branch information
samjowen committed Dec 29, 2023
1 parent 00734de commit a8d736b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/day2/day2_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,16 @@ defmodule Day2Test do

assert Day2.validate_set_by_colour_and_amount(thirty_cube_set_str, max_cubes) == true
end

test "returns the maximum number of cubes for a specified color" do
game_1_sets = [
%{red: 4, green: 0, blue: 3},
%{red: 1, green: 2, blue: 6},
%{red: 0, green: 2, blue: 0}
]

assert Day2.get_max_cubes(game_1_sets, :blue) == 6
assert Day2.get_max_cubes(game_1_sets, :red) == 4
assert Day2.get_max_cubes(game_1_sets, :green) == 2
end
end

0 comments on commit a8d736b

Please sign in to comment.