File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,11 @@ defmodule Day21a do
95
95
end
96
96
97
97
def run do
98
- File . read! ( ".input.txt" )
98
+ File . read! ( ".input.txt" ) |> run
99
+ end
100
+
101
+ def run ( input ) do
102
+ input
99
103
|> String . split ( "\n " )
100
104
|> Enum . map ( fn code ->
101
105
state = ~c" AAA"
@@ -242,7 +246,11 @@ defmodule Day21b do
242
246
end
243
247
244
248
def run do
245
- File . read! ( ".input.txt" )
249
+ File . read! ( ".input.txt" ) |> run
250
+ end
251
+
252
+ def run ( input ) do
253
+ input
246
254
|> String . split ( "\n " )
247
255
|> Enum . map ( fn code ->
248
256
state = 0 .. 25 |> Enum . map ( fn _ -> ?A end )
Original file line number Diff line number Diff line change
1
+ defmodule Day21Test do
2
+ use ExUnit.Case
3
+
4
+ def example , do: "029A
5
+ 980A
6
+ 179A
7
+ 456A
8
+ 379A"
9
+
10
+ test "Part 1 Example" do
11
+ assert Day21a . run ( example ( ) ) == 126_384
12
+ end
13
+
14
+ test "Part 2 Example" do
15
+ assert Day21b . run ( example ( ) ) == 154_115_708_116_294
16
+ end
17
+ end
Original file line number Diff line number Diff line change
1
+ ExUnit . start ( )
You can’t perform that action at this time.
0 commit comments