-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathday_09_test.exs
45 lines (38 loc) · 1.05 KB
/
day_09_test.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
defmodule AdventOfCode.Y2016.Day09Test do
@moduledoc false
use ExUnit.Case, async: true
@moduletag :y1609
alias AdventOfCode.Y2016.Day09, as: Solution
test "Year 2016, Day 9" do
assert Solution.run() == {102_239, 10_780_403_063}
end
describe "Year 2016, Day 9, Part 1" do
params = [
{"ADVENT", 6},
{"A(1x5)BC", 7},
{"(3x3)XYZ", 9},
{"A(2x2)BCD(2x2)EFG", 11},
{"(6x1)(1x3)A", 6},
{"X(8x2)(3x3)ABCY", 18}
]
for {input, output} <- params do
test "Works for #{input}" do
assert Solution.decompress_v1(unquote(input)) == unquote(output)
end
end
end
describe "Year 2016, Day 9, Part 2" do
params = [
{"ADVENT", 6},
{"(3x3)XYZ", 9},
{"X(8x2)(3x3)ABCY", 20},
{"(27x12)(20x12)(13x14)(7x10)(1x12)A", 241_920},
{"(25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN", 445}
]
for {input, output} <- params do
test "Works for #{input}" do
assert Solution.decompress_v2(unquote(input)) == unquote(output)
end
end
end
end