Day 14 (#16)
Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk> Reviewed-on: #16
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
<Compile Include="TestDay11.fs" />
|
||||
<Compile Include="TestDay12.fs" />
|
||||
<Compile Include="TestDay13.fs" />
|
||||
<Compile Include="TestDay14.fs" />
|
||||
<EmbeddedResource Include="samples\day1.txt"/>
|
||||
<EmbeddedResource Include="samples\day1part1.txt"/>
|
||||
<EmbeddedResource Include="samples\day2.txt"/>
|
||||
@@ -38,6 +39,7 @@
|
||||
<EmbeddedResource Include="samples\day11.txt" />
|
||||
<EmbeddedResource Include="samples\day12.txt" />
|
||||
<EmbeddedResource Include="samples\day13.txt" />
|
||||
<EmbeddedResource Include="samples\day14.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
48
AdventOfCode2023.FSharp/Test/TestDay14.fs
Normal file
48
AdventOfCode2023.FSharp/Test/TestDay14.fs
Normal file
@@ -0,0 +1,48 @@
|
||||
namespace AdventOfCode2023.Test
|
||||
|
||||
open System
|
||||
|
||||
open AdventOfCode2023
|
||||
open NUnit.Framework
|
||||
open FsUnitTyped
|
||||
open System.IO
|
||||
|
||||
[<TestFixture>]
|
||||
module TestDay14 =
|
||||
|
||||
[<Test>]
|
||||
let sample = Assembly.getEmbeddedResource typeof<Dummy>.Assembly "day14.txt"
|
||||
|
||||
[<Test>]
|
||||
let part1Sample () =
|
||||
sample |> Day14.part1 |> shouldEqual 136ul
|
||||
|
||||
[<Test>]
|
||||
let part2Sample () =
|
||||
sample |> Day14.part2 |> shouldEqual 64ul
|
||||
|
||||
[<Test>]
|
||||
let part1Actual () =
|
||||
let s =
|
||||
try
|
||||
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day14.txt"))
|
||||
with
|
||||
| :? DirectoryNotFoundException
|
||||
| :? FileNotFoundException ->
|
||||
Assert.Inconclusive ()
|
||||
failwith "unreachable"
|
||||
|
||||
Day14.part1 s |> shouldEqual 111339ul
|
||||
|
||||
[<Test>]
|
||||
let part2Actual () =
|
||||
let s =
|
||||
try
|
||||
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day14.txt"))
|
||||
with
|
||||
| :? DirectoryNotFoundException
|
||||
| :? FileNotFoundException ->
|
||||
Assert.Inconclusive ()
|
||||
failwith "unreachable"
|
||||
|
||||
Day14.part2 s |> shouldEqual 93736ul
|
10
AdventOfCode2023.FSharp/Test/samples/day14.txt
Normal file
10
AdventOfCode2023.FSharp/Test/samples/day14.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
O....#....
|
||||
O.OO#....#
|
||||
.....##...
|
||||
OO.#O....O
|
||||
.O.....O#.
|
||||
O.#..O.#.#
|
||||
..O..#O..O
|
||||
.......O..
|
||||
#....###..
|
||||
#OO..#....
|
Reference in New Issue
Block a user