Day 22 and speedups (#34)

This commit is contained in:
Patrick Stevens
2022-12-22 11:51:54 +00:00
committed by GitHub
parent 6a08987e2a
commit 8a14768375
20 changed files with 1042 additions and 104 deletions

View File

@@ -0,0 +1,46 @@
namespace AdventOfCode2022.Test
open NUnit.Framework
open FsUnitTyped
open AdventOfCode2022
[<TestFixture>]
module TestDay22 =
let input =
""" ...#
.#..
#...
....
...#.......#
........#...
..#....#....
..........#.
...#....
.....#..
.#......
......#.
10R5L5R10L4R5L5
"""
[<Test>]
let ``Part 1, given`` () =
Day22.part1 (StringSplitEnumerator.make '\n' input) |> shouldEqual 6032
[<Test>]
let ``Part 1`` () =
let input = Assembly.readResource "Day22.txt"
Day22.part1 (StringSplitEnumerator.make '\n' input) |> shouldEqual 103224
[<Test>]
let ``Part 2, given`` () =
Day22.part2Example (StringSplitEnumerator.make '\n' input) |> shouldEqual 5031
[<Test>]
let ``Part 2`` () =
let input = Assembly.readResource "Day22.txt"
Day22.part2 (StringSplitEnumerator.make '\n' input) |> shouldEqual 189097